[jboss-cvs] jboss-seam/src/main/org/jboss/seam/security/spi ...

Shane Bryzak Shane_Bryzak at symantec.com
Mon Jan 8 20:01:10 EST 2007


  User: sbryzak2
  Date: 07/01/08 20:01:10

  Modified:    src/main/org/jboss/seam/security/spi  SeamLoginModule.java
  Log:
  customisable auth method param types, renamed loginMethod to authMethod
  
  Revision  Changes    Path
  1.2       +25 -4     jboss-seam/src/main/org/jboss/seam/security/spi/SeamLoginModule.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: SeamLoginModule.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/security/spi/SeamLoginModule.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -b -r1.1 -r1.2
  --- SeamLoginModule.java	8 Jan 2007 12:48:00 -0000	1.1
  +++ SeamLoginModule.java	9 Jan 2007 01:01:10 -0000	1.2
  @@ -19,6 +19,7 @@
   import org.jboss.seam.log.Logging;
   import org.jboss.seam.security.SimpleGroup;
   import org.jboss.seam.security.SimplePrincipal;
  +import org.jboss.seam.util.Reflections;
   
   /**
    * Performs authentication using a Seam component
  @@ -27,7 +28,8 @@
    */
   public class SeamLoginModule implements LoginModule
   {
  -   private static final String OPTS_LOGIN_METHOD = "loginMethod";
  +   private static final String OPTS_AUTH_METHOD = "authMethod";
  +   private static final String OPTS_PARAM_TYPES = "paramTypes";
      
      private static final LogProvider log = Logging.getLogProvider(SeamLoginModule.class);   
      
  @@ -70,7 +72,7 @@
         throws LoginException
      {
         MethodBinding mb = Expressions.instance().createMethodBinding(
  -            (String) options.get(OPTS_LOGIN_METHOD));
  +            (String) options.get(OPTS_AUTH_METHOD));
         
         Object[] params = null;
         
  @@ -93,11 +95,31 @@
            log.error("Error invoking login method", ex);
            return false;
         }
  +      catch (ClassNotFoundException ex)
  +      {
  +         log.error("Error determining parameter types", ex);
  +         return false;
  +      }
      }
      
  +   /**
  +    * Returns the authentication method param types as a Class array.
  +    * 
  +    * @return
  +    * @throws ClassNotFoundException
  +    */
      public Class[] getLoginParamTypes()
  +      throws ClassNotFoundException
      {
  +      if (!options.containsKey(OPTS_PARAM_TYPES))
         return new Class[] {String.class, String.class, Set.class };
  +
  +      String[] paramTypes = ((String) options.get(OPTS_PARAM_TYPES)).split("[,]");
  +      Class[] types = new Class[paramTypes.length];
  +      for (int i = 0; i < paramTypes.length; i++)
  +         types[i] = Reflections.classForName(paramTypes[i].trim());
  +            
  +      return types;
      }
      
      /**
  @@ -123,7 +145,6 @@
   
      public boolean logout() throws LoginException
      {
  -      
         return true;
      }
   }
  
  
  



More information about the jboss-cvs-commits mailing list