From 20a25c38e369b6b62e67ce6c04756a4036c66643 Mon Sep 17 00:00:00 2001 From: Jon Lambson Date: Thu, 24 Aug 2017 16:51:19 -0600 Subject: [PATCH 01/11] no clue what im doing --- js/app.js | 13 +++++++++---- js/controllers/login-controller.js | 4 ++-- templates/splash-page.html | 2 +- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/js/app.js b/js/app.js index 6e04297..f045243 100644 --- a/js/app.js +++ b/js/app.js @@ -8,13 +8,13 @@ app.config(['$stateProvider', '$urlRouterProvider', 'localStorageServiceProvider $urlRouterProvider.otherwise('/splash-page'); $stateProvider .state('splash-page', { - data: { requiresLogin: false }, + data: { requiresLogin: false, session: null }, url: '/splash-page', templateUrl: '/templates/splash-page.html', controller: 'loginCtrl as vm' }) .state('app',{ - data: { requiresLogin: true }, + data: { requiresLogin: true, session: null }, url: '/', controller: 'loginCtrl as vm', views: { @@ -112,11 +112,12 @@ app.config(['$stateProvider', '$urlRouterProvider', 'localStorageServiceProvider }); }]); -app.run(['$rootScope', '$state', 'Auth', function($rootScope, $state, Auth) { +app.run(['$rootScope', '$state', 'Auth', '$location', function($rootScope, $state, Auth, $location) { + console.log('$location:', $location.search()); $rootScope.urlArray = []; - $rootScope.$on('$stateChangeStart', function(event, toState, toParams, fromState, fromParams) { var requiresLogin = toState.data.requiresLogin; + toState.data.session = $location.search(); $rootScope.redirectedURL = toState.url; $rootScope.urlArray.push($rootScope.redirectedURL); if ($rootScope.urlArray.length > 1) { @@ -126,7 +127,11 @@ app.run(['$rootScope', '$state', 'Auth', function($rootScope, $state, Auth) { if (requiresLogin && !Auth.isLoggedIn()) { event.preventDefault(); + console.log('asdfasdfasdfasdfasdfasdfasdfasdf', toState); $state.go('splash-page', { 'toState': toState.name }); + } else { + // Auth.get(Auth.session); + } }); }]); diff --git a/js/controllers/login-controller.js b/js/controllers/login-controller.js index bcca67c..8d01bd3 100644 --- a/js/controllers/login-controller.js +++ b/js/controllers/login-controller.js @@ -1,6 +1,6 @@ app.controller('loginCtrl', [ - '$scope', '$timeout', 'Auth', '$location', 'localStorageService', '$rootScope', 'azp@oauth3.org' -, function ($scope, $timeout, Auth, $location, localStorageService, $rootScope, Oauth3) { + '$scope', '$timeout', 'Auth', '$location', 'localStorageService', '$rootScope', 'azp@oauth3.org', '$stateParams' +, function ($scope, $timeout, Auth, $location, localStorageService, $rootScope, Oauth3, $stateParams) { var vm = this; diff --git a/templates/splash-page.html b/templates/splash-page.html index b511195..95e7e7f 100644 --- a/templates/splash-page.html +++ b/templates/splash-page.html @@ -1,7 +1,7 @@

Sign in

- +
Resume with {{ profile.email }}
From bc14fc15d505ed7b421d5299ee59a2af17eacd8f Mon Sep 17 00:00:00 2001 From: Jon Lambson Date: Thu, 24 Aug 2017 16:54:42 -0600 Subject: [PATCH 02/11] clean up --- js/app.js | 1 - 1 file changed, 1 deletion(-) diff --git a/js/app.js b/js/app.js index f045243..e5796f0 100644 --- a/js/app.js +++ b/js/app.js @@ -113,7 +113,6 @@ app.config(['$stateProvider', '$urlRouterProvider', 'localStorageServiceProvider }]); app.run(['$rootScope', '$state', 'Auth', '$location', function($rootScope, $state, Auth, $location) { - console.log('$location:', $location.search()); $rootScope.urlArray = []; $rootScope.$on('$stateChangeStart', function(event, toState, toParams, fromState, fromParams) { var requiresLogin = toState.data.requiresLogin; From 9d379c759cd12d605c91065a68118e85d3a2e683 Mon Sep 17 00:00:00 2001 From: Jon Lambson Date: Fri, 25 Aug 2017 16:32:12 -0600 Subject: [PATCH 03/11] asadf --- js/app.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/js/app.js b/js/app.js index e5796f0..96e1dbb 100644 --- a/js/app.js +++ b/js/app.js @@ -126,11 +126,14 @@ app.run(['$rootScope', '$state', 'Auth', '$location', function($rootScope, $stat if (requiresLogin && !Auth.isLoggedIn()) { event.preventDefault(); - console.log('asdfasdfasdfasdfasdfasdfasdfasdf', toState); + console.log('stuff here ->', toState); + if (!angular.equals(toState.data.session, {})) { + var sess = toState.data.session.access_token; + console.log('WHERE', $rootScope.redirectedURL ); + Auth.add(sess) + $state.go("app." + $rootScope.redirectedURL); + } $state.go('splash-page', { 'toState': toState.name }); - } else { - // Auth.get(Auth.session); - } }); }]); From c01fb9d53f7c88be7daf0e58ea202cc037eec3c8 Mon Sep 17 00:00:00 2001 From: Jon Lambson Date: Mon, 28 Aug 2017 09:18:01 -0600 Subject: [PATCH 04/11] pulling --- js/app.js | 1 + 1 file changed, 1 insertion(+) diff --git a/js/app.js b/js/app.js index 96e1dbb..28196db 100644 --- a/js/app.js +++ b/js/app.js @@ -133,6 +133,7 @@ app.run(['$rootScope', '$state', 'Auth', '$location', function($rootScope, $stat Auth.add(sess) $state.go("app." + $rootScope.redirectedURL); } + console.log('WHERE', $rootScope.redirectedURL ); $state.go('splash-page', { 'toState': toState.name }); } }); From 5e1f9f917987ad0d47d601b4947d28ef10f0477d Mon Sep 17 00:00:00 2001 From: Jon Lambson Date: Mon, 28 Aug 2017 11:05:42 -0600 Subject: [PATCH 05/11] no clue --- js/app.js | 9 +++++++-- js/controllers/login-controller.js | 5 +++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/js/app.js b/js/app.js index 28196db..f8da0cf 100644 --- a/js/app.js +++ b/js/app.js @@ -117,21 +117,26 @@ app.run(['$rootScope', '$state', 'Auth', '$location', function($rootScope, $stat $rootScope.$on('$stateChangeStart', function(event, toState, toParams, fromState, fromParams) { var requiresLogin = toState.data.requiresLogin; toState.data.session = $location.search(); + var urlParams = $location.search(); + console.log('DUDDDDDDDEEEEEE ->', urlParams); $rootScope.redirectedURL = toState.url; $rootScope.urlArray.push($rootScope.redirectedURL); if ($rootScope.urlArray.length > 1) { $rootScope.redirectedURL = $rootScope.urlArray[0]; $rootScope.urlArray = []; } - +console.log('stuff here ->', toState); if (requiresLogin && !Auth.isLoggedIn()) { event.preventDefault(); console.log('stuff here ->', toState); if (!angular.equals(toState.data.session, {})) { var sess = toState.data.session.access_token; console.log('WHERE', $rootScope.redirectedURL ); + // $state.go("app." + $rootScope.redirectedURL); + } + if ('access_token' in urlParams && 'refresh_token' in urlParams && 'issuer' in urlParams && 'audience' in urlParams) { Auth.add(sess) - $state.go("app." + $rootScope.redirectedURL); + console.log('da '); } console.log('WHERE', $rootScope.redirectedURL ); $state.go('splash-page', { 'toState': toState.name }); diff --git a/js/controllers/login-controller.js b/js/controllers/login-controller.js index 2e13dde..0ca7d7e 100644 --- a/js/controllers/login-controller.js +++ b/js/controllers/login-controller.js @@ -102,6 +102,11 @@ app.controller('loginCtrl', [ subject: subject , scope: [ 'domains@oauth3.org', 'domains', 'dns@oauth3.org', 'dns', 'www@daplie.com' ] }).then(function (session) { + console.log('SESSION BRO -> ', session); + console.log('SESSION TOKEN -> ', session.token); + console.log('SESSION REFRESH TOKEN -> ', session.refresh); + console.log('SESSION ISSUER -> ', session.token.iss); + console.log('SESSION AUDIENCE -> ', session.token.aud); session.subject = subject; session.issuer = issuer; Auth.add(session); From c12c6441880efa68e5ae7f7f82e0e3a5dbdceb70 Mon Sep 17 00:00:00 2001 From: Jon Lambson Date: Mon, 28 Aug 2017 12:56:53 -0600 Subject: [PATCH 06/11] nope --- js/app.js | 16 ++++++---------- js/services/auth-service.js | 4 ++++ 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/js/app.js b/js/app.js index f8da0cf..798cdd0 100644 --- a/js/app.js +++ b/js/app.js @@ -118,28 +118,24 @@ app.run(['$rootScope', '$state', 'Auth', '$location', function($rootScope, $stat var requiresLogin = toState.data.requiresLogin; toState.data.session = $location.search(); var urlParams = $location.search(); - console.log('DUDDDDDDDEEEEEE ->', urlParams); $rootScope.redirectedURL = toState.url; $rootScope.urlArray.push($rootScope.redirectedURL); if ($rootScope.urlArray.length > 1) { $rootScope.redirectedURL = $rootScope.urlArray[0]; $rootScope.urlArray = []; } -console.log('stuff here ->', toState); if (requiresLogin && !Auth.isLoggedIn()) { event.preventDefault(); console.log('stuff here ->', toState); if (!angular.equals(toState.data.session, {})) { - var sess = toState.data.session.access_token; - console.log('WHERE', $rootScope.redirectedURL ); - // $state.go("app." + $rootScope.redirectedURL); - } - if ('access_token' in urlParams && 'refresh_token' in urlParams && 'issuer' in urlParams && 'audience' in urlParams) { - Auth.add(sess) - console.log('da '); + if ('access_token' in urlParams && 'refresh_token' in urlParams && 'issuer' in urlParams && 'audience' in urlParams) { + Auth.add(urlParams) + console.log('CURRENT SESSION IS: ',Auth.sessions); + } } + console.log('WHERE', $rootScope.redirectedURL ); - $state.go('splash-page', { 'toState': toState.name }); + // $state.go('splash-page', { 'toState': toState.name }); } }); }]); diff --git a/js/services/auth-service.js b/js/services/auth-service.js index 7331351..caf8580 100644 --- a/js/services/auth-service.js +++ b/js/services/auth-service.js @@ -22,6 +22,7 @@ app.factory('Auth', [ return Auth.sessions || false; } , add: function (session) { + console.log(session); var obj = JSON.parse(localStorage.getItem(dapSessions) || 'null') || {}; var dapName = 'dap-' + session.subject + '|' + session.issuer; @@ -69,6 +70,8 @@ app.factory('Auth', [ return Auth.session; } , get: function (session) { + console.log('mother fucking'); + console.log(session); if (!session) { return $q.resolve(null); } @@ -78,6 +81,7 @@ app.factory('Auth', [ } var name = session.token.sub + '@' + session.token.iss; + console.log('NAME', name); var promise; var sess; From b70aee0abbfb32c79cf37f2c80b936067af9ab82 Mon Sep 17 00:00:00 2001 From: Jon Lambson Date: Mon, 28 Aug 2017 14:32:52 -0600 Subject: [PATCH 07/11] still trying --- js/app.js | 4 ++-- js/services/auth-service.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/js/app.js b/js/app.js index 798cdd0..4b4b198 100644 --- a/js/app.js +++ b/js/app.js @@ -129,13 +129,13 @@ app.run(['$rootScope', '$state', 'Auth', '$location', function($rootScope, $stat console.log('stuff here ->', toState); if (!angular.equals(toState.data.session, {})) { if ('access_token' in urlParams && 'refresh_token' in urlParams && 'issuer' in urlParams && 'audience' in urlParams) { - Auth.add(urlParams) + Auth.add(urlParams); console.log('CURRENT SESSION IS: ',Auth.sessions); } } console.log('WHERE', $rootScope.redirectedURL ); - // $state.go('splash-page', { 'toState': toState.name }); + $state.go('splash-page', { 'toState': toState.name }); } }); }]); diff --git a/js/services/auth-service.js b/js/services/auth-service.js index caf8580..8f6a09b 100644 --- a/js/services/auth-service.js +++ b/js/services/auth-service.js @@ -22,6 +22,7 @@ app.factory('Auth', [ return Auth.sessions || false; } , add: function (session) { + console.log('what ya adding'); console.log(session); var obj = JSON.parse(localStorage.getItem(dapSessions) || 'null') || {}; var dapName = 'dap-' + session.subject + '|' + session.issuer; @@ -70,7 +71,7 @@ app.factory('Auth', [ return Auth.session; } , get: function (session) { - console.log('mother fucking'); + console.log('session:::::::'); console.log(session); if (!session) { return $q.resolve(null); @@ -81,7 +82,6 @@ app.factory('Auth', [ } var name = session.token.sub + '@' + session.token.iss; - console.log('NAME', name); var promise; var sess; From 69a6783e443b1f48a213ded664b6eef195256243 Mon Sep 17 00:00:00 2001 From: Jon Lambson Date: Mon, 28 Aug 2017 16:18:33 -0600 Subject: [PATCH 08/11] almost --- js/app.js | 27 ++++++++++++++------------- js/controllers/login-controller.js | 5 ----- js/services/auth-service.js | 3 --- 3 files changed, 14 insertions(+), 21 deletions(-) diff --git a/js/app.js b/js/app.js index 4b4b198..7649ed4 100644 --- a/js/app.js +++ b/js/app.js @@ -117,25 +117,26 @@ app.run(['$rootScope', '$state', 'Auth', '$location', function($rootScope, $stat $rootScope.$on('$stateChangeStart', function(event, toState, toParams, fromState, fromParams) { var requiresLogin = toState.data.requiresLogin; toState.data.session = $location.search(); - var urlParams = $location.search(); $rootScope.redirectedURL = toState.url; + var query = $location.search(); $rootScope.urlArray.push($rootScope.redirectedURL); - if ($rootScope.urlArray.length > 1) { - $rootScope.redirectedURL = $rootScope.urlArray[0]; - $rootScope.urlArray = []; - } + // if ($rootScope.urlArray.length > 1) { + // $rootScope.redirectedURL = $rootScope.urlArray[0]; + // $rootScope.urlArray = []; + // } if (requiresLogin && !Auth.isLoggedIn()) { event.preventDefault(); - console.log('stuff here ->', toState); + toState.data.session.token = OAUTH3.jwt.decode(query.access_token); + toState.data.session.refresh = OAUTH3.jwt.decode(query.refresh_token); if (!angular.equals(toState.data.session, {})) { - if ('access_token' in urlParams && 'refresh_token' in urlParams && 'issuer' in urlParams && 'audience' in urlParams) { - Auth.add(urlParams); - console.log('CURRENT SESSION IS: ',Auth.sessions); - } + // if ('access_token' in urlParams && 'refresh_token' in urlParams && 'issuer' in urlParams && 'audience' in urlParams) { + Auth.add(query); + console.log('go here', $rootScope.redirectedURL); + $state.go('app.'+$rootScope.redirectedURL) + // $location.path($rootScope.redirectedURL); + // } } - - console.log('WHERE', $rootScope.redirectedURL ); - $state.go('splash-page', { 'toState': toState.name }); + // $state.go('splash-page', { 'toState': toState.name }); } }); }]); diff --git a/js/controllers/login-controller.js b/js/controllers/login-controller.js index 0ca7d7e..2e13dde 100644 --- a/js/controllers/login-controller.js +++ b/js/controllers/login-controller.js @@ -102,11 +102,6 @@ app.controller('loginCtrl', [ subject: subject , scope: [ 'domains@oauth3.org', 'domains', 'dns@oauth3.org', 'dns', 'www@daplie.com' ] }).then(function (session) { - console.log('SESSION BRO -> ', session); - console.log('SESSION TOKEN -> ', session.token); - console.log('SESSION REFRESH TOKEN -> ', session.refresh); - console.log('SESSION ISSUER -> ', session.token.iss); - console.log('SESSION AUDIENCE -> ', session.token.aud); session.subject = subject; session.issuer = issuer; Auth.add(session); diff --git a/js/services/auth-service.js b/js/services/auth-service.js index 8f6a09b..40f0936 100644 --- a/js/services/auth-service.js +++ b/js/services/auth-service.js @@ -22,7 +22,6 @@ app.factory('Auth', [ return Auth.sessions || false; } , add: function (session) { - console.log('what ya adding'); console.log(session); var obj = JSON.parse(localStorage.getItem(dapSessions) || 'null') || {}; var dapName = 'dap-' + session.subject + '|' + session.issuer; @@ -71,8 +70,6 @@ app.factory('Auth', [ return Auth.session; } , get: function (session) { - console.log('session:::::::'); - console.log(session); if (!session) { return $q.resolve(null); } From 072af04a4dd4c9a4bbe958ed2057a05a291d90df Mon Sep 17 00:00:00 2001 From: Jon Lambson Date: Tue, 29 Aug 2017 09:34:58 -0600 Subject: [PATCH 09/11] clean up --- js/app.js | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/js/app.js b/js/app.js index 7649ed4..01955c0 100644 --- a/js/app.js +++ b/js/app.js @@ -126,17 +126,15 @@ app.run(['$rootScope', '$state', 'Auth', '$location', function($rootScope, $stat // } if (requiresLogin && !Auth.isLoggedIn()) { event.preventDefault(); - toState.data.session.token = OAUTH3.jwt.decode(query.access_token); - toState.data.session.refresh = OAUTH3.jwt.decode(query.refresh_token); if (!angular.equals(toState.data.session, {})) { - // if ('access_token' in urlParams && 'refresh_token' in urlParams && 'issuer' in urlParams && 'audience' in urlParams) { - Auth.add(query); - console.log('go here', $rootScope.redirectedURL); - $state.go('app.'+$rootScope.redirectedURL) - // $location.path($rootScope.redirectedURL); - // } + toState.data.session.token = OAUTH3.jwt.decode(query.access_token); + toState.data.session.refresh = OAUTH3.jwt.decode(query.refresh_token); + Auth.add(query); + console.log('go here', $rootScope.redirectedURL); + $state.go('app.' + $rootScope.redirectedURL); + } else { + $state.go('splash-page', { 'toState': toState.name }); } - // $state.go('splash-page', { 'toState': toState.name }); } }); }]); From c4cec293a78a279c3fc166d34067d00a5c3e2295 Mon Sep 17 00:00:00 2001 From: Jon Lambson Date: Tue, 29 Aug 2017 11:03:13 -0600 Subject: [PATCH 10/11] removing console.logs --- js/app.js | 5 ----- js/services/auth-service.js | 1 - 2 files changed, 6 deletions(-) diff --git a/js/app.js b/js/app.js index 01955c0..a3dd002 100644 --- a/js/app.js +++ b/js/app.js @@ -120,17 +120,12 @@ app.run(['$rootScope', '$state', 'Auth', '$location', function($rootScope, $stat $rootScope.redirectedURL = toState.url; var query = $location.search(); $rootScope.urlArray.push($rootScope.redirectedURL); - // if ($rootScope.urlArray.length > 1) { - // $rootScope.redirectedURL = $rootScope.urlArray[0]; - // $rootScope.urlArray = []; - // } if (requiresLogin && !Auth.isLoggedIn()) { event.preventDefault(); if (!angular.equals(toState.data.session, {})) { toState.data.session.token = OAUTH3.jwt.decode(query.access_token); toState.data.session.refresh = OAUTH3.jwt.decode(query.refresh_token); Auth.add(query); - console.log('go here', $rootScope.redirectedURL); $state.go('app.' + $rootScope.redirectedURL); } else { $state.go('splash-page', { 'toState': toState.name }); diff --git a/js/services/auth-service.js b/js/services/auth-service.js index 40f0936..7331351 100644 --- a/js/services/auth-service.js +++ b/js/services/auth-service.js @@ -22,7 +22,6 @@ app.factory('Auth', [ return Auth.sessions || false; } , add: function (session) { - console.log(session); var obj = JSON.parse(localStorage.getItem(dapSessions) || 'null') || {}; var dapName = 'dap-' + session.subject + '|' + session.issuer; From eb8ba4635c8a144352a30bdec95e3005e6ec5f3d Mon Sep 17 00:00:00 2001 From: Jon Lambson Date: Tue, 29 Aug 2017 11:07:25 -0600 Subject: [PATCH 11/11] update assests --- assets/oauth3.org | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets/oauth3.org b/assets/oauth3.org index effee98..a5742d1 160000 --- a/assets/oauth3.org +++ b/assets/oauth3.org @@ -1 +1 @@ -Subproject commit effee987beca6f0522a93533d65de1e7ed246987 +Subproject commit a5742d1a2aa42db0993081269beea695049d2805