git-svn-id: https://svn.apache.org/repos/asf/archiva/redback/redback-core/trunk@1421215 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Olivier Lamy 2012-12-13 10:45:54 +00:00
parent 9d770f468a
commit 626a747eac
4 changed files with 92 additions and 91 deletions

View File

@ -59,36 +59,36 @@ public interface LoginService
Boolean pingWithAutz() Boolean pingWithAutz()
throws RedbackServiceException; throws RedbackServiceException;
@Path( "logIn" )
@POST
@RedbackAuthorization( noRestriction = true, noPermission = true )
@Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
/** /**
* check username/password and create a http session. * check username/password and create a http session.
* So no more need of reuse username/password for all ajaxRequest * So no more need of reuse username/password for all ajaxRequest
*/ */
@Path( "logIn" )
@POST
@RedbackAuthorization( noRestriction = true, noPermission = true )
@Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
User logIn( LoginRequest loginRequest ) User logIn( LoginRequest loginRequest )
throws RedbackServiceException; throws RedbackServiceException;
@Path( "isLogged" )
@GET
@Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
@RedbackAuthorization( noRestriction = true )
/** /**
* simply check if current user has an http session opened with authz passed * simply check if current user has an http session opened with authz passed
* @since 1.4 * @since 1.4
*/ */
@Path( "isLogged" )
@GET
@Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
@RedbackAuthorization( noRestriction = true )
Boolean isLogged() Boolean isLogged()
throws RedbackServiceException; throws RedbackServiceException;
@Path( "logout" )
@GET
@Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
@RedbackAuthorization( noRestriction = true, noPermission = true )
/** /**
* clear user http session * clear user http session
* @since 1.4 * @since 1.4
*/ */
@Path( "logout" )
@GET
@Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
@RedbackAuthorization( noRestriction = true, noPermission = true )
Boolean logout() Boolean logout()
throws RedbackServiceException; throws RedbackServiceException;
} }

View File

