urls for otp

This commit is contained in:
AJ ONeal 2017-11-14 23:39:14 +00:00
parent c77d280b00
commit 0a980fd560
2 changed files with 13 additions and 6 deletions

View File

@ -706,7 +706,7 @@
*/
return OAUTH3._browser.request(preq, opts);
}
, implicitGrant: function(directives, opts) {
, implicitGrant: function (directives, opts) {
var promise;
var providerUri = directives.azp || directives.issuer || directives;

View File

@ -287,21 +287,25 @@ OAUTH3.urls.publishKey = function (directive, opts) {
, session: opts.session
};
};
OAUTH3.urls.credentialMeta = function (directive, opts) {
return OAUTH3.url.resolve(directive.api, directive.credential_meta.url)
.replace(':type', 'email')
.replace(':id', opts.email)
};
OAUTH3.authn = {};
OAUTH3.authn.loginMeta = function (directive, opts) {
var url = OAUTH3.urls.credentialMeta(directive, opts);
return OAUTH3.request({
method: directive.credential_meta.method || 'GET'
// TODO lint urls
// TODO client_uri
, url: OAUTH3.url.resolve(directive.api, directive.credential_meta.url)
.replace(':type', 'email')
.replace(':id', opts.email)
, url: url
});
};
OAUTH3.authn.otp = function (directive, opts) {
OAUTH3.urls.otp = function (directive, opts) {
// TODO client_uri
var preq = {
return {
method: directive.credential_otp.method || 'POST'
, url: OAUTH3.url.resolve(directive.api, directive.credential_otp.url)
, data: {
@ -314,6 +318,9 @@ OAUTH3.authn.otp = function (directive, opts) {
, username: opts.email
}
};
};
OAUTH3.authn.otp = function (directive, opts) {
var preq = OAUTH3.urls.otp(directive, opts);
return OAUTH3.request(preq);
};