Search in sources :

Example 1 with RegistrationResponse

use of org.platformlayer.auth.model.RegistrationResponse in project platformlayer by platformlayer.

the class RegisterResource method register.

private RegistrationResponse register(RegistrationRequest request) {
    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();
        return response;
    }
    if (userEntity == null) {
        log.warn("Authentication request failed immediately after registration.  Username=" + username);
        throw new IllegalStateException();
    }
    response.access = tokenHelpers.buildAccess(userEntity);
    return response;
}
Also used : CustomerFacingException(org.platformlayer.CustomerFacingException) OpsUser(org.platformlayer.auth.OpsUser) RegistrationResponse(org.platformlayer.auth.model.RegistrationResponse) UserEntity(org.platformlayer.auth.UserEntity)

Aggregations

CustomerFacingException (org.platformlayer.CustomerFacingException)1 OpsUser (org.platformlayer.auth.OpsUser)1 UserEntity (org.platformlayer.auth.UserEntity)1 RegistrationResponse (org.platformlayer.auth.model.RegistrationResponse)1