1four51.app.config(['$httpProvider', function($httpProvider) { 2 $httpProvider.interceptors.push(['$q', '$rootScope', '$451', 'Security', function($q, $rootScope, $451, Security) { 3 function appendAuth(config) { 4 config.headers['Authorization'] = Security.auth(); 5 return config; 6 } 7 8 return { 9 'request': function(config) { 10 return appendAuth(config) || $q.when(appendAuth(config)); 11 }, 12 'response': function(response) { 13 // using status code 202 [Created] to represent the authentication token has been created. it fits the RFC spec and makes the authentication handling much more RESTy 14 if (response.status === 202) { 15 16 if(!response.data.LogonInfoSent){ 17 Security.init(response.data, response.headers()["www-authenticate"]); 18 $rootScope.$broadcast('event:auth-loginConfirmed', response.data); 19 } 20 } 21 22 //if ($451.debug && typeof response.data == 'object') 23 // console.log(response.data); 24 25 return response || $q.when(response); 26 }, 27 'responseError': function(response) { 28 if (response.status === 401) { // unauthorized 29 $rootScope.$broadcast('event:auth-loginRequired'); 30 return $q.reject(response); 31 } 32 33 // login failed for: 34 if (response.status == 403) { 35 $rootScope.$broadcast('event:auth-loginFailed', response.data.Message); 36 return $q.reject(response); 37 } 38 39 if (response.status != 200) { 40 //return $q.reject(response); 41 throw response; 42 } 43 44 return $q.reject(response); 45 } 46 }; 47 }]); 48}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.