From 735f3e0cc6503e8b56a847ed44b6233fde4f632b Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Tue, 14 Feb 2017 14:51:28 -0700 Subject: [PATCH] chimney --- oauth3.implicit.js | 28 +--------------------------- 1 file changed, 1 insertion(+), 27 deletions(-) diff --git a/oauth3.implicit.js b/oauth3.implicit.js index cd49dc5..d5c1960 100644 --- a/oauth3.implicit.js +++ b/oauth3.implicit.js @@ -207,7 +207,6 @@ return result; } , implicitGrant: function (directive, opts) { - //console.log('[implicitGrant]'); // // Example Implicit Grant Request // (for generating a browser-only session, not a session on your server) @@ -352,8 +351,6 @@ var providerUri = oldSession.provider_uri; var clientUri = oldSession.client_uri; - console.info('[oauth3.hooks.refreshSession] oldSession', JSON.parse(JSON.stringify(oldSession))); - console.info('[oauth3.hooks.refreshSession] newSession', newSession); Object.keys(oldSession).forEach(function (key) { oldSession[key] = undefined; }); @@ -378,18 +375,14 @@ oldSession.refresh.provider_uri = providerUri; } - console.info('[oauth3.hooks.refreshSession] refreshedSession', oldSession); - // set for a set of audiences return OAUTH3.PromiseA.resolve(OAUTH3.hooks.session.set(providerUri, oldSession)); } , check: function (preq, opts) { if (!preq.session) { - console.warn('[oauth3.hooks.checkSession] no session'); return OAUTH3.PromiseA.resolve(null); } var freshness = OAUTH3.jwt.freshness(preq.session.token, opts.staletime); - console.info('[oauth3.hooks.checkSession] freshness', freshness, preq.session); switch (freshness) { case 'stale': @@ -405,7 +398,6 @@ } } , stale: function (staleSession) { - console.info('[oauth3.hooks.sessionStale] called'); if (OAUTH3.hooks.session._stalePromise) { return OAUTH3.PromiseA.resolve(staleSession); } @@ -426,7 +418,6 @@ return OAUTH3.PromiseA.resolve(staleSession); } , expired: function (expiredSession) { - console.info('[oauth3.hooks.sessionExpired] called'); return OAUTH3._refreshToken( expiredSession.provider_uri , { client_uri: expiredSession.client_uri @@ -569,12 +560,10 @@ if (opts.broker) { // Discovery can happen in-flow because we know that this is // a valid oauth3 provider - console.info("broker implicit grant"); promise = OAUTH3._discoverThenImplicitGrant(providerUri, opts); } else { // Discovery must take place before calling implicitGrant - console.info("direct implicit grant"); promise = OAUTH3._implicitGrant(OAUTH3.hooks.directives._getCached(providerUri), opts); } @@ -599,9 +588,7 @@ , _discoverThenImplicitGrant: function(providerUri, opts) { opts.windowType = opts.windowType || 'popup'; return OAUTH3.discover(providerUri, opts).then(function (directives) { - console.info('Discover complete'); return OAUTH3._implicitGrant(directives, opts).then(function (tokens) { - console.info('Implicit Grant complete', tokens); return tokens; }); }); @@ -623,7 +610,6 @@ window.alert("DEBUG MODE: Pausing so you can look at logs and whatnot :) Fire at will!"); } - console.log("framing request for implicit grant"); return OAUTH3._browser.frameRequest( OAUTH3.utils.url.resolve(directives.issuer, authReq.url) , authReq.state // state should recycle params @@ -632,7 +618,6 @@ , debug: opts.debug } ).then(function (tokens) { - console.log("completed implicit grant"); if (tokens.error) { // TODO directives.audience return OAUTH3.PromiseA.reject(OAUTH3.utils._formatError(directives.issuer /*providerUri*/, tokens)); @@ -642,7 +627,6 @@ }); } , _refreshToken: function (providerUri, opts) { - console.info('[oauth3.requests.refreshToken] called', providerUri, opts); return OAUTH3.discover(providerUri, opts).then(function (directive) { var prequest = OAUTH3.urls.refreshToken(directive, opts); @@ -705,7 +689,6 @@ }); } , frameRequest: function (url, state, opts) { - console.log('frameRequest state', state); opts = opts || {}; var previousFrame = OAUTH3._browser._frames[state]; @@ -759,26 +742,20 @@ if ('background' === windowType) { if (previousFrame) { - console.log('previous frame in background'); previousFrame.location = url; //promise = previousFrame.promise; } else { - console.log('NO previous frame in background'); OAUTH3._browser._frames[state] = OAUTH3._browser.iframe(url, state, opts); } } else if ('popup' === windowType) { if (previousFrame) { - console.log('previous frame in pop'); - console.log(previousFrame); - console.log(url); previousFrame.location = url; if (opts.debug) { previousFrame.focus(); } } else { - console.log('NO previous frame in popup'); OAUTH3._browser._frames[state] = OAUTH3._browser.frame(url, state, opts); } } else if ('inline' === windowType) { @@ -794,7 +771,6 @@ } }).then(function (params) { - console.log('frameRequest formatting params (weird that this place exists, but not weird to be here)'); if (params.error) { // TODO directives.issuer || directives.audience return OAUTH3.PromiseA.reject(OAUTH3.utils._formatError('https://oauth3.org', params)); @@ -805,15 +781,13 @@ , closeFrame: function (state, opts) { opts = opts || {}; function close() { - console.log("Attempting to close... ", OAUTH3._browser._frames[state]); try { OAUTH3._browser._frames[state].close(); } catch(e) { - console.error(e); try { OAUTH3._browser._frames[state].remove(); } catch(e) { - console.error(e); + console.error(new Error("Could not clase window/iframe. closeFrame may have been called twice.")); } }