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) {
280280}
281281export function oauth_completeLogin ( ) {
282282 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 ( )
285290 } ) . catch ( function ( err ) {
286291 _management_logger . error ( err )
287292 oauth_redirectToLogin ( err )
288293 } ) ;
289294}
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+ }
290306
291307export function oauth_initiateLogout ( ) {
292308 if ( oauth . sp_initiated ) {
You can’t perform that action at this time.
0 commit comments