-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwooidc_check_session.js
More file actions
56 lines (40 loc) · 1.46 KB
/
Copy pathwooidc_check_session.js
File metadata and controls
56 lines (40 loc) · 1.46 KB
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
44
45
46
47
48
49
50
51
52
53
54
55
56
Template.checkSessionIframe.helpers({
checkSession: function() {
var user = Meteor.user();
if (user && user.services && user.services.wooidc && user.services.wooidc.sessionState) {
var config = ServiceConfiguration.configurations.findOne({ service: 'wooidc' });
if (config && config.checkSessionIframe) {
return true;
}
}
return false;
},
rpPath: function() {
var url = '',
user = Meteor.user(),
config = ServiceConfiguration.configurations.findOne({ service: 'wooidc' });
url = Meteor.absoluteUrl('packages/wooidc/wooidc_rpframe.html?');
var parser = document.createElement('a');
parser.href = config.checkSessionIframe;
url += 'session_state=' + encodeURIComponent(user.services.wooidc.sessionState);
url += '&client_id=' + encodeURIComponent(config.clientId);
url += '&target=' + encodeURIComponent(parser.protocol + '//' + parser.host);
return url;
},
opPath: function() {
var config = ServiceConfiguration.configurations.findOne({ service: 'wooidc' });
if (!config) {
return;
}
return config.checkSessionIframe;
},
setOrder: function() {
Meteor.defer(function() {
$('iframe.wooidc').appendTo('body');
});
}
});
var wooidcLogout = function() {
Meteor.logout();
};
window.wooidcLogout = wooidcLogout;