Skip to content

Commit

Permalink
Updated changes for new authorization_details parameter RAR requests
Browse files Browse the repository at this point in the history
  • Loading branch information
gyaneshgouraw-okta committed Apr 15, 2024
1 parent 72f2230 commit 7442f4c
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 36 deletions.
3 changes: 0 additions & 3 deletions src/auth/client-authentication.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,6 @@ export const addClientAuthentication = async ({
clientSecret,
}: AddClientAuthenticationOptions): Promise<Record<string, unknown>> => {
const cid = payload.client_id || clientId;
if (payload.authorization_details) {
payload.authorization_details = JSON.stringify(payload.authorization_details);
}
if (clientAssertionSigningKey && !payload.client_assertion) {
const alg = clientAssertionSigningAlg || 'RS256';
const privateKey = await jose.importPKCS8(clientAssertionSigningKey, alg);
Expand Down
17 changes: 2 additions & 15 deletions src/auth/oauth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,19 +91,6 @@ export interface ClientCredentialsGrantRequest extends ClientCredentials {
audience: string;
}

interface AuthorizationDetails {
/**
* An identifier for the authorization details
*/
type: string;

/**
* Allow for any custom property to be sent to Auth0
* It represents data to specify the authorization requirements for a certain type of resource.
*/
[key: string]: any;
}

export interface PushedAuthorizationRequest extends ClientCredentials {
/**
* URI to redirect to.
Expand Down Expand Up @@ -160,9 +147,9 @@ export interface PushedAuthorizationRequest extends ClientCredentials {
code_challenge?: string;

/**
* Can carry fine-grained authorization data in OAuth messages as part of Rich Authorization Requests(RAR) {@link https://auth0.com/docs/get-started/authentication-and-authorization-flow/authorization-code-flow/authorization-code-flow-with-rar | Reference}
* A JSON stringified an array of objects. It Can carry fine-grained authorization data in OAuth messages as part of Rich Authorization Requests(RAR) {@link https://auth0.com/docs/get-started/authentication-and-authorization-flow/authorization-code-flow/authorization-code-flow-with-rar | Reference}
*/
authorization_details?: Required<AuthorizationDetails>[];
authorization_details?: string;

/**
* Allow for any custom property to be sent to Auth0
Expand Down
18 changes: 0 additions & 18 deletions test/auth/client-authentication.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -206,21 +206,3 @@ describe('client-authentication for par endpoint', () => {
});
});
});

describe('Validate addClientAuthentication function', () => {
it('should stringify authorization_details property of payload parameter', async () => {
const authorization_details = [{ type: 'payment_initiation', actions: ['write'] }];
const authenticatedPayload = await addClientAuthentication({
payload: {
authorization_details: authorization_details,
client_secret: 'foo',
},
domain: 'tenant.auth0.com',
clientId,
});

expect(authenticatedPayload.authorization_details).toEqual(
JSON.stringify(authorization_details)
);
});
});

0 comments on commit 7442f4c

Please sign in to comment.