Commit 38aba6bffe1a1465c3e4c9bad2030c5828c1ba31

Authored by Cleverson Sacramento
1 parent 6d43430f
Exists in master

Ajuste no tratamento de Invalid Credencials

impl/extension/rest/src/main/java/br/gov/frameworkdemoiselle/security/AbstractHTTPAuthorizationFilter.java
... ... @@ -57,12 +57,11 @@ import javax.servlet.http.HttpServletResponse;
57 57  
58 58 import br.gov.frameworkdemoiselle.util.Beans;
59 59 import br.gov.frameworkdemoiselle.util.NameQualifier;
60   -import br.gov.frameworkdemoiselle.util.ResourceBundle;
61 60 import br.gov.frameworkdemoiselle.util.Strings;
62 61  
63 62 public abstract class AbstractHTTPAuthorizationFilter implements Filter {
64 63  
65   - private transient ResourceBundle bundle;
  64 + // private transient ResourceBundle bundle;
66 65  
67 66 private transient Logger logger;
68 67  
... ... @@ -94,9 +93,8 @@ public abstract class AbstractHTTPAuthorizationFilter implements Filter {
94 93 performLogout(request, response);
95 94  
96 95 } catch (InvalidCredentialsException cause) {
97   - String message = getBundle().getString("authentication-failed");
98   - getLogger().log(FINE, message, cause);
99   -
  96 + // String message = getBundle().getString(cause.getMessage());
  97 + getLogger().log(FINE, cause.getMessage(), cause);
100 98 setUnauthorizedStatus(response, cause);
101 99 }
102 100  
... ... @@ -163,13 +161,13 @@ public abstract class AbstractHTTPAuthorizationFilter implements Filter {
163 161 response.getWriter().write(cause.getMessage());
164 162 }
165 163  
166   - private ResourceBundle getBundle() {
167   - if (bundle == null) {
168   - bundle = Beans.getReference(ResourceBundle.class, new NameQualifier("demoiselle-rest-bundle"));
169   - }
170   -
171   - return bundle;
172   - }
  164 + // private ResourceBundle getBundle() {
  165 + // if (bundle == null) {
  166 + // bundle = Beans.getReference(ResourceBundle.class, new NameQualifier("demoiselle-rest-bundle"));
  167 + // }
  168 + //
  169 + // return bundle;
  170 + // }
173 171  
174 172 private Logger getLogger() {
175 173 if (logger == null) {
... ...
impl/extension/rest/src/main/java/br/gov/frameworkdemoiselle/util/ValidatePayloadInterceptor.java
... ... @@ -45,6 +45,7 @@ import javax.interceptor.Interceptor;
45 45 import javax.interceptor.InvocationContext;
46 46 import javax.validation.ConstraintViolation;
47 47 import javax.validation.ConstraintViolationException;
  48 +import javax.validation.UnexpectedTypeException;
48 49 import javax.validation.Validation;
49 50 import javax.validation.Validator;
50 51 import javax.validation.ValidatorFactory;
... ... @@ -68,7 +69,12 @@ public class ValidatePayloadInterceptor implements Serializable {
68 69 if (params != null) {
69 70 ValidatorFactory dfv = Validation.buildDefaultValidatorFactory();
70 71 Validator validator = dfv.getValidator();
71   - violations.addAll(validator.validate(params));
  72 +
  73 + try {
  74 + violations.addAll(validator.validate(params));
  75 + } catch (UnexpectedTypeException cause) {
  76 + // TODO Colocar a mensagem no log
  77 + }
72 78 }
73 79 }
74 80  
... ...