KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > geronimo > security > jaas > LoginModuleGBean


1 /**
2  * Licensed to the Apache Software Foundation (ASF) under one or more
3  * contributor license agreements. See the NOTICE file distributed with
4  * this work for additional information regarding copyright ownership.
5  * The ASF licenses this file to You under the Apache License, Version 2.0
6  * (the "License"); you may not use this file except in compliance with
7  * the License. You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */

17 package org.apache.geronimo.security.jaas;
18
19 import java.util.Properties JavaDoc;
20
21 import org.apache.geronimo.gbean.GBeanInfo;
22 import org.apache.geronimo.gbean.GBeanInfoBuilder;
23 import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
24
25
26 /**
27  * A GBean that wraps a LoginModule, plus options to configure the LoginModule.
28  * If you want to deploy the same LoginModule with different options, you need
29  * more than one of these GBeans. But if you want two security realms to refer
30  * to exactly the same login module configuration, you can have both realms
31  * refer to a single login module GBean.
32  *
33  * @version $Rev: 476049 $ $Date: 2006-11-16 23:35:17 -0500 (Thu, 16 Nov 2006) $
34  */

35 public class LoginModuleGBean implements LoginModuleSettings {
36     private String JavaDoc loginDomainName;
37     private String JavaDoc loginModuleClass;
38     private Properties JavaDoc options;
39     private final String JavaDoc objectName;
40     private boolean serverSide;
41     private boolean wrapPrincipals;
42     private final ClassLoader JavaDoc classLoader;
43
44     public LoginModuleGBean(String JavaDoc loginModuleClass, String JavaDoc objectName, boolean serverSide, boolean wrapPrincipals, ClassLoader JavaDoc classLoader) {
45         this.loginModuleClass = loginModuleClass;
46         this.objectName = objectName;
47         this.serverSide = serverSide;
48         this.wrapPrincipals = wrapPrincipals;
49         this.classLoader = classLoader;
50     }
51
52     public String JavaDoc getLoginDomainName() {
53         return loginDomainName;
54     }
55
56     public void setLoginDomainName(String JavaDoc loginDomainName) {
57         this.loginDomainName = loginDomainName;
58     }
59
60     public Properties JavaDoc getOptions() {
61         return options;
62     }
63
64     public void setOptions(Properties JavaDoc options) {
65         this.options = options;
66     }
67
68     public String JavaDoc getLoginModuleClass() {
69         return loginModuleClass;
70     }
71
72     public void setLoginModuleClass(String JavaDoc loginModuleClass) {
73         this.loginModuleClass = loginModuleClass;
74     }
75
76     public String JavaDoc getObjectName() {
77         return objectName;
78     }
79
80     public boolean isServerSide() {
81         return serverSide;
82     }
83
84     public void setServerSide(boolean serverSide) {
85         this.serverSide = serverSide;
86     }
87
88     public boolean isWrapPrincipals() {
89         return wrapPrincipals;
90     }
91
92     public void setWrapPrincipals(boolean wrapPrincipals) {
93         this.wrapPrincipals = wrapPrincipals;
94     }
95
96     public ClassLoader JavaDoc getClassLoader() {
97         return classLoader;
98     }
99
100     public static final GBeanInfo GBEAN_INFO;
101
102     static {
103         GBeanInfoBuilder infoFactory = GBeanInfoBuilder.createStatic(LoginModuleGBean.class, NameFactory.LOGIN_MODULE);
104         infoFactory.addAttribute("classLoader", ClassLoader JavaDoc.class, false);
105         infoFactory.addInterface(LoginModuleSettings.class, new String JavaDoc[] {"options", "loginModuleClass", "serverSide", "loginDomainName", "wrapPrincipals"},
106                                  new String JavaDoc[] {"options", "loginModuleClass", "serverSide", "wrapPrincipals"} );
107         infoFactory.setConstructor(new String JavaDoc[]{"loginModuleClass", "objectName", "serverSide", "wrapPrincipals", "classLoader"});
108
109         GBEAN_INFO = infoFactory.getBeanInfo();
110     }
111
112     public static GBeanInfo getGBeanInfo() {
113         return GBEAN_INFO;
114     }
115 }
116
Popular Tags