Search in sources :

Example 1 with CredentialType

use of com.bakdata.conquery.apiv1.auth.CredentialType in project conquery by bakdata.

the class LocalAuthenticationRealm method updateUser.

@Override
public boolean updateUser(User user, List<CredentialType> credentials) {
    Optional<PasswordCredential> optPassword = getTypePassword(credentials);
    if (optPassword.isEmpty()) {
        log.trace("No password credential provided. Not adding {} to {}", user.getName(), getName());
        return false;
    }
    HashedEntry passwordByteIt = optPassword.map(LocalAuthenticationRealm::passwordToHashedEntry).get();
    passwordStore.update(user.getId(), passwordByteIt);
    return true;
}
Also used : PasswordCredential(com.bakdata.conquery.apiv1.auth.PasswordCredential) HashedEntry(com.bakdata.conquery.models.auth.basic.PasswordHasher.HashedEntry)

Example 2 with CredentialType

use of com.bakdata.conquery.apiv1.auth.CredentialType in project conquery by bakdata.

the class LocalAuthenticationRealm method addUser.

// ////////////////// USER MANAGEMENT ////////////////////
@Override
public boolean addUser(User user, List<CredentialType> credentials) {
    Optional<PasswordCredential> optPassword = getTypePassword(credentials);
    if (optPassword.isEmpty()) {
        log.trace("No password credential provided. Not adding {} to {}", user.getName(), getName());
        return false;
    }
    HashedEntry passwordByteIt = optPassword.map(LocalAuthenticationRealm::passwordToHashedEntry).get();
    passwordStore.add(user.getId(), passwordByteIt);
    return true;
}
Also used : PasswordCredential(com.bakdata.conquery.apiv1.auth.PasswordCredential) HashedEntry(com.bakdata.conquery.models.auth.basic.PasswordHasher.HashedEntry)

Aggregations

PasswordCredential (com.bakdata.conquery.apiv1.auth.PasswordCredential)2 HashedEntry (com.bakdata.conquery.models.auth.basic.PasswordHasher.HashedEntry)2