Class CertificateRealm
- All Implemented Interfaces:
GlassFishUserManagement
,GlassFishUserStore
,Comparable<Realm>
The certificate realm provides the security-service functionality needed to process a client-cert authentication. Since the SSL processing, and client certificate verification is done by NSS, no authentication is actually done by this realm. It only serves the purpose of being registered as the certificate handler realm and to service group membership requests during web container role checks.
There is no JAAS LoginModule corresponding to the certificate realm, therefore this realm does not require the jaas-context configuration parameter to be set. The purpose of a JAAS LoginModule is to implement the actual authentication processing, which for the case of this certificate realm is already done by the time execution gets to Java.
The certificate realm needs the following properties in its configuration: None.
The following optional attributes can also be specified:
- assign-groups - A comma-separated list of group names which will be assigned to all users who present a cryptographically valid certificate. Since groups are otherwise not supported by the cert realm, this allows grouping cert users for convenience.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic final class
ALoginModule
forCertificateRealm
can instantiate and pass aAppContextCallback
tohandle
method of the passedCallbackHandler
to retrieve the application name information. -
Field Summary
Fields inherited from class com.sun.enterprise.security.auth.realm.AbstractGlassFishRealmState
groupMapper, JAAS_CONTEXT_PARAM, PARAM_GROUP_MAPPING
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
authenticate
(Subject subject, X500Principal principal) Complete authentication of certificate user.Returns a short (preferably less than fifteen characters) description of the kind of authentication which is supported by this realm.getGroupNames
(String username) Returns the name of all the groups that this user belongs to.protected void
init
(Properties props) Initialize a realm with some properties.Methods inherited from class com.sun.enterprise.security.auth.realm.Realm
getDefaultInstance, getDefaultRealm, getInstance, getInstance, getRealmNames, getRealmStatsProvier, instantiate, instantiate, isValidRealm, isValidRealm, setDefaultRealm, unloadInstance, unloadInstance, updateInstance, updateInstance
Methods inherited from class com.sun.enterprise.security.auth.realm.AbstractGlassFishRealmState
addAssignGroups, compareTo, getDefaultDigestAlgorithm, getJAASContext, getMappedGroupNames, getName, getProperties, getProperty, refresh, setName, setProperty, toString
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.sun.enterprise.security.auth.realm.GlassFishUserManagement
addUser, addUser, persist, removeUser, supportsUserManagement, updateUser, updateUser
Methods inherited from interface com.sun.enterprise.security.auth.realm.GlassFishUserStore
getGroupNames, getUser, getUserNames, refresh
-
Field Details
-
AUTH_TYPE
- See Also:
-
-
Constructor Details
-
CertificateRealm
public CertificateRealm()
-
-
Method Details
-
getAuthType
Returns a short (preferably less than fifteen characters) description of the kind of authentication which is supported by this realm.- Specified by:
getAuthType
in classAbstractGlassFishRealmState
- Returns:
- Description of the kind of authentication that is directly supported by this realm.
-
init
Initialize a realm with some properties. This can be used when instantiating realms from their descriptions. This method is invoked from Realm during initialization.- Overrides:
init
in classAbstractGlassFishRealmState
- Parameters:
props
- Initialization parameters used by this realm.- Throws:
BadRealmException
- If the configuration parameters identify a corrupt realm.NoSuchRealmException
- If the configuration parameters specify a realm which doesn't exist.
-
authenticate
Complete authentication of certificate user.As noted, the certificate realm does not do the actual authentication (signature and cert chain validation) for the user certificate, this is done earlier in NSS. This method simply sets up the security context for the user in order to properly complete the authentication processing.
If any groups have been assigned to cert-authenticated users through the assign-groups property these groups are added to the security context for the current user.
- Parameters:
subject
- The Subject object for the authentication request.principal
- The X500Principal object from the user certificate.
-
getGroupNames
Returns the name of all the groups that this user belongs to.- Parameters:
username
- Name of the user in this realm whose group listing is needed.- Returns:
- Enumeration of group names (strings).
- Throws:
InvalidOperationException
- thrown if the realm does not support this operation - e.g. Certificate realm does not support this operation.NoSuchUserException
-