From f9dab83c585cb8c58b8aaf16e4b6c4bea2fa9f25 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Tue, 7 Feb 2017 12:23:30 -0500 Subject: [PATCH] update url gens --- oauth3.core.js | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/oauth3.core.js b/oauth3.core.js index 202d473..c305578 100644 --- a/oauth3.core.js +++ b/oauth3.core.js @@ -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