Search in sources :

Example 6 with EncryptionOperationNotPossibleException

use of org.jasypt.exceptions.EncryptionOperationNotPossibleException in project simba-os by cegeka.

the class DatabaseLoginModule method verifyLoginData.

@Override
protected boolean verifyLoginData() throws FailedLoginException {
    CredentialService credentialService = GlobalContext.locate(CredentialService.class);
    debug("Verifying credentials for user: " + getUsername());
    boolean validCredentials = false;
    try {
        validCredentials = credentialService.checkCredentials(getUsername(), getPassword());
    } catch (EncryptionOperationNotPossibleException legacyPasswordException) {
        debug("Authentication failed");
        throw new FailedLoginException(getUsername());
    }
    if (validCredentials) {
        debug("Authentication succeeded");
        return true;
    }
    debug("Authentication failed");
    throw new FailedLoginException(getUsername());
}
Also used : CredentialService(org.simbasecurity.core.service.CredentialService) FailedLoginException(javax.security.auth.login.FailedLoginException) EncryptionOperationNotPossibleException(org.jasypt.exceptions.EncryptionOperationNotPossibleException)

Example 7 with EncryptionOperationNotPossibleException

use of org.jasypt.exceptions.EncryptionOperationNotPossibleException in project simba-os by cegeka.

the class FallbackDatabaseLoginModule method verifyLoginData.

@Override
protected boolean verifyLoginData() throws FailedLoginException {
    CredentialService credentialService = GlobalContext.locate(CredentialService.class);
    debug("Verifying credentials for user: " + getUsername());
    boolean validCredentials = false;
    try {
        validCredentials = credentialService.checkCredentials(getUsername(), getPassword());
    } catch (EncryptionOperationNotPossibleException legacyPasswordException) {
        validCredentials = verifyWithSHA1Encryptor(credentialService);
    }
    if (validCredentials) {
        debug("Authentication succeeded");
        return true;
    }
    debug("Authentication failed");
    throw new FailedLoginException(getUsername());
}
Also used : CredentialService(org.simbasecurity.core.service.CredentialService) FailedLoginException(javax.security.auth.login.FailedLoginException) EncryptionOperationNotPossibleException(org.jasypt.exceptions.EncryptionOperationNotPossibleException)

Aggregations

EncryptionOperationNotPossibleException (org.jasypt.exceptions.EncryptionOperationNotPossibleException)7 CloudRuntimeException (com.cloud.utils.exception.CloudRuntimeException)3 SQLException (java.sql.SQLException)3 BufferedWriter (java.io.BufferedWriter)2 File (java.io.File)2 FileInputStream (java.io.FileInputStream)2 FileNotFoundException (java.io.FileNotFoundException)2 FileWriter (java.io.FileWriter)2 IOException (java.io.IOException)2 UnsupportedEncodingException (java.io.UnsupportedEncodingException)2 Properties (java.util.Properties)2 FailedLoginException (javax.security.auth.login.FailedLoginException)2 ConfigurationException (org.apache.commons.configuration.ConfigurationException)2 PropertiesConfiguration (org.apache.commons.configuration.PropertiesConfiguration)2 StandardPBEStringEncryptor (org.jasypt.encryption.pbe.StandardPBEStringEncryptor)2 EncryptableProperties (org.jasypt.properties.EncryptableProperties)2 CredentialService (org.simbasecurity.core.service.CredentialService)2 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)2 ModelAndView (org.springframework.web.servlet.ModelAndView)2 PreparedStatement (java.sql.PreparedStatement)1