1

I'm using deadbolt library for authentication in my playframewrok server app which holds api for some other frontend application. In MyDeadboltHandler class in onAuthFailure method when user isn't authenticated I want to return status 403 with next piece of code:

@Override
public F.Promise<Result> onAuthFailure(Http.Context context, String content) {
    return F.Promise.pure(unauthorized("Authentication Failed"));
}

however in my frontend application (Angular 1.5) in my error handler Im getting response which is some generic error with error status code -1 How can I change my method this to get normal 403 error status in response?

stef
  • 165
  • 1
  • 10

1 Answers1

0

That sounds more like a value emitted from Angular itself. If you use developer tools in your browser, you should see the incoming response and it should be a 401 (unauthorized). From here, you should be able to find the Angular code that's dealing with this.

You should also consider varying the response based on whether a subject is present. If a subject is present, return a 403; if a subject isn't present, return a 401.

Steve Chaloner
  • 8,162
  • 1
  • 22
  • 38