1 /*
2 * JBoss, Home of Professional Open Source
3 * Copyright 2005, JBoss Inc., and individual contributors as indicated
4 * by the @authors tag. See the copyright.txt in the distribution for a
5 * full listing of individual contributors.
6 *
7 * This is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU Lesser General Public License as
9 * published by the Free Software Foundation; either version 2.1 of
10 * the License, or (at your option) any later version.
11 *
12 * This software is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this software; if not, write to the Free
19 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21 */
22 package org.jboss.security.plugins;
23
24 import java.security.Principal;
25 import java.util.List;
26 import javax.management.ObjectName;
27
28 import org.jboss.mx.util.ObjectNameFactory;
29 import org.jboss.security.SecurityDomain;
30 import org.jboss.system.ServiceMBean;
31
32 /**
33 * The management interface for the JaasSecurityManagerService mbean.
34 *
35 * @author Scott.Stark@jboss.org
36 * @version $Revision: 44179 $
37 */
38 public interface JaasSecurityManagerServiceMBean
39 extends ServiceMBean, SecurityManagerMBean
40 {
41 ObjectName OBJECT_NAME = ObjectNameFactory.create("jboss.security:service=JaasSecurityManager");
42
43 /** A flag indicating if the Deep Copy of Subject Sets should be enabled in the security managers */
44 public boolean getDeepCopySubjectMode();
45
46 /**
47 * A flag indicating if the Deep Copy of Subject Sets should be enabled in the security managers
48 *
49 * @param flag
50 */
51 public void setDeepCopySubjectMode(boolean flag);
52
53 /**
54 * A flag indicating if the SecurityAssociation.setServer should be called
55 * on service startup.
56 * @return the SecurityAssociation.setServer flag.
57 */
58 public boolean getServerMode();
59
60 /**
61 * The SecurityAssociation server mode flag.
62 *
63 * @param flag - A flag indicating if the SecurityAssociation.setServer
64 * should be called on service startup.
65 */
66 public void setServerMode(boolean flag);
67
68 /**
69 * Get the name of the class that provides the security manager implementation.
70 */
71 String getSecurityManagerClassName();
72
73 /**
74 * Set the name of the class that provides the security manager implementation.
75 *
76 * @exception ClassNotFoundException thrown if the className cannot be found
77 * using the thread context class loader.
78 * @exception ClassCastException thrown if the className does not implement the
79 * org.jboss.security.AuthenticationManager interface.
80 */
81 void setSecurityManagerClassName(String className)
82 throws ClassNotFoundException, ClassCastException;
83
84 /**
85 * Get the name of the class that provides the SecurityProxyFactory implementation.
86 */
87 String getSecurityProxyFactoryClassName();
88
89 /**
90 * Set the name of the class that provides the SecurityProxyFactory implementation.
91 */
92 void setSecurityProxyFactoryClassName(String className)
93 throws ClassNotFoundException;
94
95 /** Get the default CallbackHandler implementation class name
96 *
97 * @return The fully qualified classname of the
98 */
99 public String getCallbackHandlerClassName();
100 /** Set the default CallbackHandler implementation class name
101 * @see javax.security.auth.callback.CallbackHandler
102 */
103 public void setCallbackHandlerClassName(String className)
104 throws ClassNotFoundException;
105
106 /**
107 * Get the jndi name under which the authentication CachePolicy implenentation
108 * is found
109 */
110 String getAuthenticationCacheJndiName();
111
112 /**
113 * Set the location of the security credential cache policy. This is first treated
114 * as a ObjectFactory location that is capable of returning CachePolicy instances
115 * on a per security domain basis by appending a '/security-domain-name' string
116 * to this name when looking up the CachePolicy for a domain. If this fails then
117 * the location is treated as a single CachePolicy for all security domains.
118 *
119 * @param jndiName the name to the ObjectFactory or CachePolicy binding.
120 */
121 void setAuthenticationCacheJndiName(String jndiName);
122
123 /**
124 * Get the default timed cache policy timeout.
125 * @return the default cache timeout in seconds.
126 */
127 int getDefaultCacheTimeout();
128
129 /**
130 * Set the default timed cache policy timeout. This has no affect if the
131 * AuthenticationCacheJndiName has been changed from the default value.
132 * @param timeoutInSecs the cache timeout in seconds.
133 */
134 void setDefaultCacheTimeout(int timeoutInSecs);
135
136 /**
137 * Get the default timed cache policy resolution.
138 */
139 int getDefaultCacheResolution();
140
141 /**
142 * Set the default timed cache policy resolution. This has no affect if the
143 * AuthenticationCacheJndiName has been changed from the default value.
144 *
145 * @param resInSecs resolution of timeouts in seconds.
146 */
147 void setDefaultCacheResolution(int resInSecs);
148
149 /** Set the indicated security domain cache timeout. This only has an
150 * effect if the security domain is using the default jboss TimedCachePolicy
151 * implementation.
152
153 @param securityDomain the name of the security domain cache
154 @param timeoutInSecs - the cache timeout in seconds.
155 @param resInSecs - resolution of timeouts in seconds.
156 */
157 public void setCacheTimeout(String securityDomain, int timeoutInSecs, int resInSecs);
158
159 /** Flush the authentication cache associated with the given securityDomain.
160 *
161 * @param securityDomain the name of the security domain cache
162 */
163 void flushAuthenticationCache(String securityDomain);
164
165 /** Flush a principal's authentication cache entry associated with the
166 * given securityDomain.
167 *
168 * @param securityDomain the name of the security domain cache
169 * @param user the principal of the user to flush
170 */
171 void flushAuthenticationCache(String securityDomain, Principal user);
172
173 /** The the list of active Principls for the given security domain
174 * @param securityDomain
175 * @return List<Princpals> of active users, may be null.
176 */
177 List getAuthenticationCachePrincipals(String securityDomain);
178
179 /**
180 * Register a SecurityDomain implmentation
181 */
182 void registerSecurityDomain(String securityDomain, SecurityDomain instance);
183
184 /**
185 * Get the default unauthenticated principal.
186 * @return The principal name
187 */
188 String getDefaultUnauthenticatedPrincipal();
189
190 /**
191 * Set the default unauthenticated principal.
192 * @param principal The principal name
193 */
194 void setDefaultUnauthenticatedPrincipal(String principal);
195
196 /**
197 * Get information about the JCA Providers
198 * @return
199 */
200 String displayJCAInformation();
201 }