[jboss-cvs] JBossAS SVN: r89034 - projects/security/security-negotiation/branches/SECURITY-353/jboss-negotiation-portal/src/main/java/org/jboss/security/negotiation/portal.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue May 19 05:48:54 EDT 2009


Author: darran.lofthouse at jboss.com
Date: 2009-05-19 05:48:53 -0400 (Tue, 19 May 2009)
New Revision: 89034

Modified:
   projects/security/security-negotiation/branches/SECURITY-353/jboss-negotiation-portal/src/main/java/org/jboss/security/negotiation/portal/NegotiationUserModuleImpl.java
Log:
NullPointer Safety

Modified: projects/security/security-negotiation/branches/SECURITY-353/jboss-negotiation-portal/src/main/java/org/jboss/security/negotiation/portal/NegotiationUserModuleImpl.java
===================================================================
--- projects/security/security-negotiation/branches/SECURITY-353/jboss-negotiation-portal/src/main/java/org/jboss/security/negotiation/portal/NegotiationUserModuleImpl.java	2009-05-19 06:40:23 UTC (rev 89033)
+++ projects/security/security-negotiation/branches/SECURITY-353/jboss-negotiation-portal/src/main/java/org/jboss/security/negotiation/portal/NegotiationUserModuleImpl.java	2009-05-19 09:48:53 UTC (rev 89034)
@@ -48,21 +48,27 @@
    public boolean validatePassword(LDAPUserImpl user, String password) throws IdentityException
    {
       NegotiationContext negotiationContext = NegotiationContext.getCurrentNegotiationContext();
-      Object schemeContext = negotiationContext.getSchemeContext();
-      if (schemeContext != null && schemeContext instanceof GSSContext == false)
+      if (negotiationContext != null)
       {
-         throw new IllegalStateException("The schemeContext is not a GSSContext");
-      }
+         Object schemeContext = negotiationContext.getSchemeContext();
+         if (schemeContext != null)
+         {
+            if (schemeContext instanceof GSSContext == false)
+            {
+               throw new IllegalStateException("The schemeContext is not a GSSContext");
+            }
 
-      GSSContext gssContext = (GSSContext) schemeContext;
-      if (gssContext.isEstablished() == true)
-      {
-         log.info("gssContext.isEstablished()==true, no further password verification required.");
+            GSSContext gssContext = (GSSContext) schemeContext;
+            if (gssContext.isEstablished() == true)
+            {
+               log.info("gssContext.isEstablished()==true, no further password verification required.");
 
-         return true;
+               return true;
+            }
+         }
       }
 
-      log.info("gssContext.isEstablished()==true, falling back to default password verification.");
+      log.info("negotiationContext==null || schemeContext==null || gssContext.isEstablished()==false, falling back to default password verification.");
       return super.validatePassword(user, password);
    }
 




More information about the jboss-cvs-commits mailing list