Skip to main content
1-Visitor
June 9, 2016
Solved

Authenticator which will return 401 unauthorized on bad credentials and not execute system authenticators

  • June 9, 2016
  • 1 reply
  • 1610 views

Is it possible to write custom authenticator that will:

1) Has top priority (executed first) - YES

2) Be executed only when certian header will be present in the request - YES

3) Return 401 Unauthorized if credentials will be wrong AND respond to the user immedietally without executing system authenciators (HTTP BASIC etc) - ???

Best answer by keriw

you can have it do custom checks as the first part of your authenticator and if your custom checks fail you should be able to then use

httpResponse.sendError(HttpServletResponse.SC_UNAUTHORIZED, "your message goes here");

1 reply

keriw1-VisitorAnswer
1-Visitor
June 9, 2016

you can have it do custom checks as the first part of your authenticator and if your custom checks fail you should be able to then use

httpResponse.sendError(HttpServletResponse.SC_UNAUTHORIZED, "your message goes here");