[jboss-cvs] jboss-seam/src/main/org/jboss/seam/security/authenticator ...
Shane Bryzak
Shane_Bryzak at symantec.com
Tue Aug 1 01:03:34 EDT 2006
User: sbryzak2
Date: 06/08/01 01:03:34
Modified: src/main/org/jboss/seam/security/authenticator
Authenticator.java ProviderAuthenticator.java
Log:
initial logout() support
Revision Changes Path
1.7 +1 -0 jboss-seam/src/main/org/jboss/seam/security/authenticator/Authenticator.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: Authenticator.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/security/authenticator/Authenticator.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- Authenticator.java 31 Jul 2006 03:22:23 -0000 1.6
+++ Authenticator.java 1 Aug 2006 05:03:34 -0000 1.7
@@ -12,4 +12,5 @@
{
Authentication authenticate(Authentication authentication)
throws AuthenticationException;
+ void unauthenticate(Authentication authentication);
}
1.4 +50 -4 jboss-seam/src/main/org/jboss/seam/security/authenticator/ProviderAuthenticator.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: ProviderAuthenticator.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/security/authenticator/ProviderAuthenticator.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- ProviderAuthenticator.java 1 Aug 2006 02:04:54 -0000 1.3
+++ ProviderAuthenticator.java 1 Aug 2006 05:03:34 -0000 1.4
@@ -4,6 +4,7 @@
import java.util.List;
import static org.jboss.seam.ScopeType.APPLICATION;
+import org.jboss.seam.Component;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Scope;
import org.jboss.seam.annotations.Startup;
@@ -20,13 +21,29 @@
@Startup
public class ProviderAuthenticator implements Authenticator
{
- private List<AuthenticationProvider> providers = new ArrayList<AuthenticationProvider>();
+ /**
+ *
+ */
+ private List<Object> providers = new ArrayList<Object>();
+ /**
+ *
+ * @param authentication Authentication
+ * @return Authentication
+ * @throws AuthenticationException
+ */
public Authentication authenticate(Authentication authentication)
throws AuthenticationException
{
- for (AuthenticationProvider provider : providers)
+ for (Object p : providers)
{
+ AuthenticationProvider provider = null;
+
+ if (p instanceof AuthenticationProvider)
+ provider = (AuthenticationProvider) p;
+ else if (p instanceof Component)
+ provider = (AuthenticationProvider) ((Component) p).newInstance();
+
Authentication result = provider.authenticate(authentication);
if (result != null)
return result;
@@ -35,6 +52,29 @@
throw new AuthenticationException("Provider not found");
}
+ /**
+ *
+ * @param authentication Authentication
+ */
+ public void unauthenticate(Authentication authentication)
+ {
+ for (Object p : providers)
+ {
+ AuthenticationProvider provider = null;
+
+ if (p instanceof AuthenticationProvider)
+ provider = (AuthenticationProvider) p;
+ else if (p instanceof Component)
+ provider = (AuthenticationProvider) ((Component) p).newInstance();
+
+ provider.unauthenticate(authentication);
+ }
+ }
+
+ /**
+ *
+ * @param providerNames List
+ */
public void setProviders(List<String> providerNames)
{
for (String providerName : providerNames)
@@ -42,8 +82,14 @@
Object provider = null;
try
{
+ Component comp = Component.forName(providerName);
+ if (comp != null)
+ providers.add(comp);
+ else
+ {
provider = Class.forName(providerName).newInstance();
- providers.add((AuthenticationProvider) provider);
+ providers.add( (AuthenticationProvider) provider);
+ }
}
catch (Exception ex)
{
More information about the jboss-cvs-commits
mailing list