use of com.bakdata.conquery.apiv1.auth.PasswordCredential 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;
}
use of com.bakdata.conquery.apiv1.auth.PasswordCredential in project conquery by bakdata.
the class LocalAuthRealmTest method setupEach.
@BeforeEach
public void setupEach() {
// Create User in Realm
user1 = new User("TestUser", "Test User", storage);
PasswordCredential user1Password = new PasswordCredential("testPassword".toCharArray());
storage.addUser(user1);
realm.addUser(user1, List.of(user1Password));
}
use of com.bakdata.conquery.apiv1.auth.PasswordCredential 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;
}
use of com.bakdata.conquery.apiv1.auth.PasswordCredential in project conquery by bakdata.
the class SerializationTests method passwordCredential.
@Test
public void passwordCredential() throws IOException, JSONException {
PasswordCredential credential = new PasswordCredential(new String("testPassword").toCharArray());
SerializationTestUtil.forType(PasswordCredential.class).test(credential);
}
Aggregations