File tree Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -164,6 +164,23 @@ describe("oidc authorization", () => {
164
164
165
165
expect ( authUrl . searchParams . get ( "prompt" ) ) . toEqual ( "create" ) ;
166
166
} ) ;
167
+
168
+ it ( "should generate url with login_hint" , async ( ) => {
169
+ const nonce = "abc123" ;
170
+
171
+ const authUrl = new URL (
172
+ await generateOidcAuthorizationUrl ( {
173
+ metadata : delegatedAuthConfig ,
174
+ homeserverUrl : baseUrl ,
175
+ clientId,
176
+ redirectUri : baseUrl ,
177
+ nonce,
178
+ loginHint : "login1234" ,
179
+ } ) ,
180
+ ) ;
181
+
182
+ expect ( authUrl . searchParams . get ( "login_hint" ) ) . toEqual ( "login1234" ) ;
183
+ } ) ;
167
184
} ) ;
168
185
169
186
describe ( "completeAuthorizationCodeGrant" , ( ) => {
Original file line number Diff line number Diff line change @@ -125,6 +125,7 @@ export const generateAuthorizationUrl = async (
125
125
* @param prompt - indicates to the OP which flow the user should see - eg login or registration
126
126
* See https://openid.net/specs/openid-connect-prompt-create-1_0.html#name-prompt-parameter
127
127
* @param urlState - value to append to the opaque state identifier to uniquely identify the callback
128
+ * @param loginHint - send connecting user login hint to OP
128
129
* @returns a Promise with the url as a string
129
130
*/
130
131
export const generateOidcAuthorizationUrl = async ( {
@@ -136,6 +137,7 @@ export const generateOidcAuthorizationUrl = async ({
136
137
nonce,
137
138
prompt,
138
139
urlState,
140
+ loginHint,
139
141
} : {
140
142
clientId : string ;
141
143
metadata : ValidatedAuthMetadata ;
@@ -145,6 +147,7 @@ export const generateOidcAuthorizationUrl = async ({
145
147
nonce : string ;
146
148
prompt ?: string ;
147
149
urlState ?: string ;
150
+ loginHint ?: string ;
148
151
} ) : Promise < string > => {
149
152
const scope = generateScope ( ) ;
150
153
const oidcClient = new OidcClient ( {
@@ -163,6 +166,7 @@ export const generateOidcAuthorizationUrl = async ({
163
166
nonce,
164
167
prompt,
165
168
url_state : urlState ,
169
+ login_hint :loginHint
166
170
} ) ;
167
171
168
172
return request . url ;
You can’t perform that action at this time.
0 commit comments