Skip to content

Commit

Permalink
CM fixes (SAP#1755)
Browse files Browse the repository at this point in the history
  • Loading branch information
JohannesDoberer authored Dec 4, 2020
1 parent 08c3054 commit 58a1770
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 33 deletions.
6 changes: 3 additions & 3 deletions plugins/auth/src/auth-oidc/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ export default class openIdConnect {
logout(authData, authOnLogoutFn) {
const signoutData = {
id_token_hint: authData && authData.idToken,
state: window.location.href
state: encodeURI(window.location.href)
};

return this.client
Expand All @@ -105,7 +105,7 @@ export default class openIdConnect {
authOnLogoutFn();
window.location = req.url;
})
.catch(function(err) {
.catch(function (err) {
console.error('[OIDC] logout() Error', err);
authOnLogoutFn();
});
Expand Down Expand Up @@ -176,7 +176,7 @@ export default class openIdConnect {
Luigi.auth().store.removeAuthData();
resolve(response);
})
.catch(function(err) {
.catch(function (err) {
reject(response);
console.error('[OIDC] Logout Error', err);
});
Expand Down
2 changes: 1 addition & 1 deletion website/docs/src/client-js/outer-frame-handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { isSearchBot } from './helpers';
export class OuterFrameHandler {
init() {
if (this.outsideIframe() && !isSearchBot) {
const href = window.location.href;
const href = encodeURI(window.location.href);
let newHref;
if (href.includes('/docu-microfrontend')) {
newHref = href.replace('/docu-microfrontend', '').replace('#', '?section=');
Expand Down
35 changes: 16 additions & 19 deletions website/fiddle/public/auth/idpmock/logout.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,24 @@
<html>

<head>
<title>Luigi Mock Identity Provider</title>
<title>Luigi Mock Identity Provider</title>
</head>

<body>
Logging out...
<script>
window.onload = function() {
let redirectTo = decodeURIComponent(
window.location.href.match(/post_logout_redirect_uri=(.*?)(&|$)/)[1]
);
const decodeChars = (string) => {
return string.replace(/[<>'*+?^${}()|[\]\\]/g, '\\$&')
}
redirectTo = decodeChars(redirectTo);
if(!redirectTo.startsWith(window.location.origin)) {
console.warn("post_logout_redirect_uri has wrong input. You are redirected to /auth/logout.html!");
redirectTo = window.location.origin + '/auth/logout.html';
}
window.location.href = redirectTo;
};
</script>
Logging out...
<script>
window.onload = function () {
let href = encodeURI(window.location.href);
const decodeChars = (string) => string.replace(/[<>'*+?^${}()|[\]\\]/g, '\\$&');
let redirectTo =
decodeChars(decodeURIComponent(href.match(/post_logout_redirect_uri=(.*?)(&|$)/)[1]));
if (!redirectTo.startsWith(window.location.origin)) {
console.warn("post_logout_redirect_uri has wrong input. You are redirected to /auth/logout.html!");
redirectTo = '/auth/logout.html';
}
window.location.href = redirectTo;
};
</script>
</body>

</html>
</html>
25 changes: 15 additions & 10 deletions website/fiddle/public/auth/logout.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<!DOCTYPE html>
<html>

<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
Expand All @@ -15,30 +16,34 @@
font-size: 50px;
color: #a0a0a0;
}

.fd-container--centered {
text-align: center;
}
.fd-container {

.fd-container {
padding-top: 20px;
}
</style>
<script type="text/javascript">
function login() {
window.location.href = window.location.origin;
window.location.href = '/';
}
</script>
</head>

<body>
<div class="fd-container fd-container--centered">
<div class="fd-col--6 fd-col--shift-3">
<span class="sap-icon--log"></span>
<br />
<div class="fd-container fd-container--centered">
<div class="fd-col--6 fd-col--shift-3">
<span class="sap-icon--log"></span>
<br />
Logout successful
<br />
<br />
<button class="fd-button" onclick="login()">Login again</button>
<br />
<br />
<button class="fd-button" onclick="login()">Login again</button>
</div>
</div>
</div>

</body>

</html>

0 comments on commit 58a1770

Please sign in to comment.