Commit 578545ada98af29784786aeb6ac6c098a9ed807c
1 parent
034218ef
Exists in
master
Criação do construtor de InvalidCredentialsException aceitando a causa
como parâmetro adicional.
Showing
2 changed files
with
14 additions
and
2 deletions
Show diff stats
impl/core/src/main/java/br/gov/frameworkdemoiselle/security/InvalidCredentialsException.java
| ... | ... | @@ -6,7 +6,7 @@ package br.gov.frameworkdemoiselle.security; |
| 6 | 6 | * @author SERPRO |
| 7 | 7 | */ |
| 8 | 8 | public class InvalidCredentialsException extends AuthenticationException { |
| 9 | - | |
| 9 | + | |
| 10 | 10 | private static final long serialVersionUID = 1L; |
| 11 | 11 | |
| 12 | 12 | /** |
| ... | ... | @@ -15,4 +15,16 @@ public class InvalidCredentialsException extends AuthenticationException { |
| 15 | 15 | public InvalidCredentialsException(String message) { |
| 16 | 16 | super(message); |
| 17 | 17 | } |
| 18 | + | |
| 19 | + /** | |
| 20 | + * Constructor with message and cause. | |
| 21 | + * | |
| 22 | + * @param message | |
| 23 | + * exception message | |
| 24 | + * @param cause | |
| 25 | + * exception cause | |
| 26 | + */ | |
| 27 | + public InvalidCredentialsException(String message, Throwable cause) { | |
| 28 | + super(message, cause); | |
| 29 | + } | |
| 18 | 30 | } | ... | ... |
impl/extension/servlet/src/main/java/br/gov/frameworkdemoiselle/security/ServletAuthenticator.java
| ... | ... | @@ -71,7 +71,7 @@ public class ServletAuthenticator implements Authenticator { |
| 71 | 71 | if (cause.getMessage().toLowerCase().contains("invalid") |
| 72 | 72 | || cause.getMessage().toLowerCase().contains("incorrect") |
| 73 | 73 | || cause.getMessage().toLowerCase().contains("failed")) { |
| 74 | - throw new InvalidCredentialsException(getBundle().getString("invalid-credentials")); | |
| 74 | + throw new InvalidCredentialsException(getBundle().getString("invalid-credentials"), cause); | |
| 75 | 75 | } else { |
| 76 | 76 | throw new AuthenticationException(getBundle().getString("authentication-failed"), cause); |
| 77 | 77 | } | ... | ... |