KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > security > auth > spi > AnonLoginModule


1 /*
2  * JBoss, the OpenSource WebOS
3  *
4  * Distributable under LGPL license.
5  * See terms of license at gnu.org.
6  */

7
8 package org.jboss.security.auth.spi;
9
10 import java.security.acl.Group JavaDoc;
11 import javax.security.auth.login.LoginException JavaDoc;
12
13 import org.jboss.security.SimpleGroup;
14 import org.jboss.security.auth.spi.UsernamePasswordLoginModule;
15
16 /**
17  * A simple login module that simply allows for the specification of the
18  * identity of unauthenticated users via the unauthenticatedIdentity property.
19  *
20  * @author Scott.Stark@jboss.org
21  * @version $Revision: 1.5 $
22  */

23 public class AnonLoginModule extends UsernamePasswordLoginModule
24 {
25    /**
26     * Override to return an empty Roles set.
27     * @return an array comtaning an empty 'Roles' Group.
28     */

29    protected Group JavaDoc[] getRoleSets() throws LoginException JavaDoc
30    {
31       SimpleGroup roles = new SimpleGroup("Roles");
32       Group JavaDoc[] roleSets = {roles};
33       return roleSets;
34    }
35
36    /**
37     * Overriden to return null.
38     * @return null always
39     */

40    protected String JavaDoc getUsersPassword() throws LoginException JavaDoc
41    {
42       return null;
43    }
44 }
45
Popular Tags