You've already forked matrix-js-sdk
mirror of
https://github.com/matrix-org/matrix-js-sdk.git
synced 2025-11-23 17:02:25 +03:00
Allow specifying OIDC url state parameter for passing data to callback (#4068)
* Allow specifying more OIDC client metadata for dynamic registration Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Allow specifying url_state for dynamic oidc client registration Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Export NonEmptyArray type Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Allow specifying more OIDC client metadata for dynamic registration Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Export NonEmptyArray type Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Fix test Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --------- Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
committed by
GitHub
parent
f96dac1e5b
commit
ca914c97e0
@@ -129,6 +129,7 @@ export const generateAuthorizationUrl = async (
|
|||||||
* @param nonce - state
|
* @param nonce - state
|
||||||
* @param prompt - indicates to the OP which flow the user should see - eg login or registration
|
* @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
|
* 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
|
* @returns a Promise with the url as a string
|
||||||
*/
|
*/
|
||||||
export const generateOidcAuthorizationUrl = async ({
|
export const generateOidcAuthorizationUrl = async ({
|
||||||
@@ -139,6 +140,7 @@ export const generateOidcAuthorizationUrl = async ({
|
|||||||
identityServerUrl,
|
identityServerUrl,
|
||||||
nonce,
|
nonce,
|
||||||
prompt,
|
prompt,
|
||||||
|
urlState,
|
||||||
}: {
|
}: {
|
||||||
clientId: string;
|
clientId: string;
|
||||||
metadata: ValidatedIssuerMetadata;
|
metadata: ValidatedIssuerMetadata;
|
||||||
@@ -147,8 +149,9 @@ export const generateOidcAuthorizationUrl = async ({
|
|||||||
redirectUri: string;
|
redirectUri: string;
|
||||||
nonce: string;
|
nonce: string;
|
||||||
prompt?: string;
|
prompt?: string;
|
||||||
|
urlState?: string;
|
||||||
}): Promise<string> => {
|
}): Promise<string> => {
|
||||||
const scope = await generateScope();
|
const scope = generateScope();
|
||||||
const oidcClient = new OidcClient({
|
const oidcClient = new OidcClient({
|
||||||
...metadata,
|
...metadata,
|
||||||
client_id: clientId,
|
client_id: clientId,
|
||||||
@@ -164,6 +167,7 @@ export const generateOidcAuthorizationUrl = async ({
|
|||||||
state: userState,
|
state: userState,
|
||||||
nonce,
|
nonce,
|
||||||
prompt,
|
prompt,
|
||||||
|
url_state: urlState,
|
||||||
});
|
});
|
||||||
|
|
||||||
return request.url;
|
return request.url;
|
||||||
|
|||||||
Reference in New Issue
Block a user