Skip to content

Commit baf253a

Browse files
Logout from idp only when end_session_endpoint
is available
1 parent 72dc78f commit baf253a

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

deps/rabbitmq_management/priv/www/js/main.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ function start_app_login () {
167167
});
168168
}
169169
})
170-
// TODO REFACTOR: this code can be simplified
170+
171171
if (oauth.enabled) {
172172
if (has_auth_credentials()) {
173173
check_login();

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

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -243,11 +243,23 @@ function oauth_completeLogin() {
243243

244244
function oauth_initiateLogout() {
245245
if (oauth.sp_initiated) {
246-
mgr.signoutRedirect()
246+
mgr.metadataService.getEndSessionEndpoint().then(endpoint => {
247+
if (endpoint == undefined) {
248+
// Logout only from management UI
249+
mgr.removeUser().then(res => {
250+
clear_auth()
251+
oauth_redirectToLogin()
252+
})
253+
}else {
254+
// OpenId Connect RP-Initiated Logout
255+
mgr.signoutRedirect()
256+
}
257+
})
247258
} else {
248259
go_to_authority()
249260
}
250261
}
262+
251263
function oauth_completeLogout() {
252264
clear_auth()
253265
mgr.signoutRedirectCallback().then(_ => oauth_redirectToLogin())
@@ -265,8 +277,5 @@ function validate_openid_configuration(payload) {
265277
if (typeof payload.jwks_uri != 'string') {
266278
throw new Error("Missing jwks_uri")
267279
}
268-
if (typeof payload.end_session_endpoint != 'string') {
269-
throw new Error("Missing end_session_endpoint")
270-
}
271280

272281
}

0 commit comments

Comments
 (0)