Class CertificateRealm

  • All Implemented Interfaces:
    Comparable<Realm>

    @Service
    public final class CertificateRealm
    extends BaseRealm
    Realm wrapper for supporting certificate authentication.

    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 properties 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.
    • "common-name-as-principal-name" - if true, the CN from the client certificate will be used as a name of the principal
    • "dn-parts-used-for-groups" a comma-separated list of OID names whose values in certificate's distinguished name will be used as a group names.
    • Field Detail

      • AUTH_TYPE

        public static final String AUTH_TYPE
        Descriptive string of the authentication type of this realm.
        See Also:
        Constant Field Values
    • Constructor Detail

      • CertificateRealm

        public CertificateRealm()
    • Method Detail

      • getAuthType

        public String 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 class AbstractRealm
        Returns:
        Description of the kind of authentication that is directly supported by this realm.
      • getGroupNames

        public Enumeration<String> getGroupNames​(String username)
        WARN: does not have access to user's certificate, so it does not return groups based on certificate.
        Specified by:
        getGroupNames in class AbstractRealm
        Parameters:
        username - name of the user in this realm whose group listing is needed.
        Returns:
        enumeration of group names assigned to all users authenticated by this realm.
      • authenticate

        public String authenticate​(Subject subject,
                                   X500Principal principal)
        Parameters:
        subject - The Subject object for the authentication request.
        principal - The Principal object from the user certificate.
        Returns:
        principal's name