Skip to content

Commit

Permalink
Allow specifying OIDC url state parameter for passing data to callback (
Browse files Browse the repository at this point in the history
#4068)

* Allow specifying more OIDC client metadata for dynamic registration

Signed-off-by: Michael Telatynski <[email protected]>

* Allow specifying url_state for dynamic oidc client registration

Signed-off-by: Michael Telatynski <[email protected]>

* Export NonEmptyArray type

Signed-off-by: Michael Telatynski <[email protected]>

* Allow specifying more OIDC client metadata for dynamic registration

Signed-off-by: Michael Telatynski <[email protected]>

* Export NonEmptyArray type

Signed-off-by: Michael Telatynski <[email protected]>

* Fix test

Signed-off-by: Michael Telatynski <[email protected]>

---------

Signed-off-by: Michael Telatynski <[email protected]>
  • Loading branch information
t3chguy authored Feb 19, 2024
1 parent f96dac1 commit ca914c9
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/oidc/authorize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ export const generateAuthorizationUrl = async (
* @param nonce - state
* @param prompt - indicates to the OP which flow the user should see - eg login or registration
* See https://openid.net/specs/openid-connect-prompt-create-1_0.html#name-prompt-parameter
* @param urlState - value to append to the opaque state identifier to uniquely identify the callback
* @returns a Promise with the url as a string
*/
export const generateOidcAuthorizationUrl = async ({
Expand All @@ -139,6 +140,7 @@ export const generateOidcAuthorizationUrl = async ({
identityServerUrl,
nonce,
prompt,
urlState,
}: {
clientId: string;
metadata: ValidatedIssuerMetadata;
Expand All @@ -147,8 +149,9 @@ export const generateOidcAuthorizationUrl = async ({
redirectUri: string;
nonce: string;
prompt?: string;
urlState?: string;
}): Promise<string> => {
const scope = await generateScope();
const scope = generateScope();
const oidcClient = new OidcClient({
...metadata,
client_id: clientId,
Expand All @@ -164,6 +167,7 @@ export const generateOidcAuthorizationUrl = async ({
state: userState,
nonce,
prompt,
url_state: urlState,
});

return request.url;
Expand Down

0 comments on commit ca914c9

Please sign in to comment.