-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathauth.html
43 lines (42 loc) · 1.75 KB
/
auth.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<html><head></head><body><script type="text/javascript" src="/bower_components/lscache/lscache.min.js"></script><script type="text/javascript">(function(){
var res = window.location.hash.substr(1);
var queryString = {};
res.replace(
new RegExp('([^?=&]+)(=([^&]*))?', 'g'),
function($0, $1, $2, $3) { queryString[$1] = $3; }
);
if(queryString.id_token){
var id = sessionStorage.getItem('apiNotebook');
sessionStorage.removeItem('apiNotebook');
lscache.set('id_token', queryString.id_token);
window.parent.postMessage({
idToken: true
}, "*");
return;
}
//basic token for services listing, apinotebooks etc.
if(!queryString.scope || queryString.scope === 'hybris.no_tenant'){
lscache.set('noTenantToken', queryString.access_token, 59);
window.parent.postMessage({
noTenantToken: true
}, "*");
return;
}
//token for specific purposes - you can distinguish the purpose in scopes passed
if (queryString.scope && queryString.scope.indexOf('hybris.tenant') !== -1) {
lscache.set('tenantToken', queryString.access_token, 59);
window.parent.postMessage({
tenantToken: true,
scope: queryString.scope
}, "*");
return;
}
//token for organization tokens - removal for now only
if(queryString.scope && queryString.scope.indexOf('hybris.org') !== -1){
lscache.set('orgToken', queryString.access_token, 59);
window.parent.postMessage({
orgToken: true,
scope: queryString.scope
}, "*");
}
})();</script></body></html>