use of org.platformlayer.auth.UserDatabase in project platformlayer by platformlayer.
the class ListServiceAccounts method runCommand.
@Override
public Object runCommand() throws RepositoryException {
UserDatabase userRepository = getContext().getUserRepository();
byte[] publicKeyBytes = null;
if (publicKey != null) {
publicKeyBytes = Hex.fromHex(publicKey);
}
List<ServiceAccountEntity> serviceAcccounts = userRepository.listAllServiceAccounts(publicKeyBytes);
return serviceAcccounts;
}
use of org.platformlayer.auth.UserDatabase in project platformlayer by platformlayer.
the class CreateUser method runCommand.
@Override
public Object runCommand() throws RepositoryException, GeneralSecurityException, IOException, OpsException {
if (password == null && keystore == null && certPath == null) {
throw new CliException("Either key or password or cert is required");
}
UserDatabase userRepository = getContext().getUserRepository();
Certificate[] certificateChain = null;
if (keystore != null) {
certificateChain = getContext().getCertificateChain(keystore, keystoreSecret, keyAlias);
} else if (certPath != null) {
certificateChain = getContext().loadCertificateChain(certPath);
}
OpsUser user = userRepository.createUser(username, password, certificateChain);
return user;
}
use of org.platformlayer.auth.UserDatabase in project platformlayer by platformlayer.
the class ListProjects method runCommand.
@Override
public Object runCommand() throws RepositoryException {
UserDatabase userRepository = getContext().getUserRepository();
// if (username == null) {
// return userRepository.listAllProjectNames(null);
// } else {
UserEntity user = (UserEntity) userRepository.findUser(username.getKey());
if (user == null) {
throw new IllegalArgumentException("User not found");
}
return userRepository.listProjectsByUserId(user.id);
// }
}
use of org.platformlayer.auth.UserDatabase in project platformlayer by platformlayer.
the class ListUsers method runCommand.
@Override
public Object runCommand() throws RepositoryException {
UserDatabase userRepository = getContext().getUserRepository();
List<String> users = userRepository.listAllUserNames(prefix);
return users;
}
Aggregations