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