Skip to content

Commit

Permalink
feat(dpop): add extras (alpha) (#1325) (release)
Browse files Browse the repository at this point in the history
* feat(dpop): add extras (alpha)

* udpate readme
  • Loading branch information
guillaume-chervet authored Mar 28, 2024
1 parent 51f6d12 commit 8335b5a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
3 changes: 2 additions & 1 deletion packages/oidc-client/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -402,9 +402,10 @@ export class OidcClient {
* @param accessToken The access token to use.
* @param url The url to use.
* @param method The method to use.
* @param extras Additional parameters to send to the OIDC server during the demonstration of proof of possession request.
* @returns A promise resolved with the proof of possession.
*/
async generateDemonstrationOfProofOfPossessionAsync(accessToken:string, url:string, method:string): Promise<string>;
async generateDemonstrationOfProofOfPossessionAsync(accessToken:string, url:string, method:string, extras:StringMap= {}): Promise<string>;
}

```
Expand Down
5 changes: 5 additions & 0 deletions packages/oidc-client/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ import {ILOidcLocation} from "./location";
export { getFetchDefault } from './oidc.js';
export { TokenRenewMode } from './parseTokens.js';
export { getParseQueryStringFromLocation, getPath } from './route-utils';

export type {
Tokens
} from './parseTokens.js';

export type {
AuthorityConfiguration,
Fetch,
Expand Down
5 changes: 2 additions & 3 deletions packages/react-oidc/src/ReactOidc.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { StringMap, OidcClient } from '@axa-fr/oidc-client';
import { StringMap, OidcClient, Tokens } from '@axa-fr/oidc-client';
import { useEffect, useState } from 'react';
import {Tokens} from "@axa-fr/oidc-client/dist/parseTokens";

const defaultConfigurationName = 'default';

Expand Down Expand Up @@ -86,7 +85,7 @@ export type OidcAccessToken = {
}

function getGenerateDemonstrationOfProofOfPossessionAsync(oidc: OidcClient, tokens: Tokens) {
return oidc.configuration.demonstrating_proof_of_possession ? (url: string, method: string) => oidc.generateDemonstrationOfProofOfPossessionAsync(tokens.accessToken, url, method) : null;
return oidc.configuration.demonstrating_proof_of_possession ? (url: string, method: string, extras:StringMap={}) => oidc.generateDemonstrationOfProofOfPossessionAsync(tokens.accessToken, url, method, extras) : null;
}

export const useOidcAccessToken = (configurationName = defaultConfigurationName) => {
Expand Down

0 comments on commit 8335b5a

Please sign in to comment.