Commit 82434fba47c02f45366ead95ee4508a6662a4a48

Authored by Dancovich
2 parents 5e4c7bab 6a01c640
Exists in master

Merge branch 'master' of https://github.com/demoiselle/framework.git

impl/extension/servlet/src/main/java/br/gov/frameworkdemoiselle/security/ServletAuthenticator.java
@@ -63,14 +63,14 @@ public class ServletAuthenticator implements Authenticator { @@ -63,14 +63,14 @@ public class ServletAuthenticator implements Authenticator {
63 private static ResourceBundle bundle; 63 private static ResourceBundle bundle;
64 64
65 @Override 65 @Override
66 - public void authenticate() throws AuthenticationException { 66 + public void authenticate() throws Exception {
67 try { 67 try {
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().toLowerCase().contains("invalid") 71 if (cause.getMessage().toLowerCase().contains("invalid")
72 || cause.getMessage().toLowerCase().contains("incorrect") 72 || cause.getMessage().toLowerCase().contains("incorrect")
73 - || cause.getMessage().toLowerCase().contains("failed") ) { 73 + || cause.getMessage().toLowerCase().contains("failed")) {
74 throw new InvalidCredentialsException(getBundle().getString("invalid-credentials")); 74 throw new InvalidCredentialsException(getBundle().getString("invalid-credentials"));
75 } else { 75 } else {
76 throw new AuthenticationException(getBundle().getString("authentication-failed"), cause); 76 throw new AuthenticationException(getBundle().getString("authentication-failed"), cause);
@@ -79,7 +79,7 @@ public class ServletAuthenticator implements Authenticator { @@ -79,7 +79,7 @@ public class ServletAuthenticator implements Authenticator {
79 } 79 }
80 80
81 @Override 81 @Override
82 - public void unauthenticate() { 82 + public void unauthenticate() throws Exception {
83 getCredentials().clear(); 83 getCredentials().clear();
84 try { 84 try {
85 getRequest().logout(); 85 getRequest().logout();
impl/extension/servlet/src/main/java/br/gov/frameworkdemoiselle/security/ServletAuthorizer.java
@@ -61,12 +61,12 @@ public class ServletAuthorizer implements Authorizer { @@ -61,12 +61,12 @@ public class ServletAuthorizer implements Authorizer {
61 private transient ResourceBundle bundle; 61 private transient ResourceBundle bundle;
62 62
63 @Override 63 @Override
64 - public boolean hasRole(String role) { 64 + public boolean hasRole(String role) throws Exception {
65 return getRequest().isUserInRole(role); 65 return getRequest().isUserInRole(role);
66 } 66 }
67 67
68 @Override 68 @Override
69 - public boolean hasPermission(String resource, String operation) { 69 + public boolean hasPermission(String resource, String operation) throws Exception {
70 throw new DemoiselleException(getBundle().getString("has-permission-not-supported", 70 throw new DemoiselleException(getBundle().getString("has-permission-not-supported",
71 RequiredPermission.class.getSimpleName())); 71 RequiredPermission.class.getSimpleName()));
72 } 72 }