correct logout

This commit is contained in:
AJ ONeal 2017-11-29 05:30:22 +00:00
parent f4b3dbd495
commit cf5c106f64
2 changed files with 14 additions and 7 deletions

View File

@ -40,8 +40,8 @@ function create(myOpts) {
return session;
});
}
, deauthorize: function () {
return OAUTH3.logout(myOpts.conf.provider_uri, {
, logout: function () {
return OAUTH3.logout(myOpts.directives, {
client_id: myOpts.conf.client_uri
, client_uri: myOpts.conf.client_uri
});

View File

@ -872,12 +872,19 @@
});
});
}
, logout: function(providerUri, opts) {
return OAUTH3.hooks.directives.get(providerUri).then(function (directives) {
, logout: function(issuerUri, opts) {
var directives;
if ('string' !== typeof issuerUri) {
directives = issuerUri;
return OAUTH3._logoutHelper(directives, opts);
}
return OAUTH3.hooks.directives.get(issuerUri).then(function (directives) {
return OAUTH3._logoutHelper(directives, opts);
});
}
, _logoutHelper: function(providerUri, directives, opts) {
, _logoutHelper: function(directives, opts) {
var issuerUri = directives.issuer_uri || directives.provider_uri;
var logoutReq = OAUTH3.urls.logout(
directives
, { client_id: (opts.client_id || opts.client_uri || OAUTH3.clientUri(OAUTH3._browser.window.location))
@ -900,10 +907,10 @@
if (params.error) {
// TODO directives.audience
return OAUTH3.PromiseA.reject(OAUTH3.error.parse(directives.issuer /*providerUri*/, params));
return OAUTH3.PromiseA.reject(OAUTH3.error.parse(directives.issuer /*issuerUri*/, params));
}
OAUTH3.hooks.session.clear(providerUri);
OAUTH3.hooks.session.clear(issuerUri);
return params;
});
}