Search in sources :

Example 1 with CredentialService

use of org.simbasecurity.core.service.CredentialService 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

FailedLoginException (javax.security.auth.login.FailedLoginException)1 EncryptionOperationNotPossibleException (org.jasypt.exceptions.EncryptionOperationNotPossibleException)1 CredentialService (org.simbasecurity.core.service.CredentialService)1