bugfix opts.staletime, support domains
This commit is contained in:
parent
431bf019d8
commit
f7a7703b49
|
@ -458,6 +458,7 @@
|
|||
return OAUTH3.PromiseA.resolve(OAUTH3.hooks.session.set(providerUri, oldSession));
|
||||
}
|
||||
, check: function (preq, opts) {
|
||||
opts = opts || {};
|
||||
if (!preq.session) {
|
||||
return OAUTH3.PromiseA.resolve(null);
|
||||
}
|
||||
|
@ -954,6 +955,13 @@
|
|||
);
|
||||
}
|
||||
}
|
||||
, api: function (providerUri, opts) {
|
||||
if (!OAUTH3.api[opts.api]) {
|
||||
throw new Error("No API for '" + providerUri + "'");
|
||||
}
|
||||
|
||||
return OAUTH3.api[opts.api](providerUri, opts);
|
||||
}
|
||||
};
|
||||
OAUTH3.login = OAUTH3.implicitGrant;
|
||||
|
||||
|
@ -1031,7 +1039,8 @@
|
|||
, session: function () {
|
||||
return JSON.parse(JSON.stringify(OAUTH3.hooks.session._getCached(this._providerUri)));
|
||||
}
|
||||
, request: function (preq) {
|
||||
, request: function (preq, opts) {
|
||||
opts = opts || {};
|
||||
preq.client_uri = this._clientUri;
|
||||
preq.client_id = this._clientUri;
|
||||
preq.method = preq.method || 'GET';
|
||||
|
@ -1040,7 +1049,7 @@
|
|||
}
|
||||
// TODO maybe use a baseUrl from the directives file?
|
||||
preq.url = OAUTH3.url.resolve(this._providerUri, preq.url);
|
||||
return OAUTH3.request(preq);
|
||||
return OAUTH3.request(preq, opts);
|
||||
}
|
||||
, logout: function (opts) {
|
||||
opts = opts || {};
|
||||
|
@ -1050,6 +1059,12 @@
|
|||
|
||||
return OAUTH3.logout(this._providerUri, opts);
|
||||
}
|
||||
, api: function (api, opts) {
|
||||
opts = opts || {};
|
||||
opts.api = api;
|
||||
opts.session = OAUTH3.hooks.session._getCached(this._providerUri);
|
||||
OAUTH3.api(this._providerUri, opts);
|
||||
}
|
||||
};
|
||||
result.authenticate = result.login;
|
||||
result.authorize = result.login;
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
;(function (exports) {
|
||||
'use strict';
|
||||
|
||||
var OAUTH3 = exports.OAUTH3 = exports.OAUTH3 || require('./oauth3.core.js').OAUTH3;
|
||||
|
||||
OAUTH3.api['domains.list'] = function (providerUri, opts) {
|
||||
var session = opts.session;
|
||||
|
||||
return OAUTH3.request({
|
||||
method: 'GET'
|
||||
, url: OAUTH3.url.normalize(providerUri)
|
||||
+ '/api/com.daplie.domains/accounts/' + session.token.sub + '/registrations'
|
||||
, session: session
|
||||
}).then(function (res) {
|
||||
return res.data;
|
||||
});
|
||||
};
|
||||
|
||||
}('undefined' !== typeof exports ? exports : window));
|
|
@ -1,7 +1,7 @@
|
|||
;(function (exports) {
|
||||
'use strict';
|
||||
|
||||
var OAUTH3 = exports.OAUTH3 = exports.OAUTH3 || require('./oauth3.implicit.js').OAUTH3;
|
||||
var OAUTH3 = exports.OAUTH3 = exports.OAUTH3 || require('./oauth3.core.js').OAUTH3;
|
||||
|
||||
OAUTH3.query.parse = function (search) {
|
||||
// parse a query or a hash
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
'use strict';
|
||||
|
||||
angular
|
||||
.module('oauth3', [])
|
||||
.module('org.oauth3', [])
|
||||
.service('Oauth3', [
|
||||
'$timeout'
|
||||
, '$q'
|
||||
|
|
Loading…
Reference in New Issue