Skip to content

Commit d23826e

Browse files
Request introspection from management ui
1 parent 6cd7bd7 commit d23826e

File tree

1 file changed

+18
-2
lines changed
  • deps/rabbitmq_management/priv/www/js/oidc-oauth

1 file changed

+18
-2
lines changed

deps/rabbitmq_management/priv/www/js/oidc-oauth/helper.js

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -280,13 +280,29 @@ function oauth_redirectToLogin(error) {
280280
}
281281
export 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

291307
export function oauth_initiateLogout() {
292308
if (oauth.sp_initiated) {

0 commit comments

Comments
 (0)