Commit afa870dfceedea32374bbba68532b9b6bc5dc4f0

Authored by Emerson Oliveira
1 parent 6bf71c43
Exists in master

IN PROGRESS - issue FWK-142: Postar sobre o uso de segurança do

demoiselle-servlet 
https://demoiselle.atlassian.net/browse/FWK-142
Adição de captura da exceção InvalidCredentialsException pelo
AuthenticationExceptionHandler para redirecionamento para página de
login
impl/extension/jsf/src/main/java/br/gov/frameworkdemoiselle/internal/implementation/AuthenticationExceptionHandler.java
@@ -43,6 +43,7 @@ import javax.faces.context.FacesContext; @@ -43,6 +43,7 @@ import javax.faces.context.FacesContext;
43 import javax.servlet.http.HttpServletResponse; 43 import javax.servlet.http.HttpServletResponse;
44 44
45 import br.gov.frameworkdemoiselle.internal.configuration.JsfSecurityConfig; 45 import br.gov.frameworkdemoiselle.internal.configuration.JsfSecurityConfig;
  46 +import br.gov.frameworkdemoiselle.security.InvalidCredentialsException;
46 import br.gov.frameworkdemoiselle.security.NotLoggedInException; 47 import br.gov.frameworkdemoiselle.security.NotLoggedInException;
47 import br.gov.frameworkdemoiselle.util.Beans; 48 import br.gov.frameworkdemoiselle.util.Beans;
48 49
@@ -57,7 +58,7 @@ public class AuthenticationExceptionHandler extends AbstractExceptionHandler { @@ -57,7 +58,7 @@ public class AuthenticationExceptionHandler extends AbstractExceptionHandler {
57 protected boolean handleException(final Throwable cause, FacesContext facesContext) { 58 protected boolean handleException(final Throwable cause, FacesContext facesContext) {
58 boolean handled = false; 59 boolean handled = false;
59 60
60 - if (cause instanceof NotLoggedInException) { 61 + if (cause instanceof NotLoggedInException || cause instanceof InvalidCredentialsException) {
61 handled = true; 62 handled = true;
62 // TODO Inter [NQ]: remover referência a SecurityObserver criando uma classe comum que faz o 63 // TODO Inter [NQ]: remover referência a SecurityObserver criando uma classe comum que faz o
63 // redirecionamento e que é compartilhada entre elas. 64 // redirecionamento e que é compartilhada entre elas.