Changing class for message keys.
This commit is contained in:
parent
d9eed318a1
commit
ad45e62ef2
|
@ -25,49 +25,5 @@ public interface Constants
|
|||
{
|
||||
String DEFAULT_PAGE_LIMIT = "1000";
|
||||
|
||||
String ERR_UNKNOWN = "redback:unknown_error";
|
||||
String ERR_USERMANAGER_FAIL = "redback:usermanager_error";
|
||||
String ERR_ROLEMANAGER_FAIL = "redback:rolemanager_error";
|
||||
String ERR_RBACMANAGER_FAIL = "redback:rbacmanager_error";
|
||||
String ERR_KEYMANAGER_FAIL = "reback:keymanager_error";
|
||||
String ERR_INVALID_POST_DATA = "redback:invalid_post_data";
|
||||
|
||||
String ERR_USER_EXISTS = "redback:user.exists";
|
||||
String ERR_USER_ID_EMPTY = "redback:user.id.empty";
|
||||
String ERR_USER_ID_INVALID = "redback:user.id.invalid";
|
||||
String ERR_USER_FULL_NAME_EMPTY = "redback:user.fullname.empty";
|
||||
String ERR_USER_EMAIL_EMPTY = "redback:user.email.empty";
|
||||
String ERR_USER_EMAIL_INVALID = "redback:user.email.invalid";
|
||||
String ERR_USER_ASSIGN_ROLE = "redback:user.role.assign.failure";
|
||||
String ERR_USER_NOT_VALIDATED = "redback:user.not_validated";
|
||||
String ERR_USER_ADMIN_EXISTS = "redback:user.admin.exists";
|
||||
String ERR_USER_ADMIN_BAD_NAME = "redback:user.admin.badname";
|
||||
String ERR_USER_NOT_FOUND = "redback:user.not_found";
|
||||
|
||||
String ERR_PASSWORD_VIOLATION = "redback:user.password_violation";
|
||||
|
||||
String ERR_LDAP_GENERIC = "redback:ldap.error";
|
||||
String ERR_ROLE_MAPPING = "redback:role.mapping.error";
|
||||
String ERR_ROLE_MAPPING_NOT_FOUND = "redback:role.mapping.not_found";
|
||||
|
||||
String ERR_AUTH_BAD_CODE = "redback:auth.bad_authorization_code";
|
||||
String ERR_AUTH_INVALID_CREDENTIALS = "redback:auth.invalid_credentials";
|
||||
String ERR_AUTH_FAIL_MSG = "redback:auth.fail";
|
||||
String ERR_AUTH_ACCOUNT_LOCKED = "redback:auth.account_locked";
|
||||
String ERR_AUTH_PASSWORD_CHANGE_REQUIRED = "redback:auth.password_change_required";
|
||||
String ERR_AUTH_UNSUPPORTED_GRANT_TYPE = "redback:auth.unsupported_grant";
|
||||
String ERR_AUTH_INVALID_TOKEN = "redback:auth.invalid_token";
|
||||
String ERR_AUTH_UNAUTHORIZED_REQUEST = "redback:auth.unauthorized_request";
|
||||
|
||||
String ERR_PASSWD_RESET_FAILED = "redback:passwd.reset.fail";
|
||||
|
||||
String ERR_USER_BAD_PASSWORD = "redback:user.bad.password";
|
||||
|
||||
String ERR_REGISTRATION_KEY_INVALID = "redback:registration.key.invalid";
|
||||
String ERR_REGISTRATION_USER_VALIDATED = "redback:registration.user.validated";
|
||||
String ERR_REGISTRATION_ROLE_ASSIGNMENT_FAILED = "redback:registration.role.assignment.failed";
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,60 @@
|
|||
package org.apache.archiva.redback.rest.api;/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Keys for error messages that are returned by REST API
|
||||
*
|
||||
* @author Martin Stockhammer <martin_s@apache.org>
|
||||
*/
|
||||
public interface MessageKeys
|
||||
{
|
||||
String ERR_UNKNOWN = "rb.unknown_error";
|
||||
String ERR_USERMANAGER_FAIL = "rb.usermanager_error";
|
||||
String ERR_ROLEMANAGER_FAIL = "rb.rolemanager_error";
|
||||
String ERR_RBACMANAGER_FAIL = "rb.rbacmanager_error";
|
||||
String ERR_KEYMANAGER_FAIL = "reback:keymanager_error";
|
||||
String ERR_INVALID_POST_DATA = "rb.invalid_post_data";
|
||||
String ERR_USER_EXISTS = "rb.user.exists";
|
||||
String ERR_USER_ID_EMPTY = "rb.user.id.empty";
|
||||
String ERR_USER_ID_INVALID = "rb.user.id.invalid";
|
||||
String ERR_USER_FULL_NAME_EMPTY = "rb.user.fullname.empty";
|
||||
String ERR_USER_EMAIL_EMPTY = "rb.user.email.empty";
|
||||
String ERR_USER_EMAIL_INVALID = "rb.user.email.invalid";
|
||||
String ERR_USER_ASSIGN_ROLE = "rb.user.role.assign.failure";
|
||||
String ERR_USER_NOT_VALIDATED = "rb.user.not_validated";
|
||||
String ERR_USER_ADMIN_EXISTS = "rb.user.admin.exists";
|
||||
String ERR_USER_ADMIN_BAD_NAME = "rb.user.admin.badname";
|
||||
String ERR_USER_NOT_FOUND = "rb.user.not_found";
|
||||
String ERR_PASSWORD_VIOLATION = "rb.user.password_violation";
|
||||
String ERR_LDAP_GENERIC = "rb.ldap.error";
|
||||
String ERR_ROLE_MAPPING = "rb.role.mapping.error";
|
||||
String ERR_ROLE_MAPPING_NOT_FOUND = "rb.role.mapping.not_found";
|
||||
String ERR_AUTH_BAD_CODE = "rb.auth.bad_authorization_code";
|
||||
String ERR_AUTH_INVALID_CREDENTIALS = "rb.auth.invalid_credentials";
|
||||
String ERR_AUTH_FAIL_MSG = "rb.auth.fail";
|
||||
String ERR_AUTH_ACCOUNT_LOCKED = "rb.auth.account_locked";
|
||||
String ERR_AUTH_PASSWORD_CHANGE_REQUIRED = "rb.auth.password_change_required";
|
||||
String ERR_AUTH_UNSUPPORTED_GRANT_TYPE = "rb.auth.unsupported_grant";
|
||||
String ERR_AUTH_INVALID_TOKEN = "rb.auth.invalid_token";
|
||||
String ERR_AUTH_UNAUTHORIZED_REQUEST = "rb.auth.unauthorized_request";
|
||||
String ERR_PASSWD_RESET_FAILED = "rb.passwd.reset.fail";
|
||||
String ERR_USER_BAD_PASSWORD = "rb.user.bad.password";
|
||||
String ERR_REGISTRATION_KEY_INVALID = "rb.registration.key.invalid";
|
||||
String ERR_REGISTRATION_USER_VALIDATED = "rb.registration.user.validated";
|
||||
String ERR_REGISTRATION_ROLE_ASSIGNMENT_FAILED = "rb.registration.role.assignment.failed";
|
||||
}
|
|
@ -29,9 +29,10 @@ import org.apache.archiva.redback.authentication.jwt.JwtAuthenticator;
|
|||
import org.apache.archiva.redback.authentication.jwt.TokenAuthenticationException;
|
||||
import org.apache.archiva.redback.policy.AccountLockedException;
|
||||
import org.apache.archiva.redback.policy.MustChangePasswordException;
|
||||
import org.apache.archiva.redback.rest.api.MessageKeys;
|
||||
import org.apache.archiva.redback.rest.api.model.ErrorMessage;
|
||||
import org.apache.archiva.redback.rest.api.model.GrantType;
|
||||
import org.apache.archiva.redback.rest.api.model.TokenResponse;
|
||||
import org.apache.archiva.redback.rest.api.model.v2.TokenResponse;
|
||||
import org.apache.archiva.redback.rest.api.model.User;
|
||||
import org.apache.archiva.redback.rest.api.model.UserLogin;
|
||||
import org.apache.archiva.redback.rest.api.model.v2.PingResult;
|
||||
|
@ -59,8 +60,6 @@ import java.security.Principal;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static org.apache.archiva.redback.rest.api.Constants.*;
|
||||
|
||||
/**
|
||||
*
|
||||
* Authentication service provides REST methods for authentication and verification.
|
||||
|
@ -128,7 +127,7 @@ public class DefaultAuthenticationService
|
|||
{
|
||||
log.debug( "Login request: grantType={}, code={}", loginRequest.getGrantType( ), loginRequest.getCode( ) );
|
||||
if (!GrantType.AUTHORIZATION_CODE.equals(loginRequest.getGrantType())) {
|
||||
throw new RedbackServiceException( ErrorMessage.of( ERR_AUTH_BAD_CODE ), Response.Status.FORBIDDEN.getStatusCode( ) );
|
||||
throw new RedbackServiceException( ErrorMessage.of( MessageKeys.ERR_AUTH_BAD_CODE ), Response.Status.FORBIDDEN.getStatusCode( ) );
|
||||
}
|
||||
String userName = loginRequest.getUserId(), password = loginRequest.getPassword();
|
||||
PasswordBasedAuthenticationDataSource authDataSource =
|
||||
|
@ -147,7 +146,7 @@ public class DefaultAuthenticationService
|
|||
if ( !user.isValidated() )
|
||||
{
|
||||
log.info( "user {} not validated", user.getUsername() );
|
||||
throw new RedbackServiceException( ErrorMessage.of( ERR_USER_NOT_VALIDATED, user.getUsername() ), Response.Status.FORBIDDEN.getStatusCode() );
|
||||
throw new RedbackServiceException( ErrorMessage.of( MessageKeys.ERR_USER_NOT_VALIDATED, user.getUsername() ), Response.Status.FORBIDDEN.getStatusCode() );
|
||||
}
|
||||
// Stateless services no session
|
||||
// httpAuthenticator.authenticate( authDataSource, httpServletRequest.getSession( true ) );
|
||||
|
@ -163,43 +162,43 @@ public class DefaultAuthenticationService
|
|||
{
|
||||
if ( authenticationFailureCause.getCause() == AuthenticationConstants.AUTHN_NO_SUCH_USER )
|
||||
{
|
||||
errorMessages.add( ErrorMessage.of( ERR_AUTH_INVALID_CREDENTIALS ) );
|
||||
errorMessages.add( ErrorMessage.of( MessageKeys.ERR_AUTH_INVALID_CREDENTIALS ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
errorMessages.add( ErrorMessage.of( ERR_AUTH_FAIL_MSG, authenticationFailureCause.getMessage() ) );
|
||||
errorMessages.add( ErrorMessage.of( MessageKeys.ERR_AUTH_FAIL_MSG, authenticationFailureCause.getMessage() ) );
|
||||
}
|
||||
}
|
||||
response.setHeader( "WWW-Authenticate", "redback-login realm="+httpServletRequest.getRemoteHost() );
|
||||
throw new RedbackServiceException( errorMessages , Response.Status.UNAUTHORIZED.getStatusCode());
|
||||
}
|
||||
response.setHeader( "WWW-Authenticate", "redback-login realm="+httpServletRequest.getRemoteHost() );
|
||||
throw new RedbackServiceException( ErrorMessage.of( ERR_AUTH_FAIL_MSG ), Response.Status.UNAUTHORIZED.getStatusCode() );
|
||||
throw new RedbackServiceException( ErrorMessage.of( MessageKeys.ERR_AUTH_FAIL_MSG ), Response.Status.UNAUTHORIZED.getStatusCode() );
|
||||
}
|
||||
|
||||
catch ( AuthenticationException e )
|
||||
{
|
||||
log.debug( "Authentication error: {}", e.getMessage( ), e );
|
||||
throw new RedbackServiceException(ErrorMessage.of( ERR_AUTH_FAIL_MSG ), Response.Status.UNAUTHORIZED.getStatusCode() );
|
||||
throw new RedbackServiceException(ErrorMessage.of( MessageKeys.ERR_AUTH_FAIL_MSG ), Response.Status.UNAUTHORIZED.getStatusCode() );
|
||||
}
|
||||
catch ( UserNotFoundException e )
|
||||
{
|
||||
log.debug( "User not found: {}", e.getMessage( ), e );
|
||||
throw new RedbackServiceException( ErrorMessage.of( ERR_AUTH_INVALID_CREDENTIALS ), Response.Status.UNAUTHORIZED.getStatusCode() );
|
||||
throw new RedbackServiceException( ErrorMessage.of( MessageKeys.ERR_AUTH_INVALID_CREDENTIALS ), Response.Status.UNAUTHORIZED.getStatusCode() );
|
||||
}
|
||||
catch (AccountLockedException e) {
|
||||
log.info( "Account locked: {}", e.getMessage( ), e );
|
||||
throw new RedbackServiceException( ErrorMessage.of( ERR_AUTH_ACCOUNT_LOCKED ), Response.Status.FORBIDDEN.getStatusCode() );
|
||||
throw new RedbackServiceException( ErrorMessage.of( MessageKeys.ERR_AUTH_ACCOUNT_LOCKED ), Response.Status.FORBIDDEN.getStatusCode() );
|
||||
}
|
||||
catch ( MustChangePasswordException e )
|
||||
{
|
||||
log.debug( "Password change required: {}", e.getMessage( ), e );
|
||||
throw new RedbackServiceException( ErrorMessage.of( ERR_AUTH_PASSWORD_CHANGE_REQUIRED ), Response.Status.FORBIDDEN.getStatusCode( ) );
|
||||
throw new RedbackServiceException( ErrorMessage.of( MessageKeys.ERR_AUTH_PASSWORD_CHANGE_REQUIRED ), Response.Status.FORBIDDEN.getStatusCode( ) );
|
||||
}
|
||||
catch ( UserManagerException e )
|
||||
{
|
||||
log.warn( "UserManagerException: {}", e.getMessage() );
|
||||
throw new RedbackServiceException( ErrorMessage.of( ERR_USERMANAGER_FAIL, e.getMessage( ) ) );
|
||||
throw new RedbackServiceException( ErrorMessage.of( MessageKeys.ERR_USERMANAGER_FAIL, e.getMessage( ) ) );
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -209,7 +208,7 @@ public class DefaultAuthenticationService
|
|||
{
|
||||
if (!GrantType.REFRESH_TOKEN.equals(request.getGrantType())) {
|
||||
log.debug( "Bad grant type {}, expected: refresh_token", request.getGrantType( ).name( ).toLowerCase( ) );
|
||||
throw new RedbackServiceException( ErrorMessage.of( ERR_AUTH_UNSUPPORTED_GRANT_TYPE, request.getGrantType().getLabel() ), Response.Status.FORBIDDEN.getStatusCode( ) );
|
||||
throw new RedbackServiceException( ErrorMessage.of( MessageKeys.ERR_AUTH_UNSUPPORTED_GRANT_TYPE, request.getGrantType().getLabel() ), Response.Status.FORBIDDEN.getStatusCode( ) );
|
||||
}
|
||||
try
|
||||
{
|
||||
|
@ -221,7 +220,7 @@ public class DefaultAuthenticationService
|
|||
}
|
||||
catch ( TokenAuthenticationException e )
|
||||
{
|
||||
throw new RedbackServiceException( ErrorMessage.of(ERR_AUTH_INVALID_TOKEN, e.getError( ).getError( )), Response.Status.UNAUTHORIZED.getStatusCode( ) );
|
||||
throw new RedbackServiceException( ErrorMessage.of( MessageKeys.ERR_AUTH_INVALID_TOKEN, e.getError( ).getError( )), Response.Status.UNAUTHORIZED.getStatusCode( ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -234,7 +233,7 @@ public class DefaultAuthenticationService
|
|||
{
|
||||
return buildRestUser( pri.getUser( ) );
|
||||
} else {
|
||||
throw new RedbackServiceException( ErrorMessage.of( ERR_AUTH_UNAUTHORIZED_REQUEST ), Response.Status.UNAUTHORIZED.getStatusCode( ) );
|
||||
throw new RedbackServiceException( ErrorMessage.of( MessageKeys.ERR_AUTH_UNAUTHORIZED_REQUEST ), Response.Status.UNAUTHORIZED.getStatusCode( ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -26,6 +26,7 @@ import org.apache.archiva.redback.common.ldap.connection.LdapException;
|
|||
import org.apache.archiva.redback.common.ldap.role.LdapGroup;
|
||||
import org.apache.archiva.redback.common.ldap.role.LdapRoleMapper;
|
||||
import org.apache.archiva.redback.common.ldap.role.LdapRoleMapperConfiguration;
|
||||
import org.apache.archiva.redback.rest.api.MessageKeys;
|
||||
import org.apache.archiva.redback.rest.api.model.ActionStatus;
|
||||
import org.apache.archiva.redback.rest.api.model.ErrorMessage;
|
||||
import org.apache.archiva.redback.rest.api.model.Group;
|
||||
|
@ -52,8 +53,6 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static org.apache.archiva.redback.rest.api.Constants.*;
|
||||
|
||||
/**
|
||||
*
|
||||
* LDAP implementation of the group service
|
||||
|
@ -112,10 +111,10 @@ public class DefaultGroupService
|
|||
catch ( LdapException e )
|
||||
{
|
||||
log.error( "LDAP Error {}", e.getMessage(), e );
|
||||
throw new RedbackServiceException( ErrorMessage.of( ERR_LDAP_GENERIC ) );
|
||||
throw new RedbackServiceException( ErrorMessage.of( MessageKeys.ERR_LDAP_GENERIC ) );
|
||||
} catch (MappingException e) {
|
||||
log.error( "Mapping Error {}", e.getMessage(), e );
|
||||
throw new RedbackServiceException( ErrorMessage.of( ERR_ROLE_MAPPING, e.getMessage( ) ) );
|
||||
throw new RedbackServiceException( ErrorMessage.of( MessageKeys.ERR_ROLE_MAPPING, e.getMessage( ) ) );
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
@ -156,7 +155,7 @@ public class DefaultGroupService
|
|||
catch ( LdapException e )
|
||||
{
|
||||
log.error( "Could not create ldap connection {}", e.getMessage( ) );
|
||||
throw new RedbackServiceException( ErrorMessage.of( ERR_LDAP_GENERIC, "Error while talking to group registry"), 500 );
|
||||
throw new RedbackServiceException( ErrorMessage.of( MessageKeys.ERR_LDAP_GENERIC, "Error while talking to group registry"), 500 );
|
||||
}
|
||||
catch ( ObjectNotFoundException e ) {
|
||||
GroupMapping ldapGroupMapping = new GroupMapping( groupName, "", new ArrayList<>( entry.getValue( ) ) );
|
||||
|
@ -174,7 +173,7 @@ public class DefaultGroupService
|
|||
catch ( MappingException e )
|
||||
{
|
||||
log.error( e.getMessage(), e );
|
||||
throw new RedbackServiceException( ErrorMessage.of( ERR_ROLE_MAPPING, e.getMessage( ) ) );
|
||||
throw new RedbackServiceException( ErrorMessage.of( MessageKeys.ERR_ROLE_MAPPING, e.getMessage( ) ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -195,7 +194,7 @@ public class DefaultGroupService
|
|||
catch ( MappingException e )
|
||||
{
|
||||
log.error( e.getMessage(), e );
|
||||
throw new RedbackServiceException( ErrorMessage.of( ERR_ROLE_MAPPING, e.getMessage( ) ) );
|
||||
throw new RedbackServiceException( ErrorMessage.of( MessageKeys.ERR_ROLE_MAPPING, e.getMessage( ) ) );
|
||||
}
|
||||
return ActionStatus.SUCCESS;
|
||||
}
|
||||
|
@ -211,7 +210,7 @@ public class DefaultGroupService
|
|||
catch ( MappingException e )
|
||||
{
|
||||
log.error( e.getMessage(), e );
|
||||
throw new RedbackServiceException( ErrorMessage.of( ERR_ROLE_MAPPING, e.getMessage( ) ) );
|
||||
throw new RedbackServiceException( ErrorMessage.of( MessageKeys.ERR_ROLE_MAPPING, e.getMessage( ) ) );
|
||||
}
|
||||
response.setStatus( 200 );
|
||||
}
|
||||
|
@ -225,7 +224,7 @@ public class DefaultGroupService
|
|||
}
|
||||
catch ( MappingException e )
|
||||
{
|
||||
throw new RedbackServiceException( ErrorMessage.of( ERR_ROLE_MAPPING_NOT_FOUND), 404 );
|
||||
throw new RedbackServiceException( ErrorMessage.of( MessageKeys.ERR_ROLE_MAPPING_NOT_FOUND), 404 );
|
||||
}
|
||||
try
|
||||
{
|
||||
|
@ -236,7 +235,7 @@ public class DefaultGroupService
|
|||
catch ( MappingException e )
|
||||
{
|
||||
log.error( "Could not update mapping {}", e.getMessage( ) );
|
||||
throw new RedbackServiceException( ErrorMessage.of( ERR_ROLE_MAPPING, e.getMessage( ) ) );
|
||||
throw new RedbackServiceException( ErrorMessage.of( MessageKeys.ERR_ROLE_MAPPING, e.getMessage( ) ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ import org.apache.archiva.redback.policy.UserSecurityPolicy;
|
|||
import org.apache.archiva.redback.rbac.RBACManager;
|
||||
import org.apache.archiva.redback.rbac.RbacManagerException;
|
||||
import org.apache.archiva.redback.rbac.UserAssignment;
|
||||
import org.apache.archiva.redback.rest.api.Constants;
|
||||
import org.apache.archiva.redback.rest.api.MessageKeys;
|
||||
import org.apache.archiva.redback.rest.api.model.ActionStatus;
|
||||
import org.apache.archiva.redback.rest.api.model.v2.AvailabilityStatus;
|
||||
import org.apache.archiva.redback.rest.api.model.ErrorMessage;
|
||||
|
@ -50,7 +50,6 @@ import org.apache.archiva.redback.rest.api.model.Operation;
|
|||
import org.apache.archiva.redback.rest.api.model.Permission;
|
||||
import org.apache.archiva.redback.rest.api.model.v2.SelfUserData;
|
||||
import org.apache.archiva.redback.rest.api.model.v2.RegistrationKey;
|
||||
import org.apache.archiva.redback.rest.api.model.ResetPasswordRequest;
|
||||
import org.apache.archiva.redback.rest.api.model.Resource;
|
||||
import org.apache.archiva.redback.rest.api.model.VerificationStatus;
|
||||
import org.apache.archiva.redback.rest.api.model.v2.PagedResult;
|
||||
|
@ -95,8 +94,6 @@ import java.util.Set;
|
|||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static org.apache.archiva.redback.rest.api.Constants.*;
|
||||
|
||||
@Service( "v2.userService#rest" )
|
||||
public class DefaultUserService
|
||||
implements UserService
|
||||
|
@ -191,7 +188,7 @@ public class DefaultUserService
|
|||
User result;
|
||||
if ( Arrays.binarySearch( INVALID_CREATE_USER_NAMES, user.getUserId( ) ) >=0 )
|
||||
{
|
||||
throw new RedbackServiceException( ErrorMessage.of( ERR_USER_ID_INVALID, user.getUserId() ), 422 );
|
||||
throw new RedbackServiceException( ErrorMessage.of( MessageKeys.ERR_USER_ID_INVALID, user.getUserId() ), 422 );
|
||||
}
|
||||
|
||||
try
|
||||
|
@ -201,7 +198,7 @@ public class DefaultUserService
|
|||
{
|
||||
httpServletResponse.setHeader( "Location", uriInfo.getAbsolutePathBuilder( ).path( u.getUsername( ) ).build( ).toString( ) );
|
||||
throw new RedbackServiceException(
|
||||
ErrorMessage.of( ERR_USER_EXISTS, user.getUserId() ), 303 );
|
||||
ErrorMessage.of( MessageKeys.ERR_USER_EXISTS, user.getUserId() ), 303 );
|
||||
}
|
||||
}
|
||||
catch ( UserNotFoundException e )
|
||||
|
@ -211,23 +208,23 @@ public class DefaultUserService
|
|||
}
|
||||
catch ( UserManagerException e )
|
||||
{
|
||||
throw new RedbackServiceException( ErrorMessage.of( ERR_UNKNOWN, e.getMessage() ) );
|
||||
throw new RedbackServiceException( ErrorMessage.of( MessageKeys.ERR_UNKNOWN, e.getMessage() ) );
|
||||
}
|
||||
|
||||
// data validation
|
||||
if ( StringUtils.isEmpty( user.getUserId() ) )
|
||||
{
|
||||
throw new RedbackServiceException( ErrorMessage.of( ERR_USER_ID_EMPTY ), 422 );
|
||||
throw new RedbackServiceException( ErrorMessage.of( MessageKeys.ERR_USER_ID_EMPTY ), 422 );
|
||||
}
|
||||
|
||||
if ( StringUtils.isEmpty( user.getFullName() ) )
|
||||
{
|
||||
throw new RedbackServiceException( ErrorMessage.of( ERR_USER_FULL_NAME_EMPTY ), 422 );
|
||||
throw new RedbackServiceException( ErrorMessage.of( MessageKeys.ERR_USER_FULL_NAME_EMPTY ), 422 );
|
||||
}
|
||||
|
||||
if ( StringUtils.isEmpty( user.getEmail() ) )
|
||||
{
|
||||
throw new RedbackServiceException( ErrorMessage.of( ERR_USER_EMAIL_EMPTY ), 422 );
|
||||
throw new RedbackServiceException( ErrorMessage.of( MessageKeys.ERR_USER_EMAIL_EMPTY ), 422 );
|
||||
}
|
||||
|
||||
try
|
||||
|
@ -263,11 +260,11 @@ public class DefaultUserService
|
|||
catch ( RoleManagerException rpe )
|
||||
{
|
||||
log.error( "RoleProfile Error: {}", rpe.getMessage(), rpe );
|
||||
throw new RedbackServiceException( ErrorMessage.of(ERR_USER_ASSIGN_ROLE ) );
|
||||
throw new RedbackServiceException( ErrorMessage.of( MessageKeys.ERR_USER_ASSIGN_ROLE ) );
|
||||
}
|
||||
catch ( UserManagerException e )
|
||||
{
|
||||
throw new RedbackServiceException( ErrorMessage.of(ERR_UNKNOWN, e.getMessage() ) );
|
||||
throw new RedbackServiceException( ErrorMessage.of( MessageKeys.ERR_UNKNOWN, e.getMessage() ) );
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
@ -290,7 +287,7 @@ public class DefaultUserService
|
|||
catch ( RbacManagerException e )
|
||||
{
|
||||
log.error( e.getMessage(), e );
|
||||
throw new RedbackServiceException( ErrorMessage.of( ERR_RBACMANAGER_FAIL, e.getMessage( ) ) );
|
||||
throw new RedbackServiceException( ErrorMessage.of( MessageKeys.ERR_RBACMANAGER_FAIL, e.getMessage( ) ) );
|
||||
}
|
||||
try
|
||||
{
|
||||
|
@ -299,11 +296,11 @@ public class DefaultUserService
|
|||
catch ( UserNotFoundException e )
|
||||
{
|
||||
log.error( e.getMessage(), e );
|
||||
throw new RedbackServiceException( ErrorMessage.of( ERR_USER_NOT_FOUND ), 404 );
|
||||
throw new RedbackServiceException( ErrorMessage.of( MessageKeys.ERR_USER_NOT_FOUND ), 404 );
|
||||
}
|
||||
catch ( UserManagerException e )
|
||||
{
|
||||
throw new RedbackServiceException( ErrorMessage.of( ERR_USERMANAGER_FAIL, e.getMessage( ) ) );
|
||||
throw new RedbackServiceException( ErrorMessage.of( MessageKeys.ERR_USERMANAGER_FAIL, e.getMessage( ) ) );
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
@ -368,7 +365,7 @@ public class DefaultUserService
|
|||
{
|
||||
RedbackPrincipal principal = getPrincipal( );
|
||||
if (principal==null) {
|
||||
throw new RedbackServiceException( ErrorMessage.of( ERR_AUTH_UNAUTHORIZED_REQUEST ), 401 );
|
||||
throw new RedbackServiceException( ErrorMessage.of( MessageKeys.ERR_AUTH_UNAUTHORIZED_REQUEST ), 401 );
|
||||
}
|
||||
|
||||
// check oldPassword with the current one
|
||||
|
@ -390,19 +387,19 @@ public class DefaultUserService
|
|||
if ( !encoder.isPasswordValid( previousEncodedPassword, user.getCurrentPassword( ) ) )
|
||||
{
|
||||
|
||||
return new RedbackServiceException( ErrorMessage.of( ERR_USER_BAD_PASSWORD ),
|
||||
return new RedbackServiceException( ErrorMessage.of( MessageKeys.ERR_USER_BAD_PASSWORD ),
|
||||
Response.Status.BAD_REQUEST.getStatusCode( ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
catch ( UserNotFoundException e )
|
||||
{
|
||||
return new RedbackServiceException( ErrorMessage.of( ERR_USER_NOT_FOUND ),
|
||||
return new RedbackServiceException( ErrorMessage.of( MessageKeys.ERR_USER_NOT_FOUND ),
|
||||
Response.Status.BAD_REQUEST.getStatusCode( ) );
|
||||
}
|
||||
catch ( UserManagerException e )
|
||||
{
|
||||
return new RedbackServiceException( ErrorMessage.of( ERR_USERMANAGER_FAIL, e.getMessage( ) ) );
|
||||
return new RedbackServiceException( ErrorMessage.of( MessageKeys.ERR_USERMANAGER_FAIL, e.getMessage( ) ) );
|
||||
}
|
||||
// only 3 fields to update
|
||||
if (StringUtils.isNotBlank( user.getFullName() ))
|
||||
|
@ -430,7 +427,7 @@ public class DefaultUserService
|
|||
{
|
||||
RedbackPrincipal principal = getPrincipal( );
|
||||
if (principal==null) {
|
||||
throw new RedbackServiceException( ErrorMessage.of( ERR_AUTH_UNAUTHORIZED_REQUEST ), 401 );
|
||||
throw new RedbackServiceException( ErrorMessage.of( MessageKeys.ERR_AUTH_UNAUTHORIZED_REQUEST ), 401 );
|
||||
}
|
||||
|
||||
try
|
||||
|
@ -440,7 +437,7 @@ public class DefaultUserService
|
|||
}
|
||||
catch ( UserManagerException e )
|
||||
{
|
||||
throw new RedbackServiceException( ErrorMessage.of( ERR_USERMANAGER_FAIL, e.getMessage( ) ), 400 );
|
||||
throw new RedbackServiceException( ErrorMessage.of( MessageKeys.ERR_USERMANAGER_FAIL, e.getMessage( ) ), 400 );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -468,14 +465,14 @@ public class DefaultUserService
|
|||
}
|
||||
catch ( UserNotFoundException e )
|
||||
{
|
||||
throw new RedbackServiceException( ErrorMessage.of( ERR_USER_NOT_FOUND ), 404 );
|
||||
throw new RedbackServiceException( ErrorMessage.of( MessageKeys.ERR_USER_NOT_FOUND ), 404 );
|
||||
} catch ( PasswordRuleViolationException e ) {
|
||||
List<ErrorMessage> messages = e.getViolations( ).getViolations( ).stream( ).map( m -> ErrorMessage.of( m.getKey( ), m.getArgs( ) ) ).collect( Collectors.toList() );
|
||||
throw new RedbackServiceException( messages, 422 );
|
||||
}
|
||||
catch ( UserManagerException e )
|
||||
{
|
||||
throw new RedbackServiceException( ErrorMessage.of( ERR_USERMANAGER_FAIL, e.getMessage() ), 400 );
|
||||
throw new RedbackServiceException( ErrorMessage.of( MessageKeys.ERR_USERMANAGER_FAIL, e.getMessage() ), 400 );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -534,12 +531,12 @@ public class DefaultUserService
|
|||
{
|
||||
log.warn( "Admin user exists already" );
|
||||
httpServletResponse.setHeader( "Location", uriInfo.getAbsolutePath().toString() );
|
||||
throw new RedbackServiceException( ErrorMessage.of( Constants.ERR_USER_ADMIN_EXISTS ), 303 );
|
||||
throw new RedbackServiceException( ErrorMessage.of( MessageKeys.ERR_USER_ADMIN_EXISTS ), 303 );
|
||||
}
|
||||
log.debug("Creating admin admin user '{}'", adminUser.getUserId());
|
||||
if (!RedbackRoleConstants.ADMINISTRATOR_ACCOUNT_NAME.equals(adminUser.getUserId())) {
|
||||
log.error("Wrong admin user name {}", adminUser.getUserId());
|
||||
throw new RedbackServiceException(ErrorMessage.of(Constants.ERR_USER_ADMIN_BAD_NAME ), 422);
|
||||
throw new RedbackServiceException(ErrorMessage.of( MessageKeys.ERR_USER_ADMIN_BAD_NAME ), 422);
|
||||
}
|
||||
|
||||
try
|
||||
|
@ -560,11 +557,11 @@ public class DefaultUserService
|
|||
}
|
||||
catch ( RoleManagerException e )
|
||||
{
|
||||
throw new RedbackServiceException( ErrorMessage.of( ERR_ROLEMANAGER_FAIL, e.getMessage( ) ), 400 );
|
||||
throw new RedbackServiceException( ErrorMessage.of( MessageKeys.ERR_ROLEMANAGER_FAIL, e.getMessage( ) ), 400 );
|
||||
}
|
||||
catch ( UserManagerException e )
|
||||
{
|
||||
throw new RedbackServiceException( ErrorMessage.of( ERR_USERMANAGER_FAIL, e.getMessage() ), 400 );
|
||||
throw new RedbackServiceException( ErrorMessage.of( MessageKeys.ERR_USERMANAGER_FAIL, e.getMessage() ), 400 );
|
||||
}
|
||||
httpServletResponse.setStatus( 201 );
|
||||
httpServletResponse.setHeader( "Location", uriInfo.getAbsolutePath().toString() );
|
||||
|
@ -597,7 +594,7 @@ public class DefaultUserService
|
|||
{
|
||||
return new AvailabilityStatus( false );
|
||||
}
|
||||
throw new RedbackServiceException( ErrorMessage.of( ERR_USERMANAGER_FAIL, e.getMessage() ), 400 );
|
||||
throw new RedbackServiceException( ErrorMessage.of( MessageKeys.ERR_USERMANAGER_FAIL, e.getMessage() ), 400 );
|
||||
}
|
||||
return new AvailabilityStatus( false );
|
||||
}
|
||||
|
@ -631,16 +628,16 @@ public class DefaultUserService
|
|||
catch ( UserNotFoundException e )
|
||||
{
|
||||
log.info( "Password Reset on non-existant user [{}].", username );
|
||||
throw new RedbackServiceException( ErrorMessage.of( ERR_USER_NOT_FOUND, userId ), 404 );
|
||||
throw new RedbackServiceException( ErrorMessage.of( MessageKeys.ERR_USER_NOT_FOUND, userId ), 404 );
|
||||
}
|
||||
catch ( KeyManagerException e )
|
||||
{
|
||||
log.info( "Unable to issue password reset.", e );
|
||||
throw new RedbackServiceException( ErrorMessage.of( ERR_PASSWD_RESET_FAILED, e.getMessage() ), 400 );
|
||||
throw new RedbackServiceException( ErrorMessage.of( MessageKeys.ERR_PASSWD_RESET_FAILED, e.getMessage() ), 400 );
|
||||
}
|
||||
catch ( UserManagerException e )
|
||||
{
|
||||
throw new RedbackServiceException( ErrorMessage.of( ERR_USERMANAGER_FAIL, e.getMessage() ), 400 );
|
||||
throw new RedbackServiceException( ErrorMessage.of( MessageKeys.ERR_USERMANAGER_FAIL, e.getMessage() ), 400 );
|
||||
}
|
||||
|
||||
return ActionStatus.SUCCESS;
|
||||
|
@ -653,7 +650,7 @@ public class DefaultUserService
|
|||
User user = userRegistrationRequest.getUser();
|
||||
if ( user == null )
|
||||
{
|
||||
throw new RedbackServiceException( ErrorMessage.of( ERR_USER_NOT_FOUND, userId ), 404 );
|
||||
throw new RedbackServiceException( ErrorMessage.of( MessageKeys.ERR_USER_NOT_FOUND, userId ), 404 );
|
||||
|
||||
}
|
||||
|
||||
|
@ -693,11 +690,11 @@ public class DefaultUserService
|
|||
catch ( RoleManagerException rpe )
|
||||
{
|
||||
log.error( "RoleProfile Error: {}", rpe.getMessage(), rpe );
|
||||
throw new RedbackServiceException( ErrorMessage.of( ERR_REGISTRATION_ROLE_ASSIGNMENT_FAILED, rpe.getMessage( ) ), 400 );
|
||||
throw new RedbackServiceException( ErrorMessage.of( MessageKeys.ERR_REGISTRATION_ROLE_ASSIGNMENT_FAILED, rpe.getMessage( ) ), 400 );
|
||||
}
|
||||
catch ( UserManagerException e )
|
||||
{
|
||||
throw new RedbackServiceException( ErrorMessage.of( ERR_USERMANAGER_FAIL, e.getMessage() ), 400 );
|
||||
throw new RedbackServiceException( ErrorMessage.of( MessageKeys.ERR_USERMANAGER_FAIL, e.getMessage() ), 400 );
|
||||
}
|
||||
|
||||
if ( emailValidationRequired )
|
||||
|
@ -728,11 +725,11 @@ public class DefaultUserService
|
|||
catch ( KeyManagerException e )
|
||||
{
|
||||
log.error( "Unable to register a new user.", e );
|
||||
throw new RedbackServiceException( ErrorMessage.of( ERR_KEYMANAGER_FAIL, e.getMessage() ), 400 );
|
||||
throw new RedbackServiceException( ErrorMessage.of( MessageKeys.ERR_KEYMANAGER_FAIL, e.getMessage() ), 400 );
|
||||
}
|
||||
catch ( UserManagerException e )
|
||||
{
|
||||
throw new RedbackServiceException( ErrorMessage.of( ERR_USERMANAGER_FAIL, e.getMessage() ), 400 );
|
||||
throw new RedbackServiceException( ErrorMessage.of( MessageKeys.ERR_USERMANAGER_FAIL, e.getMessage() ), 400 );
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
@ -748,7 +745,7 @@ public class DefaultUserService
|
|||
}
|
||||
catch ( UserManagerException e )
|
||||
{
|
||||
throw new RedbackServiceException( ErrorMessage.of( ERR_USERMANAGER_FAIL, e.getMessage() ), 400 );
|
||||
throw new RedbackServiceException( ErrorMessage.of( MessageKeys.ERR_USERMANAGER_FAIL, e.getMessage() ), 400 );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -810,7 +807,7 @@ public class DefaultUserService
|
|||
securitySystem.getUserManager().findUser( authkey.getForPrincipal() );
|
||||
|
||||
if (user.isValidated()) {
|
||||
throw new RedbackServiceException( ErrorMessage.of( ERR_REGISTRATION_USER_VALIDATED ), 404 );
|
||||
throw new RedbackServiceException( ErrorMessage.of( MessageKeys.ERR_REGISTRATION_USER_VALIDATED ), 404 );
|
||||
}
|
||||
user.setValidated( true );
|
||||
user.setLocked( false );
|
||||
|
@ -843,34 +840,34 @@ public class DefaultUserService
|
|||
}
|
||||
catch ( MustChangePasswordException e )
|
||||
{
|
||||
throw new RedbackServiceException( ErrorMessage.of( ERR_AUTH_PASSWORD_CHANGE_REQUIRED ), Response.Status.FORBIDDEN.getStatusCode() );
|
||||
throw new RedbackServiceException( ErrorMessage.of( MessageKeys.ERR_AUTH_PASSWORD_CHANGE_REQUIRED ), Response.Status.FORBIDDEN.getStatusCode() );
|
||||
}
|
||||
catch ( AccountLockedException e )
|
||||
{
|
||||
throw new RedbackServiceException( ErrorMessage.of( ERR_AUTH_ACCOUNT_LOCKED ), Response.Status.FORBIDDEN.getStatusCode() );
|
||||
throw new RedbackServiceException( ErrorMessage.of( MessageKeys.ERR_AUTH_ACCOUNT_LOCKED ), Response.Status.FORBIDDEN.getStatusCode() );
|
||||
}
|
||||
catch ( AuthenticationException e )
|
||||
{
|
||||
throw new RedbackServiceException( ErrorMessage.of( ERR_AUTH_INVALID_CREDENTIALS ), Response.Status.FORBIDDEN.getStatusCode() );
|
||||
throw new RedbackServiceException( ErrorMessage.of( MessageKeys.ERR_AUTH_INVALID_CREDENTIALS ), Response.Status.FORBIDDEN.getStatusCode() );
|
||||
}
|
||||
catch ( KeyNotFoundException e )
|
||||
{
|
||||
log.info( "Invalid key requested: {}", key );
|
||||
throw new RedbackServiceException( ErrorMessage.of( ERR_REGISTRATION_KEY_INVALID ), 404 );
|
||||
throw new RedbackServiceException( ErrorMessage.of( MessageKeys.ERR_REGISTRATION_KEY_INVALID ), 404 );
|
||||
}
|
||||
catch ( KeyManagerException e )
|
||||
{
|
||||
throw new RedbackServiceException( ErrorMessage.of( ERR_KEYMANAGER_FAIL, e.getMessage( ) ), 400 );
|
||||
throw new RedbackServiceException( ErrorMessage.of( MessageKeys.ERR_KEYMANAGER_FAIL, e.getMessage( ) ), 400 );
|
||||
|
||||
}
|
||||
catch ( UserNotFoundException e )
|
||||
{
|
||||
throw new RedbackServiceException( ErrorMessage.of( ERR_USER_NOT_FOUND, principal ), 404 );
|
||||
throw new RedbackServiceException( ErrorMessage.of( MessageKeys.ERR_USER_NOT_FOUND, principal ), 404 );
|
||||
|
||||
}
|
||||
catch ( UserManagerException e )
|
||||
{
|
||||
throw new RedbackServiceException( ErrorMessage.of( ERR_USERMANAGER_FAIL, e.getMessage() ), 400 );
|
||||
throw new RedbackServiceException( ErrorMessage.of( MessageKeys.ERR_USERMANAGER_FAIL, e.getMessage() ), 400 );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -929,7 +926,7 @@ public class DefaultUserService
|
|||
catch ( RbacManagerException e )
|
||||
{
|
||||
log.error( e.getMessage(), e );
|
||||
throw new RedbackServiceException( ErrorMessage.of( ERR_RBACMANAGER_FAIL, e.getMessage() ), 400 );
|
||||
throw new RedbackServiceException( ErrorMessage.of( MessageKeys.ERR_RBACMANAGER_FAIL, e.getMessage() ), 400 );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -940,29 +937,29 @@ public class DefaultUserService
|
|||
new RedbackServiceException( "issues during validating user", 422 );
|
||||
if ( StringUtils.isEmpty( user.getUserId() ) )
|
||||
{
|
||||
redbackServiceException.addErrorMessage( ErrorMessage.of( ERR_USER_ID_EMPTY ) );
|
||||
redbackServiceException.addErrorMessage( ErrorMessage.of( MessageKeys.ERR_USER_ID_EMPTY ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( !user.getUserId().matches( VALID_USERNAME_CHARS ) )
|
||||
{
|
||||
redbackServiceException.addErrorMessage( ErrorMessage.of( ERR_USER_ID_INVALID ) );
|
||||
redbackServiceException.addErrorMessage( ErrorMessage.of( MessageKeys.ERR_USER_ID_INVALID ) );
|
||||
}
|
||||
}
|
||||
|
||||
if ( StringUtils.isEmpty( user.getFullName() ) )
|
||||
{
|
||||
redbackServiceException.addErrorMessage( ErrorMessage.of( ERR_USER_FULL_NAME_EMPTY ) );
|
||||
redbackServiceException.addErrorMessage( ErrorMessage.of( MessageKeys.ERR_USER_FULL_NAME_EMPTY ) );
|
||||
}
|
||||
|
||||
if ( StringUtils.isEmpty( user.getEmail() ) )
|
||||
{
|
||||
redbackServiceException.addErrorMessage( ErrorMessage.of( ERR_USER_EMAIL_EMPTY ) );
|
||||
redbackServiceException.addErrorMessage( ErrorMessage.of( MessageKeys.ERR_USER_EMAIL_EMPTY ) );
|
||||
}
|
||||
|
||||
if ( !StringUtils.equals( user.getPassword(), user.getConfirmPassword() ) )
|
||||
{
|
||||
redbackServiceException.addErrorMessage( ErrorMessage.of( ERR_AUTH_INVALID_CREDENTIALS, "nomatch" ) );
|
||||
redbackServiceException.addErrorMessage( ErrorMessage.of( MessageKeys.ERR_AUTH_INVALID_CREDENTIALS, "nomatch" ) );
|
||||
}
|
||||
|
||||
try
|
||||
|
@ -974,7 +971,7 @@ public class DefaultUserService
|
|||
}
|
||||
catch ( AddressException e )
|
||||
{
|
||||
redbackServiceException.addErrorMessage( ErrorMessage.of( ERR_USER_EMAIL_INVALID ) );
|
||||
redbackServiceException.addErrorMessage( ErrorMessage.of( MessageKeys.ERR_USER_EMAIL_INVALID ) );
|
||||
}
|
||||
if ( !redbackServiceException.getErrorMessages().isEmpty() )
|
||||
{
|
||||
|
@ -997,12 +994,12 @@ public class DefaultUserService
|
|||
|
||||
if ( ( StringUtils.isEmpty( user.getPassword() ) ) )
|
||||
{
|
||||
throw new RedbackServiceException( ErrorMessage.of( ERR_AUTH_INVALID_CREDENTIALS, "empty" ) );
|
||||
throw new RedbackServiceException( ErrorMessage.of( MessageKeys.ERR_AUTH_INVALID_CREDENTIALS, "empty" ) );
|
||||
}
|
||||
}
|
||||
catch ( UserManagerException e )
|
||||
{
|
||||
throw new RedbackServiceException( ErrorMessage.of( ERR_AUTH_INVALID_CREDENTIALS, e.getMessage() ) );
|
||||
throw new RedbackServiceException( ErrorMessage.of( MessageKeys.ERR_AUTH_INVALID_CREDENTIALS, e.getMessage() ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1036,17 +1033,17 @@ public class DefaultUserService
|
|||
}
|
||||
userManager.updateUser( rawUser, false );
|
||||
} else {
|
||||
throw new RedbackServiceException( ErrorMessage.of( ERR_USER_NOT_FOUND, userId ), 404 );
|
||||
throw new RedbackServiceException( ErrorMessage.of( MessageKeys.ERR_USER_NOT_FOUND, userId ), 404 );
|
||||
}
|
||||
return rawUser;
|
||||
}
|
||||
catch ( UserNotFoundException e )
|
||||
{
|
||||
throw new RedbackServiceException( ErrorMessage.of( ERR_USER_NOT_FOUND ), 404 );
|
||||
throw new RedbackServiceException( ErrorMessage.of( MessageKeys.ERR_USER_NOT_FOUND ), 404 );
|
||||
}
|
||||
catch ( UserManagerException e )
|
||||
{
|
||||
throw new RedbackServiceException( ErrorMessage.of( ERR_USERMANAGER_FAIL, e.getMessage() ) );
|
||||
throw new RedbackServiceException( ErrorMessage.of( MessageKeys.ERR_USERMANAGER_FAIL, e.getMessage() ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ package org.apache.archiva.redback.rest.services.v2;
|
|||
import org.apache.archiva.redback.integration.security.role.RedbackRoleConstants;
|
||||
import org.apache.archiva.redback.rest.api.model.GrantType;
|
||||
import org.apache.archiva.redback.rest.api.model.v2.TokenRequest;
|
||||
import org.apache.archiva.redback.rest.api.model.TokenResponse;
|
||||
import org.apache.archiva.redback.rest.api.model.v2.TokenResponse;
|
||||
import org.apache.archiva.redback.rest.api.services.RedbackServiceException;
|
||||
import org.apache.archiva.redback.rest.services.BaseSetup;
|
||||
import org.apache.archiva.redback.users.User;
|
||||
|
|
|
@ -26,8 +26,7 @@ import org.apache.archiva.redback.rest.api.model.v2.PagedResult;
|
|||
import org.apache.archiva.redback.rest.api.model.Permission;
|
||||
import org.apache.archiva.redback.rest.api.model.v2.PingResult;
|
||||
import org.apache.archiva.redback.rest.api.model.v2.TokenRequest;
|
||||
import org.apache.archiva.redback.rest.api.model.ResetPasswordRequest;
|
||||
import org.apache.archiva.redback.rest.api.model.TokenResponse;
|
||||
import org.apache.archiva.redback.rest.api.model.v2.TokenResponse;
|
||||
import org.apache.archiva.redback.rest.api.model.v2.User;
|
||||
import org.apache.archiva.redback.rest.api.model.v2.UserRegistrationRequest;
|
||||
import org.apache.archiva.redback.rest.api.services.v2.UserService;
|
||||
|
|
Loading…
Reference in New Issue