From 607ba825225e8ca11051e685b7e77239b7946bb8 Mon Sep 17 00:00:00 2001 From: Ben Alex Date: Tue, 4 Jan 2005 19:58:27 +0000 Subject: [PATCH] Allow JBoss adapter to handle new exceptions (thanks to Sergio Berna). --- .../adapters/jboss/JbossAcegiLoginModule.java | 14 +++++++++++++- doc/xdocs/changes.xml | 1 + project.xml | 3 +++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/adapters/jboss/src/main/java/org/acegisecurity/adapters/jboss/JbossAcegiLoginModule.java b/adapters/jboss/src/main/java/org/acegisecurity/adapters/jboss/JbossAcegiLoginModule.java index 13133db768..883ae22166 100644 --- a/adapters/jboss/src/main/java/org/acegisecurity/adapters/jboss/JbossAcegiLoginModule.java +++ b/adapters/jboss/src/main/java/org/acegisecurity/adapters/jboss/JbossAcegiLoginModule.java @@ -17,6 +17,8 @@ package net.sf.acegisecurity.adapters.jboss; import net.sf.acegisecurity.Authentication; import net.sf.acegisecurity.AuthenticationException; +import net.sf.acegisecurity.CredentialsExpiredException; +import net.sf.acegisecurity.AccountExpiredException; import net.sf.acegisecurity.AuthenticationManager; import net.sf.acegisecurity.adapters.PrincipalAcegiUserToken; import net.sf.acegisecurity.providers.UsernamePasswordAuthenticationToken; @@ -210,7 +212,17 @@ public class JbossAcegiLoginModule extends AbstractServerLoginModule { if (super.log.isDebugEnabled()) { super.log.debug("authentication succeded"); } - } catch (AuthenticationException failed) { + }catch(CredentialsExpiredException cee){ + if (super.log.isDebugEnabled()) { + super.log.debug("Credential has expired"); + } + throw new javax.security.auth.login.CredentialExpiredException("The credential used to identify the user has expired"); + }catch(AccountExpiredException cee){ + if (super.log.isDebugEnabled()) { + super.log.debug("Account has expired, throwing jaas exception"); + } + throw new javax.security.auth.login.AccountExpiredException("The account specified in login has expired"); + }catch (AuthenticationException failed) { if (super.log.isDebugEnabled()) { super.log.debug("Bad password for username=" + username); } diff --git a/doc/xdocs/changes.xml b/doc/xdocs/changes.xml index b6166baf4b..154196fe8b 100644 --- a/doc/xdocs/changes.xml +++ b/doc/xdocs/changes.xml @@ -47,6 +47,7 @@ Added attempted username to view if processed by AuthenticationProcessingFilter Added UserDetails account and credentials expiration methods Added exceptions and events to support new UserDetails methods + Added new exceptions to JBoss container adapter Improved BasicAclProvider to only respond to specified ACL object requests Refactored MethodDefinitionSource to work with Method, not MethodInvocation Refactored AbstractFilterInvocationDefinitionSource to work with URL Strings alone diff --git a/project.xml b/project.xml index 0a6fd2cb7c..b1a3748042 100644 --- a/project.xml +++ b/project.xml @@ -133,6 +133,9 @@ Joni Suominen + + Sergio Berna +