This commit is contained in:
Jon Lambson 2017-08-28 16:18:33 -06:00
parent b70aee0abb
commit 69a6783e44
3 changed files with 14 additions and 21 deletions

View File

@ -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 });
}
});
}]);

View File

@ -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);

View File

@ -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);
}