KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sslexplorer > security > AuthenticationModuleDefinition


1 /*
2  * SSL-Explorer
3  *
4  * Copyright (C) 2003-2006 3SP LTD. All Rights Reserved
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version 2 of
9  * the License, or (at your option) any later version.
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public
16  * License along with this program; if not, write to the Free Software
17  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18  */

19             
20 package com.sslexplorer.security;
21
22
23 /**
24  * Provides information about how to create and the capabilities of an
25  * <i>Authentication Module</i>
26  * <p>
27  * For every {@link com.sslexplorer.security.AuthenticationModule} to be used
28  * and instance of this call must be registered with the
29  * {@link com.sslexplorer.security.AuthenticationModuleManager}.
30  * <p>
31  * A module may be capable of supporting the entering of a username, in which
32  * case it is known as a <i>Primary Authentication Modules</i>. If this
33  * capability is not available, the module is a <i>Secondary Authentication Module</i>
34  * and may only be used after a primary has already been used.
35  * <p>
36  * There is a third type called a <i>System Authentication Module</i> which is
37  * used interally by the SSL-Explorer or its plugins but never presented to
38  * user directly. These are currently used for Webdav and Embedded client
39  * logons.
40  *
41  * @author Brett Smith <a HREF="mailto: brett@3sp.com">&lt;brett@3sp.com&gt;</a>
42  * @see com.sslexplorer.security.AuthenticationModuleManager
43  * @see com.sslexplorer.security.AuthenticationModule
44  * @see com.sslexplorer.security.AuthenticationScheme
45  */

46 public class AuthenticationModuleDefinition {
47     
48     // Private instance variables
49

50     private String JavaDoc name;
51     private Class JavaDoc moduleClass;
52     private String JavaDoc messageResourcesKey;
53     private boolean primary, secondary, system, primaryIfSecondaryExists;
54     
55     /**
56      * Constructor
57      *
58      * @param name module name
59      * @param moduleClass class of module
60      * @param messageResourcesKey message resources bundle id
61      * @param primary
62      * @param secondary
63      * @param system
64      */

65     public AuthenticationModuleDefinition(String JavaDoc name, Class JavaDoc moduleClass, String JavaDoc messageResourcesKey, boolean primary, boolean secondary, boolean system) {
66         this(name, moduleClass, messageResourcesKey, primary, secondary, system, false);
67     }
68
69     /**
70      * Constructor
71      *
72      * @param name
73      * @param moduleClass
74      * @param messageResourcesKey
75      * @param primary
76      * @param secondary
77      * @param system
78      * @param primaryIfSecondaryExists
79      */

80     public AuthenticationModuleDefinition(String JavaDoc name, Class JavaDoc moduleClass, String JavaDoc messageResourcesKey, boolean primary, boolean secondary, boolean system, boolean primaryIfSecondaryExists) {
81         this.name = name;
82         this.moduleClass = moduleClass;
83         this.messageResourcesKey = messageResourcesKey;
84         this.primary = primary;
85         this.secondary = secondary;
86         this.system = system;
87         this.primaryIfSecondaryExists = primaryIfSecondaryExists;
88     }
89     
90     /**
91      * Get if this module is a <i>Primary Authentication Module</i>. If it
92      * is then it is capable of providing a username.
93      *
94      * @return primary authentication module
95      */

96     public boolean getPrimary() {
97         return primary;
98     }
99     
100     /**
101      *
102      * @return
103      */

104     public boolean getPrimaryIfSecondardExists() {
105         return primaryIfSecondaryExists;
106     }
107     
108     /**
109      * Get if this module is a <i>Secondary Authentication Module</i>. If it
110      * is then it is capable of providing some authentication details other
111      * than the username.
112      *
113      * @return secondary authentication module
114      */

115     public boolean getSecondary() {
116         return secondary;
117     }
118     
119     /**
120      * Get if this module is a <i>System Authentication Module</i>. If it
121      * is then it is used only internally and for supporting other user / password
122      * only sub-systems such as the embedded VPN client or WebDAV.
123      *
124      * @return system authentication module
125      */

126     public boolean getSystem() {
127         return system;
128     }
129     
130     /**
131      * Get the Id of the message resource bundle where the additional
132      * resource for name / description of this module may be found.
133      *
134      * @return message resource keys
135      */

136     public String JavaDoc getMessageResourcesKey() {
137         return messageResourcesKey;
138     }
139     
140     /**
141      * Get the name of this module.
142      *
143      * @return name
144      */

145     public String JavaDoc getName() {
146         return name;
147     }
148     
149     /**
150      * Get the class that may be used to instantiate this module.
151      *
152      * @return class of module
153      */

154     public Class JavaDoc getModuleClass() {
155         return moduleClass;
156     }
157 }
Popular Tags