Class SCRAMPropertiesLoginModule

  • All Implemented Interfaces:
    javax.security.auth.spi.LoginModule, AuditLoginModule

    public class SCRAMPropertiesLoginModule
    extends PropertiesLoader
    implements AuditLoginModule
    Login modules that uses properties files similar to the PropertiesLoginModule. It can either store the username-password in plain text or in an encrypted/hashed form. the main(String[]) method provides a way to prepare unencrypted data to be encrypted/hashed.
    • Constructor Detail

      • SCRAMPropertiesLoginModule

        public SCRAMPropertiesLoginModule()
    • Method Detail

      • initialize

        public void initialize​(javax.security.auth.Subject subject,
                               javax.security.auth.callback.CallbackHandler callbackHandler,
                               java.util.Map<java.lang.String,​?> sharedState,
                               java.util.Map<java.lang.String,​?> options)
        Specified by:
        initialize in interface javax.security.auth.spi.LoginModule
      • login

        public boolean login()
                      throws javax.security.auth.login.LoginException
        Specified by:
        login in interface javax.security.auth.spi.LoginModule
        Throws:
        javax.security.auth.login.LoginException
      • commit

        public boolean commit()
                       throws javax.security.auth.login.LoginException
        Specified by:
        commit in interface javax.security.auth.spi.LoginModule
        Throws:
        javax.security.auth.login.LoginException
      • abort

        public boolean abort()
                      throws javax.security.auth.login.LoginException
        Specified by:
        abort in interface javax.security.auth.spi.LoginModule
        Throws:
        javax.security.auth.login.LoginException
      • logout

        public boolean logout()
                       throws javax.security.auth.login.LoginException
        Specified by:
        logout in interface javax.security.auth.spi.LoginModule
        Throws:
        javax.security.auth.login.LoginException
      • main

        public static void main​(java.lang.String[] args)
                         throws java.security.GeneralSecurityException,
                                ScramException,
                                StringPrep.StringPrepError,
                                java.io.IOException
        Main method that could be used to encrypt given credentials for use in properties files
        Parameters:
        args - username password type [iterations]
        Throws:
        java.security.GeneralSecurityException - if any security mechanism is not available on this JVM
        ScramException - if invalid data is supplied
        StringPrep.StringPrepError - if username can't be encoded according to SASL StringPrep
        java.io.IOException - if writing as properties failed