@ -34,28 +34,29 @@ import javax.ws.rs.core.MediaType;
@Path( "/passwordService/" ) @Path( "/passwordService/" )
public interface PasswordService public interface PasswordService
{ {
@GET
@Path( "changePasswordWithKey" )
@Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
@RedbackAuthorization( noRestriction = true, noPermission = true )
/** /**
* used to change the password on first user connection after registration use. * used to change the password on first user connection after registration use.
* the key is mandatory and a control will be done on the username provided. * the key is mandatory and a control will be done on the username provided.
* <b>need to be logged by {@link UserService#validateUserFromKey(String)}</b> * <b>need to be logged by {@link UserService#validateUserFromKey(String)}</b>
* @return username * @return username
*/ */
@GET
@Path( "changePasswordWithKey" )
@Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
@RedbackAuthorization( noRestriction = true, noPermission = true )
User changePasswordWithKey( @QueryParam( "password" ) String password, User changePasswordWithKey( @QueryParam( "password" ) String password,
@QueryParam( "passwordConfirmation" ) String passwordConfirmation, @QueryParam( "passwordConfirmation" ) String passwordConfirmation,
@QueryParam( "key" ) String key ) @QueryParam( "key" ) String key )
throws RedbackServiceException; throws RedbackServiceException;
/**
* used to change the password on passwordChangeRequired state.
*/
@GET @GET
@Path( "changePassword" ) @Path( "changePassword" )
@Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } ) @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
@RedbackAuthorization( noRestriction = true, noPermission = true ) @RedbackAuthorization( noRestriction = true, noPermission = true )
/**
* used to change the password on passwordChangeRequired state.
*/
User changePassword( @QueryParam( "userName" ) String userName, User changePassword( @QueryParam( "userName" ) String userName,
@QueryParam( "previousPassword" ) String previousPassword, @QueryParam( "previousPassword" ) String previousPassword,
@QueryParam( "password" ) String password, @QueryParam( "password" ) String password,

View File

@ -208,101 +208,101 @@ public interface RoleManagementService
@QueryParam( "resource" ) String resource ) @QueryParam( "resource" ) String resource )
throws RedbackServiceException; throws RedbackServiceException;
/**
* @since 1.4
*/
@Path( "getEffectivelyAssignedRoles/{username}" ) @Path( "getEffectivelyAssignedRoles/{username}" )
@GET @GET
@Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } ) @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
@RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_RBAC_ADMIN_OPERATION ) @RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_RBAC_ADMIN_OPERATION )
/**
* @since 1.4
*/
List<Role> getEffectivelyAssignedRoles( @PathParam( "username" ) String username ) List<Role> getEffectivelyAssignedRoles( @PathParam( "username" ) String username )
throws RedbackServiceException; throws RedbackServiceException;
/**
* @since 2.0
*/
@Path( "allRoles" ) @Path( "allRoles" )
@GET @GET
@Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } ) @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
@RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_RBAC_ADMIN_OPERATION ) @RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_RBAC_ADMIN_OPERATION )
/**
* @since 2.0
*/
List<Role> getAllRoles() List<Role> getAllRoles()
throws RedbackServiceException; throws RedbackServiceException;
/**
* @since 2.0
*/
@Path( "detailledAllRoles" ) @Path( "detailledAllRoles" )
@GET @GET
@Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } ) @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
@RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_RBAC_ADMIN_OPERATION ) @RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_RBAC_ADMIN_OPERATION )
/**
* @since 2.0
*/
List<Role> getDetailedAllRoles() List<Role> getDetailedAllRoles()
throws RedbackServiceException; throws RedbackServiceException;
/**
* @since 2.0
*/
@Path( "getApplications/{username}" ) @Path( "getApplications/{username}" )
@GET @GET
@Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } ) @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
@RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_RBAC_ADMIN_OPERATION ) @RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_RBAC_ADMIN_OPERATION )
/**
* @since 2.0
*/
List<Application> getApplications( @PathParam( "username" ) String username ) List<Application> getApplications( @PathParam( "username" ) String username )
throws RedbackServiceException; throws RedbackServiceException;
/**
* @since 2.0
*/
@Path( "getRole/{roleName}" ) @Path( "getRole/{roleName}" )
@GET @GET
@Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } ) @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
@RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_RBAC_ADMIN_OPERATION ) @RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_RBAC_ADMIN_OPERATION )
/**
* @since 2.0
*/
Role getRole( @PathParam( "roleName" ) String roleName ) Role getRole( @PathParam( "roleName" ) String roleName )
throws RedbackServiceException; throws RedbackServiceException;
/**
* @since 2.0
*/
@Path( "updateRoleDescription" ) @Path( "updateRoleDescription" )
@GET @GET
@Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } ) @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
@RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_RBAC_ADMIN_OPERATION ) @RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_RBAC_ADMIN_OPERATION )
/**
* @since 2.0
*/
Boolean updateRoleDescription( @QueryParam( "roleName" ) String roleName, Boolean updateRoleDescription( @QueryParam( "roleName" ) String roleName,
@QueryParam( "roleDescription" ) String description ) @QueryParam( "roleDescription" ) String description )
throws RedbackServiceException; throws RedbackServiceException;
/**
* update users assigned to a role
* @since 2.0
*/
@Path( "updateRoleUsers" ) @Path( "updateRoleUsers" )
@POST @POST
@Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } ) @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
@Consumes( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } ) @Consumes( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
@RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_RBAC_ADMIN_OPERATION ) @RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_RBAC_ADMIN_OPERATION )
/**
* update users assigned to a role
* @since 2.0
*/
Boolean updateRoleUsers( Role role ) Boolean updateRoleUsers( Role role )
throws RedbackServiceException; throws RedbackServiceException;
/**
* @since 2.0
*/
@Path( "getApplicationRoles/{username}" ) @Path( "getApplicationRoles/{username}" )
@GET @GET
@Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } ) @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
@RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_RBAC_ADMIN_OPERATION ) @RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_RBAC_ADMIN_OPERATION )
/**
* @since 2.0
*/
List<ApplicationRoles> getApplicationRoles( @PathParam( "username" ) String username ) List<ApplicationRoles> getApplicationRoles( @PathParam( "username" ) String username )
throws RedbackServiceException; throws RedbackServiceException;
/**
* update roles assigned to a user
* @since 2.0
*/
@Path( "updateUserRoles" ) @Path( "updateUserRoles" )
@POST @POST
@Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } ) @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
@Consumes( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } ) @Consumes( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
@RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_RBAC_ADMIN_OPERATION ) @RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_RBAC_ADMIN_OPERATION )
/**
* update roles assigned to a user
* @since 2.0
*/
Boolean updateUserRoles( User user ) Boolean updateUserRoles( User user )
throws RedbackServiceException; throws RedbackServiceException;

