You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@shiro.apache.org by jh...@apache.org on 2009/03/02 04:21:40 UTC

svn commit: r749161 - /incubator/jsecurity/import/trunk/src/org/jsecurity/realm/SimpleAccountRealm.java

Author: jhaile
Date: Mon Mar  2 03:21:39 2009
New Revision: 749161

URL: http://svn.apache.org/viewvc?rev=749161&view=rev
Log:
Fix for JSEC-51

Modified:
    incubator/jsecurity/import/trunk/src/org/jsecurity/realm/SimpleAccountRealm.java

Modified: incubator/jsecurity/import/trunk/src/org/jsecurity/realm/SimpleAccountRealm.java
URL: http://svn.apache.org/viewvc/incubator/jsecurity/import/trunk/src/org/jsecurity/realm/SimpleAccountRealm.java?rev=749161&r1=749160&r2=749161&view=diff
==============================================================================
--- incubator/jsecurity/import/trunk/src/org/jsecurity/realm/SimpleAccountRealm.java (original)
+++ incubator/jsecurity/import/trunk/src/org/jsecurity/realm/SimpleAccountRealm.java Mon Mar  2 03:21:39 2009
@@ -140,12 +140,16 @@
         UsernamePasswordToken upToken = (UsernamePasswordToken) token;
         SimpleAccount account = (SimpleAccount) getAuthorizationCache().get(upToken.getUsername());
 
-        if (account.isLocked()) {
-            throw new LockedAccountException("Account [" + account + "] is locked.");
-        }
-        if (account.isCredentialsExpired()) {
-            String msg = "The credentials for account [" + account + "] are expired";
-            throw new ExpiredCredentialsException(msg);
+        if( account != null ) {
+
+            if (account.isLocked()) {
+                throw new LockedAccountException("Account [" + account + "] is locked.");
+            }
+            if (account.isCredentialsExpired()) {
+                String msg = "The credentials for account [" + account + "] are expired";
+                throw new ExpiredCredentialsException(msg);
+            }
+            
         }
 
         return account;