File tree Expand file tree Collapse file tree 1 file changed +18
-2
lines changed
deps/rabbitmq_management/priv/www/js/oidc-oauth Expand file tree Collapse file tree 1 file changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -280,13 +280,29 @@ function oauth_redirectToLogin(error) {
280
280
}
281
281
export function oauth_completeLogin ( ) {
282
282
mgr . signinRedirectCallback ( ) . then ( function ( user ) {
283
- set_token_auth ( user . access_token ) ;
284
- oauth_redirectToHome ( ) ;
283
+ set_token_auth ( user . access_token )
284
+ if ( is_jwt_token ( user . access_token ) ) {
285
+ console . log ( "Detected opaque token. Introspecting it ..." )
286
+ set_token_auth ( introspect_token ( ) )
287
+ console . log ( "Introspected token" )
288
+ }
289
+ oauth_redirectToHome ( )
285
290
} ) . catch ( function ( err ) {
286
291
_management_logger . error ( err )
287
292
oauth_redirectToLogin ( err )
288
293
} ) ;
289
294
}
295
+ function introspect_token ( ) {
296
+ return JSON . parse ( sync_post ( { } , '/auth/introspect' ) )
297
+ }
298
+
299
+ function is_jwt_token ( token ) {
300
+ if ( token != null ) {
301
+ atob ( token ) . split ( "." ) . length == 3
302
+ } else {
303
+ return false
304
+ }
305
+ }
290
306
291
307
export function oauth_initiateLogout ( ) {
292
308
if ( oauth . sp_initiated ) {
You can’t perform that action at this time.
0 commit comments