View File

@ -98,57 +98,57 @@ public interface UserService
Boolean updateUser( User user ) Boolean updateUser( User user )
throws RedbackServiceException; throws RedbackServiceException;
/**
* @since 2.0
*/
@Path( "lockUser/{username}" ) @Path( "lockUser/{username}" )
@GET @GET
@Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } ) @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
@RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_USER_EDIT_OPERATION ) @RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_USER_EDIT_OPERATION )
/**
* @since 2.0
*/
Boolean lockUser( @PathParam( "username" ) String username ) Boolean lockUser( @PathParam( "username" ) String username )
throws RedbackServiceException; throws RedbackServiceException;
/**
* @since 2.0
*/
@Path( "unlockUser/{username}" ) @Path( "unlockUser/{username}" )
@GET @GET
@Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } ) @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
@RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_USER_EDIT_OPERATION ) @RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_USER_EDIT_OPERATION )
/**
* @since 2.0
*/
Boolean unlockUser( @PathParam( "username" ) String username ) Boolean unlockUser( @PathParam( "username" ) String username )
throws RedbackServiceException; throws RedbackServiceException;
/**
* @since 2.0
*/
@Path( "passwordChangeRequired/{username}" ) @Path( "passwordChangeRequired/{username}" )
@GET @GET
@Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } ) @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
@RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_USER_EDIT_OPERATION ) @RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_USER_EDIT_OPERATION )
/**
* @since 2.0
*/
Boolean passwordChangeRequired( @PathParam( "username" ) String username ) Boolean passwordChangeRequired( @PathParam( "username" ) String username )
throws RedbackServiceException; throws RedbackServiceException;
/**
* @since 2.0
*/
@Path( "passwordChangeNotRequired/{username}" ) @Path( "passwordChangeNotRequired/{username}" )
@GET @GET
@Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } ) @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
@RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_USER_EDIT_OPERATION ) @RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_USER_EDIT_OPERATION )
/**
* @since 2.0
*/
Boolean passwordChangeNotRequired( @PathParam( "username" ) String username ) Boolean passwordChangeNotRequired( @PathParam( "username" ) String username )
throws RedbackServiceException; throws RedbackServiceException;
@Path( "updateMe" )
@POST
@Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
@RedbackAuthorization( noRestriction = false, noPermission = true )
/** /**
* update only the current user and this fields: fullname, email, password. * update only the current user and this fields: fullname, email, password.
* the service verify the curent logged user with the one passed in the method * the service verify the curent logged user with the one passed in the method
* @since 1.4 * @since 1.4
*/ */
@Path( "updateMe" )
@POST
@Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
@RedbackAuthorization( noRestriction = false, noPermission = true )
Boolean updateMe( User user ) Boolean updateMe( User user )
throws RedbackServiceException; throws RedbackServiceException;
@ -180,83 +180,83 @@ public interface UserService
User createGuestUser() User createGuestUser()
throws RedbackServiceException; throws RedbackServiceException;
@Path( "registerUser" )
@POST
@Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
@RedbackAuthorization( noRestriction = true, noPermission = true )
/** /**
* if redback is not configured for email validation is required, -1 is returned as key * if redback is not configured for email validation is required, -1 is returned as key
* @since 1.4 * @since 1.4
*/ */
@Path( "registerUser" )
@POST
@Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
@RedbackAuthorization( noRestriction = true, noPermission = true )
RegistrationKey registerUser( UserRegistrationRequest userRegistrationRequest ) RegistrationKey registerUser( UserRegistrationRequest userRegistrationRequest )
throws RedbackServiceException; throws RedbackServiceException;
@Path( "validateKey/{key}" )
@GET
@Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
@RedbackAuthorization( noRestriction = true, noPermission = true )
/** /**
* validate the key and the user with forcing a password change for next login. * validate the key and the user with forcing a password change for next login.
* http session is created. * http session is created.
* @param key authentication key * @param key authentication key
* @since 1.4 * @since 1.4
*/ */
@Path( "validateKey/{key}" )
@GET
@Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
@RedbackAuthorization( noRestriction = true, noPermission = true )
Boolean validateUserFromKey( @PathParam( "key" ) String key ) Boolean validateUserFromKey( @PathParam( "key" ) String key )
throws RedbackServiceException; throws RedbackServiceException;
/**
*
* @param resetPasswordRequest contains username for send a password reset email
* @since 1.4
*/
@Path( "resetPassword" ) @Path( "resetPassword" )
@POST @POST
@Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } ) @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
@Consumes( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } ) @Consumes( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
@RedbackAuthorization( noRestriction = true, noPermission = true ) @RedbackAuthorization( noRestriction = true, noPermission = true )
/**
*
* @param user username for send a password reset email
* @since 1.4
*/
Boolean resetPassword( ResetPasswordRequest resetPasswordRequest ) Boolean resetPassword( ResetPasswordRequest resetPasswordRequest )
throws RedbackServiceException; throws RedbackServiceException;
/**
* @since 1.4
*/
@Path( "getUserPermissions/{userName}" ) @Path( "getUserPermissions/{userName}" )
@GET @GET
@Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } ) @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
@RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_USER_LIST_OPERATION ) @RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_USER_LIST_OPERATION )
/**
* @since 1.4
*/
Collection<Permission> getUserPermissions( @PathParam( "userName" ) String userName ) Collection<Permission> getUserPermissions( @PathParam( "userName" ) String userName )
throws RedbackServiceException; throws RedbackServiceException;
/**
* @since 1.4
*/
@Path( "getUserOperations/{userName}" ) @Path( "getUserOperations/{userName}" )
@GET @GET
@Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } ) @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
@RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_USER_LIST_OPERATION ) @RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_USER_LIST_OPERATION )
/**
* @since 1.4
*/
Collection<Operation> getUserOperations( @PathParam( "userName" ) String userName ) Collection<Operation> getUserOperations( @PathParam( "userName" ) String userName )
throws RedbackServiceException; throws RedbackServiceException;
/**
* @return the current logged user permissions, if no logged user guest permissions are returned
* @since 1.4
*/
@Path( "getCurrentUserPermissions" ) @Path( "getCurrentUserPermissions" )
@GET @GET
@Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } ) @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
@RedbackAuthorization( noRestriction = true, noPermission = true ) @RedbackAuthorization( noRestriction = true, noPermission = true )
/**
* return the current logged user permissions, if no logged user guest permissions are returned
* @since 1.4
*/
Collection<Permission> getCurrentUserPermissions() Collection<Permission> getCurrentUserPermissions()
throws RedbackServiceException; throws RedbackServiceException;
/**
* @return the current logged user operations, if no logged user guest operations are returned
* @since 1.4
*/
@Path( "getCurrentUserOperations" ) @Path( "getCurrentUserOperations" )
@GET @GET
@Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } ) @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
@RedbackAuthorization( noRestriction = true, noPermission = true ) @RedbackAuthorization( noRestriction = true, noPermission = true )
/**
* return the current logged user operations, if no logged user guest operations are returned
* @since 1.4
*/
Collection<Operation> getCurrentUserOperations() Collection<Operation> getCurrentUserOperations()
throws RedbackServiceException; throws RedbackServiceException;