Search Posts

Category: basic-authentication

HttpBasic authentication failure url

I am using Spring Boot and Angularjs. I am using HttpBasic for security. I want the user to be redirected to a particular url on authentication failure or when session is expired. The problem I am experiencing is the browser keeps poping up the authentication dialog when either the session is expired or a protected resource is visited by an authorized user. Here is my SecurityConfiguration public class SecurityConfiguration extends WebSecurityConfigurerAdapter { @Override protected void […]

How to pass basic authentication in rest service in AngularJS?

I have a REST web service that requires a basic authentication to consume its data. I am consuming it in AngularJS. The way I am doing it is as follows: $http.get(‘http://localhost:9200/persons/_search?_source=Gender’, { headers: { withCredentials: true, headers:{ ‘Authorization’: ‘Basic ‘ + btoa(“admin” + “:” + “admin”)} } }). then(function(response) { ctrl.json = response.data; }); }]); But the error that I am having in the console is: Request header field headers is not allowed by Access-Control-Allow-Headers […]