Package org.platformlayer.auth

Examples of org.platformlayer.auth.UserEntity


  @Override
  public Object runCommand() throws RepositoryException, IOException {
    UserDatabase userRepository = getContext().getUserRepository();

    UserEntity me = getContext().loginDirect();
    ProjectEntity project = userRepository.findProjectByKey(projectKey.getKey());
    if (project == null) {
      throw new CliException("Project not found: " + projectKey.getKey());
    }
View Full Code Here


    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);
    // }
View Full Code Here

  @Override
  public Object runCommand() throws RepositoryException {
    UserDatabase userRepository = getContext().getUserRepository();

    // We need to login to unlock the user key so we can encrypt the project key!
    UserEntity me = getContext().loginDirect();

    if (projectKey.contains("@@")) {
      throw new CliException("Project names with @@ are reserved for system uses");
    }
View Full Code Here

    String password = options.getPassword();
    if (username == null || password == null) {
      throw new IllegalArgumentException("Must specify username & password");
    }

    UserEntity user = (UserEntity) getUserRepository().authenticateWithPassword(username, password);
    if (user == null) {
      throw new SecurityException("Credentials were not valid");
    }
    return user;
  }
View Full Code Here

    } catch (AuthenticatorException e) {
      log.warn("Error while checking system token", e);
      throwInternalError();
    }

    UserEntity userEntity = null;
    try {
      boolean unlock = false;
      userEntity = userAuthenticator.findUserFromKeychain(chain, unlock);
    } catch (AuthenticatorException e) {
      log.warn("Error while fetching user", e);
View Full Code Here

    TokenInfo checkTokenInfo = tokenService.decodeToken(checkToken);
    if (checkTokenInfo == null || checkTokenInfo.hasExpired()) {
      throw404NotFound();
    }

    UserEntity userEntity = null;
    try {
      userEntity = userAuthenticator.getUserFromToken(checkTokenInfo.userId, checkTokenInfo.tokenSecret);
    } catch (AuthenticatorException e) {
      log.warn("Error while fetching user", e);
      throwInternalError();
View Full Code Here

    RegistrationResponse response = new RegistrationResponse();

    String username = request.username;
    String password = request.password;

    UserEntity userEntity;
    try {
      OpsUser user = registrationService.registerUser(username, password);
      userEntity = (UserEntity) user;
    } catch (CustomerFacingException e) {
      response.errorMessage = e.getMessage();
View Full Code Here

  public AuthenticateResponse authenticate(HttpServletRequest httpRequest, AuthenticateRequest request) {
    AuthenticateResponse response = new AuthenticateResponse();

    String username = null;

    UserEntity user = null;

    if (request.auth.passwordCredentials != null) {
      username = request.auth.passwordCredentials.username;
      String password = request.auth.passwordCredentials.password;
View Full Code Here

  public UserEntity authenticate(String username, String password) throws AuthenticatorException {
    if (username == null || password == null) {
      return null;
    }

    UserEntity user;
    try {
      user = (UserEntity) repository.authenticateWithPassword(username, password);
    } catch (RepositoryException e) {
      throw new AuthenticatorException("Error while authenticating user", e);
    }
View Full Code Here

    CryptoKey userSecret = authenticationSecrets.decryptSecretFromToken(tokenSecret);
    if (userSecret == null) {
      throw new AuthenticatorException("Authentication timed out");
    }

    UserEntity user;
    try {
      user = repository.findUserById(userId);
    } catch (RepositoryException e) {
      throw new AuthenticatorException("Error while authenticating user", e);
    }

    user.unlock(userSecret);

    // user.unlockWithToken(UserEntity.TOKEN_ID_DEFAULT, tokenSecret);

    if (user.isLocked()) {
      return null;
    }

    return user;
  }
View Full Code Here

TOP

Related Classes of org.platformlayer.auth.UserEntity

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.