Skip to content

Feature/is 9286 send custom header #8

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Token Handler Assistant Changelog

## [1.1.0-rc.3] - 2024-07-03

- Send `token-handler-version` header in all requests

## [1.1.0-rc.2] - 2024-06-24

- Add forgotten `RefreshResponse` to exports.
Expand Down
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,4 +91,12 @@ on every load of the SPA. This function makes a decision based the query string
);
}
```
Note: This is just a simplified example. The timeout has to be cleared properly (before every refresh, or before logout).
Note: This is just a simplified example. The timeout has to be cleared properly (before every refresh, or before logout).

## Cookie Security

- `SameSite=Strict` cookies are sent to APIs, which cannot be sent from malicious sites
- to ensure that only precise whitelisted origins can send cookies to APIs, a `token-handler-version: 1` header is
sent by this library on every request to the OAuth Agent. In cross-origin deployments this ensures that a CORS pre-flight
request authorizes access. SPA developers may be required to send this header to token handler proxies as well (refer
to the token handler proxy documentation for details).
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@curity/token-handler-js-assistant",
"version": "1.1.0-rc.2",
"version": "1.1.0-rc.3",
"description": "Curity Token Handler JavaScript helper library",
"main": "lib/token-handler-assistant-lib.js",
"types": "lib/index.d.ts",
Expand Down
3 changes: 2 additions & 1 deletion src/oauth-agent-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,8 @@ export class OAuthAgentClient {

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

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