Class CertificateLoginModule

  • All Implemented Interfaces:
    LoginModule
    Direct Known Subclasses:
    TextFileCertificateLoginModule

    public abstract class CertificateLoginModule
    extends PropertiesLoader
    implements LoginModule
    A LoginModule that allows for authentication based on SSL certificates. Allows for subclasses to define methods used to verify user certificates and find user groups. Uses CertificateCallbacks to retrieve certificates.
    Author:
    sepandm@gmail.com (Sepand)
    • Constructor Detail

      • CertificateLoginModule

        public CertificateLoginModule()
    • Method Detail

      • logout

        public boolean logout()
        Standard JAAS override.
        Specified by:
        logout in interface LoginModule
      • getUserNameForCertificates

        protected abstract String getUserNameForCertificates​(X509Certificate[] certs)
                                                      throws LoginException
        Should return a unique name corresponding to the certificates given. The name returned will be used to look up access levels as well as group associations.
        Parameters:
        certs - The distinguished name.
        Returns:
        The unique name if the certificate is recognized, null otherwise.
        Throws:
        LoginException
      • getUserGroups

        protected abstract Set<String> getUserGroups​(String username)
                                              throws LoginException
        Should return a set of the groups this user belongs to. The groups returned will be added to the user's credentials.
        Parameters:
        username - The username of the client. This is the same name that getUserNameForDn returned for the user's DN.
        Returns:
        A Set of the names of the groups this user belongs to.
        Throws:
        LoginException