Skip to content

Commit 7e552a1

Browse files
authored
Merge pull request #8 from curityio/feature/IS-9286-send-custom-header
Feature/is 9286 send custom header
2 parents 85717ea + 17559fb commit 7e552a1

File tree

5 files changed

+18
-5
lines changed

5 files changed

+18
-5
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Token Handler Assistant Changelog
22

3+
## [1.1.0-rc.3] - 2024-07-03
4+
5+
- Send `token-handler-version` header in all requests
6+
37
## [1.1.0-rc.2] - 2024-06-24
48

59
- Add forgotten `RefreshResponse` to exports.

README.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,4 +91,12 @@ on every load of the SPA. This function makes a decision based the query string
9191
);
9292
}
9393
```
94-
Note: This is just a simplified example. The timeout has to be cleared properly (before every refresh, or before logout).
94+
Note: This is just a simplified example. The timeout has to be cleared properly (before every refresh, or before logout).
95+
96+
## Cookie Security
97+
98+
- `SameSite=Strict` cookies are sent to APIs, which cannot be sent from malicious sites
99+
- to ensure that only precise whitelisted origins can send cookies to APIs, a `token-handler-version: 1` header is
100+
sent by this library on every request to the OAuth Agent. In cross-origin deployments this ensures that a CORS pre-flight
101+
request authorizes access. SPA developers may be required to send this header to token handler proxies as well (refer
102+
to the token handler proxy documentation for details).

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@curity/token-handler-js-assistant",
3-
"version": "1.1.0-rc.2",
3+
"version": "1.1.0-rc.3",
44
"description": "Curity Token Handler JavaScript helper library",
55
"main": "lib/token-handler-assistant-lib.js",
66
"types": "lib/index.d.ts",

src/oauth-agent-client.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,8 @@ export class OAuthAgentClient {
171171

172172
private async fetch(method: string, path: string, content?: URLSearchParams): Promise<any> {
173173
const headers= {
174-
accept: 'application/json'
174+
accept: 'application/json',
175+
'token-handler-version': '1'
175176
} as Record<string, string>
176177

177178
if (path == 'login/start' || path == 'login/end') {

0 commit comments

Comments
 (0)