Session checks resolution against session info service.
Since @zaro created our session info service, we now have a neutral endpoint which we can use to trigger an OAuth token check. By doing this, we avoid circular dependencies that need a session, but do not need the full ResourceFactory api (like preferences). Change-Id: I6c0c3d39563914e5e88a59502200e280b8a22f4f
This commit is contained in:
@@ -19,8 +19,8 @@
|
||||
* by verifying the token state returned from the OpenID service.
|
||||
*/
|
||||
angular.module('sb.auth').factory('Session',
|
||||
function (SessionState, AccessToken, $rootScope, $log, $q, $state, User,
|
||||
RefreshManager, Notification, Severity) {
|
||||
function (SessionState, AccessToken, $rootScope, $log, $q, $state,
|
||||
SystemInfo, RefreshManager, Notification, Severity) {
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
@@ -72,11 +72,9 @@ angular.module('sb.auth').factory('Session',
|
||||
|
||||
var deferred = $q.defer();
|
||||
RefreshManager.tryRefresh().then(function () {
|
||||
var id = AccessToken.getIdToken();
|
||||
|
||||
User.get({id: id},
|
||||
function (user) {
|
||||
deferred.resolve(user);
|
||||
SystemInfo.get({},
|
||||
function (info) {
|
||||
deferred.resolve(info);
|
||||
}, function (error) {
|
||||
deferred.reject(error);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user