update url gens

This commit is contained in:
AJ ONeal 2017-02-07 12:23:30 -05:00
parent 73405e6742
commit f9dab83c58
1 changed files with 15 additions and 14 deletions

View File

@ -200,7 +200,7 @@
throw new Error("not implemented"); throw new Error("not implemented");
}; };
core.authorizationRedirect = function (directive, authorizationRedirect, opts) { core.authorizationRedirect = function (directive, opts) {
//console.log('[authorizationRedirect]'); //console.log('[authorizationRedirect]');
// //
// Example Authorization Redirect - from Browser to Consumer API // Example Authorization Redirect - from Browser to Consumer API
@ -228,6 +228,7 @@
, debug: opts.debug || undefined , debug: opts.debug || undefined
}; };
var slimProviderUri = encodeURIComponent(providerUri.replace(/^(https?|spdy):\/\//, '')); var slimProviderUri = encodeURIComponent(providerUri.replace(/^(https?|spdy):\/\//, ''));
var authorizationRedirect = opts.authorizationRedirect;
if (scope) { if (scope) {
params.scope = scope; params.scope = scope;
@ -368,7 +369,7 @@
}; };
}; };
core.resourceOwnerPassword = function (directive, username, passphrase, opts) { core.resourceOwnerPassword = function (directive, opts) {
// //
// Example Resource Owner Password Request // Example Resource Owner Password Request
// (generally for 1st party and direct-partner mobile apps, and webapps) // (generally for 1st party and direct-partner mobile apps, and webapps)
@ -381,27 +382,27 @@
var type = 'access_token'; var type = 'access_token';
var grantType = 'password'; var grantType = 'password';
if (!passphrase) { if (!opts.password) {
if (opts.otp) { if (opts.otp) {
// for backwards compat // for backwards compat
passphrase = opts.otp; // 'otp:' + opts.otpUuid + ':' + opts.otp; opts.password = opts.otp; // 'otp:' + opts.otpUuid + ':' + opts.otp;
} }
} }
var scope = opts.scope || directive.authn_scope; var scope = opts.scope || directive.authn_scope;
var clientId = opts.appId || opts.clientId; var clientId = opts.appId || opts.clientId || opts.client_id;
var clientAgreeTos = opts.clientAgreeTos; var clientAgreeTos = opts.clientAgreeTos || opts.client_agree_tos;
var clientUri = opts.clientUri; var clientUri = opts.clientUri || opts.client_uri || opts.clientUrl || opts.client_url;
var args = directive[type]; var args = directive[type];
var params = { var params = {
"grant_type": grantType "grant_type": grantType
, "username": username , "username": opts.username
, "password": passphrase || undefined , "password": opts.password || undefined
, "totp": opts.totp || opts.totpToken || undefined , "totp": opts.totp || opts.totpToken || opts.totp_token || undefined
, "otp": opts.otp || opts.otpCode || undefined , "otp": opts.otp || opts.otpCode || opts.otp_code || opts.otpToken || opts.otp_token || undefined
, "otp_uuid": opts.otpUuid || undefined , "otp_uuid": opts.otpUuid || opts.otp_uuid || undefined
, "user_agent": opts.userAgent || undefined // AJ's Macbook , "user_agent": opts.userAgent || opts.useragent || opts.user_agent || undefined // AJ's Macbook
, "jwk": opts.rememberDevice && opts.jwk || undefined , "jwk": (opts.rememberDevice || opts.remember_device) && opts.jwk || undefined
//, "public_key": opts.rememberDevice && opts.publicKey || undefined //, "public_key": opts.rememberDevice && opts.publicKey || undefined
//, "public_key_type": opts.rememberDevice && opts.publicKeyType || undefined // RSA/ECDSA //, "public_key_type": opts.rememberDevice && opts.publicKeyType || undefined // RSA/ECDSA
//, "jwt": opts.jwt // TODO sign a proof with a previously loaded public_key //, "jwt": opts.jwt // TODO sign a proof with a previously loaded public_key