Can';t使用angularjs从WebGate响应读取头参数
例如,这是我的VM WARE WEBGATE登录页面。 输入有效凭据后,它将在OAM(oracle access manager)下有效,并将返回头作为响应 现在,如果用户有效,它将重定向到另一个页面 但是,我看不到响应WebGate返回的内容的标题参数 这是我的代码:Can';t使用angularjs从WebGate响应读取头参数,angularjs,oam,Angularjs,Oam,例如,这是我的VM WARE WEBGATE登录页面。 输入有效凭据后,它将在OAM(oracle access manager)下有效,并将返回头作为响应 现在,如果用户有效,它将重定向到另一个页面 但是,我看不到响应WebGate返回的内容的标题参数 这是我的代码: app.factory('mainHttpInterceptor' , function($rootScope, $q, $location) {`enter code here` console.lo
app.factory('mainHttpInterceptor' ,
function($rootScope, $q, $location) {`enter code here`
console.log("in the authInterceptor------000000");
return{
request:function(config) {
console.log(config.headers);
return config;
},
response: function(response){
/* if (typeof response.headers != null) {
console.log(response.headers);
return response;
} */
console.log('in the hhtp interceptor');
$httpProvider.defaults.headers.common['Access-Control-Allow-Headers']= true;
console.log(response.headers());
console.log(response);
return response;
},
responseError: function(rejection){
console.log('Failed with', rejection.status, 'status');
if( rejection.status ==403){
$location.url('/login');
}
else if( rejection.status ==404){
console.log("nothing is there----------->");
/*$state.go('login');*/
}
return $q.reject(rejection);
}
};
})
app.config(['$httpProvider',function($httpProvider) {
$httpProvider.defaults.withCredentials = true;
/*Access-Control-Allow-Credentials == true;*/
$httpProvider.defaults.headers.common['Access-Control-Allow-Headers'] = true;
$httpProvider.interceptors.push('mainHttpInterceptor');
}]);
我应该怎么做才能将这些头参数输入到我的代码中。您想要什么类型的头?OAM会提供您在OAM管理控制台中配置的标题,如果您访问受保护的页面,实际上,他们在响应中附加了一些带有键值对的标头。这只是一个门,以便根据标头参数访问我的应用程序。它们在响应中返回的内容。
'access-Control-Allow-headers'
是一个响应标头…不是一个请求标头。您可以在OAM中附加标头来配置授权策略