Commit a14ff67971e42cba23d450381b31912fe53ac561

Authored by Cleverson Sacramento
1 parent 62e45da7
Exists in master

Ajustes para tratamento correto na detecção de falha na autenticação do

JAAS com Servlet
impl/extension/servlet/src/main/java/br/gov/frameworkdemoiselle/security/ServletAuthenticator.java
@@ -68,7 +68,8 @@ public class ServletAuthenticator implements Authenticator { @@ -68,7 +68,8 @@ public class ServletAuthenticator implements Authenticator {
68 getRequest().login(getCredentials().getUsername(), getCredentials().getPassword()); 68 getRequest().login(getCredentials().getUsername(), getCredentials().getPassword());
69 69
70 } catch (ServletException cause) { 70 } catch (ServletException cause) {
71 - if (cause.getMessage().contains("invalid")) { 71 + if (cause.getMessage().toLowerCase().contains("invalid")
  72 + || cause.getMessage().toLowerCase().contains("incorrect")) {
72 throw new InvalidCredentialsException(getBundle().getString("invalid-credentials")); 73 throw new InvalidCredentialsException(getBundle().getString("invalid-credentials"));
73 } else { 74 } else {
74 throw new AuthenticationException(getBundle().getString("authentication-failed"), cause); 75 throw new AuthenticationException(getBundle().getString("authentication-failed"), cause);