org.sonatype.nexus.validation.Validate Java Examples
The following examples show how to use
org.sonatype.nexus.validation.Validate.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CleanupPolicyComponent.java From nexus-public with Eclipse Public License 1.0 | 6 votes |
/** * Load configuration to check whether a field should be enabled for a given format */ @DirectMethod @Timed @ExceptionMetered @RequiresAuthentication @RequiresPermissions("nexus:*") @Validate public Map<String, Map<String, Boolean>> getApplicableFields(final List<String> fields) { Map<String, Map<String, Boolean>> applicability = new HashMap<>(); for (Entry<String, CleanupPolicyConfiguration> config : cleanupPolicyConfiguration.entrySet()) { String format = config.getKey(); Map<String, Boolean> fieldApplicability = fields.stream() .collect(toMap(identity(), f -> isFieldApplicable(format, f))); applicability.put(format, fieldApplicability); } return applicability; }
Example #2
Source File: HelmHostedRepositoriesApiResource.java From nexus-repository-helm with Eclipse Public License 1.0 | 6 votes |
@ApiOperation("Update Helm hosted repository") @ApiResponses(value = { @ApiResponse(code = 204, message = REPOSITORY_UPDATED), @ApiResponse(code = 401, message = AUTHENTICATION_REQUIRED), @ApiResponse(code = 403, message = INSUFFICIENT_PERMISSIONS) }) @PUT @Path("/{repositoryName}") @RequiresAuthentication @Validate @Override public Response updateRepository( final HelmHostedRepositoryApiRequest request, @ApiParam(value = "Name of the repository to update") @PathParam("repositoryName") final String repositoryName) { return super.updateRepository(request, repositoryName); }
Example #3
Source File: UserResource.java From nexus-public with Eclipse Public License 1.0 | 6 votes |
@PUT @Path("/{userId}/password") @RequiresUser @RequiresAuthentication @RequiresPermissions("nexus:userschangepw:create") @Validate public void changePassword(@PathParam("userId") @NotNull final String userId, @NotNull @Valid final UserAccountPasswordXO xo) throws Exception { if (authTickets.redeemTicket(xo.getAuthToken())) { if (isAnonymousUser(userId)) { throw new Exception("Password cannot be changed for user ${userId}, since is marked as the Anonymous user"); } securitySystem.changePassword(userId, xo.getPassword()); } else { throw new IllegalAccessException("Invalid authentication ticket"); } }
Example #4
Source File: OnboardingResource.java From nexus-public with Eclipse Public License 1.0 | 6 votes |
/** * Change password of the default admin user, for administrative use only. * * @param password new password */ @PUT @RequiresAuthentication @RequiresPermissions("nexus:*") @Path("/change-admin-password") @Validate public void changeAdminPassword(@NotEmpty(message = PASSWORD_REQUIRED) final String password) { try { securitySystem.changePassword("admin", password, false); adminPasswordFileManager.removeFile(); } catch (UserNotFoundException e) { log.error("Unable to locate 'admin' user to change password", e); throw new WebApplicationException(Response.Status.NOT_FOUND); } }
Example #5
Source File: FileBlobStoreResource.java From nexus-public with Eclipse Public License 1.0 | 6 votes |
@Override @RequiresAuthentication @RequiresPermissions("nexus:blobstores:update") @PUT @Path("/{name}") @Validate public void updateFileBlobStore(@PathParam("name") final String name, @Valid final FileBlobStoreApiUpdateRequest request) throws Exception { // Confirm that the blobstore name and type are the expected name and type getBlobStoreConfiguration(name); BlobStoreConfiguration configuration = request.toBlobStoreConfiguration(blobStoreManager.newConfiguration()); configuration.setName(name); blobStoreManager.update(configuration); }
Example #6
Source File: ConanProxyRepositoriesApiResource.java From nexus-repository-conan with Eclipse Public License 1.0 | 6 votes |
@ApiOperation("Update Conan proxy repository") @ApiResponses(value = { @ApiResponse(code = 204, message = REPOSITORY_UPDATED), @ApiResponse(code = 401, message = AUTHENTICATION_REQUIRED), @ApiResponse(code = 403, message = INSUFFICIENT_PERMISSIONS), @ApiResponse(code = 404, message = REPOSITORY_NOT_FOUND) }) @PUT @Path("/{repositoryName}") @RequiresAuthentication @Validate @Override public Response updateRepository( final ConanProxyRepositoryApiRequest request, @ApiParam(value = "Name of the repository to update") @PathParam("repositoryName") final String repositoryName) { return super.updateRepository(request, repositoryName); }
Example #7
Source File: HelmProxyRepositoriesApiResource.java From nexus-repository-helm with Eclipse Public License 1.0 | 6 votes |
@ApiOperation("Update Helm proxy repository") @ApiResponses(value = { @ApiResponse(code = 204, message = REPOSITORY_UPDATED), @ApiResponse(code = 401, message = AUTHENTICATION_REQUIRED), @ApiResponse(code = 403, message = INSUFFICIENT_PERMISSIONS) }) @PUT @Path("/{repositoryName}") @RequiresAuthentication @Validate @Override public Response updateRepository( final HelmProxyRepositoryApiRequest request, @ApiParam(value = "Name of the repository to update") @PathParam("repositoryName") final String repositoryName) { return super.updateRepository(request, repositoryName); }
Example #8
Source File: RProxyRepositoriesApiResource.java From nexus-repository-r with Eclipse Public License 1.0 | 6 votes |
@ApiOperation("Update R proxy repository") @ApiResponses(value = { @ApiResponse(code = 204, message = REPOSITORY_UPDATED), @ApiResponse(code = 401, message = AUTHENTICATION_REQUIRED), @ApiResponse(code = 403, message = INSUFFICIENT_PERMISSIONS), @ApiResponse(code = 404, message = REPOSITORY_NOT_FOUND) }) @PUT @Path("/{repositoryName}") @RequiresAuthentication @Validate @Override public Response updateRepository( final RProxyRepositoryApiRequest request, @ApiParam(value = "Name of the repository to update") @PathParam("repositoryName") final String repositoryName) { return super.updateRepository(request, repositoryName); }
Example #9
Source File: NpmHostedRepositoriesApiResource.java From nexus-public with Eclipse Public License 1.0 | 6 votes |
@ApiOperation("Update npm hosted repository") @ApiResponses(value = { @ApiResponse(code = 204, message = REPOSITORY_UPDATED), @ApiResponse(code = 401, message = AUTHENTICATION_REQUIRED), @ApiResponse(code = 403, message = INSUFFICIENT_PERMISSIONS) }) @PUT @Path("/{repositoryName}") @RequiresAuthentication @Validate @Override public Response updateRepository( final NpmHostedRepositoryApiRequest request, @ApiParam(value = "Name of the repository to update") @PathParam("repositoryName") final String repositoryName) { return super.updateRepository(request, repositoryName); }
Example #10
Source File: ValidationInterceptor.java From nexus-public with Eclipse Public License 1.0 | 6 votes |
public Object invoke(final MethodInvocation mi) throws Throwable { checkNotNull(methodValidator); final ClassLoader tccl = Thread.currentThread().getContextClassLoader(); try { Thread.currentThread().setContextClassLoader(HibernateValidator.class.getClassLoader()); final Validate validate = mi.getMethod().getAnnotation(Validate.class); validateParameters(mi.getThis(), mi.getMethod(), mi.getArguments(), validate.groups()); final Object result = mi.proceed(); validateReturnValue(mi.getThis(), mi.getMethod(), result, validate.groups()); return result; } finally { Thread.currentThread().setContextClassLoader(tccl); } }
Example #11
Source File: RHostedRepositoriesApiResource.java From nexus-repository-r with Eclipse Public License 1.0 | 6 votes |
@ApiOperation("Update R hosted repository") @ApiResponses(value = { @ApiResponse(code = 204, message = REPOSITORY_UPDATED), @ApiResponse(code = 401, message = AUTHENTICATION_REQUIRED), @ApiResponse(code = 403, message = INSUFFICIENT_PERMISSIONS) }) @PUT @Path("/{repositoryName}") @RequiresAuthentication @Validate @Override public Response updateRepository( final RHostedRepositoryApiRequest request, @ApiParam(value = "Name of the repository to update") @PathParam("repositoryName") final String repositoryName) { return super.updateRepository(request, repositoryName); }
Example #12
Source File: ContentSelectorsApiResource.java From nexus-public with Eclipse Public License 1.0 | 6 votes |
@PUT @Path("{name}") @Validate @RequiresAuthentication @RequiresPermissions("nexus:selectors:update") public void updateContentSelector(@PathParam("name") final String name, @Valid final ContentSelectorApiUpdateRequest request) { selectorFactory.validateSelector(CselSelector.TYPE, request.getExpression()); SelectorConfiguration configuration = findConfigurationByNameOrThrowNotFound(name); configuration.setType(CselSelector.TYPE); configuration.setDescription(request.getDescription()); configuration.setAttributes(singletonMap(EXPRESSION, request.getExpression())); selectorManager.update(configuration); }
Example #13
Source File: SecurityComponent.java From nexus-public with Eclipse Public License 1.0 | 6 votes |
@DirectMethod @Timed @ExceptionMetered @Validate public UserXO authenticate(@NotEmpty final String base64Username, @NotEmpty final String base64Password) throws Exception { Subject subject = securitySystem.getSubject(); // FIXME: Subject is not nullable, but we have code that checks for nulls, likely from testing setups, verify and simplify checkState(subject != null); try { subject.login(new UsernamePasswordToken( Strings2.decodeBase64(base64Username), Strings2.decodeBase64(base64Password), false )); } catch (Exception e) { throw new Exception("Authentication failed", e); } return getUser(); }
Example #14
Source File: NpmProxyRepositoriesApiResource.java From nexus-public with Eclipse Public License 1.0 | 6 votes |
@ApiOperation("Update npm proxy repository") @ApiResponses(value = { @ApiResponse(code = 204, message = REPOSITORY_UPDATED), @ApiResponse(code = 401, message = AUTHENTICATION_REQUIRED), @ApiResponse(code = 403, message = INSUFFICIENT_PERMISSIONS) }) @PUT @Path("/{repositoryName}") @RequiresAuthentication @Validate @Override public Response updateRepository( final NpmProxyRepositoryApiRequest request, @ApiParam(value = "Name of the repository to update") @PathParam("repositoryName") final String repositoryName) { return super.updateRepository(request, repositoryName); }
Example #15
Source File: UserApiResource.java From nexus-public with Eclipse Public License 1.0 | 6 votes |
@Override @PUT @RequiresAuthentication @RequiresPermissions("nexus:*") @Path("{userId}/change-password") @Consumes(MediaType.TEXT_PLAIN) @Validate public void changePassword(@PathParam("userId") final String userId, final String password) { if (StringUtils.isBlank(password)) { throw createWebException(Status.BAD_REQUEST, "Password must be supplied."); } try { securitySystem.changePassword(userId, password); if (ADMIN_USER_ID.equals(userId)) { adminPasswordFileManager.removeFile(); } } catch (UserNotFoundException e) { // NOSONAR log.debug("Request to change password for invalid user '{}'.", userId); throw createUnknownUserException(userId); } }
Example #16
Source File: P2ProxyRepositoriesApiResource.java From nexus-repository-p2 with Eclipse Public License 1.0 | 6 votes |
@ApiOperation("Update p2 proxy repository") @ApiResponses(value = { @ApiResponse(code = 204, message = REPOSITORY_UPDATED), @ApiResponse(code = 401, message = AUTHENTICATION_REQUIRED), @ApiResponse(code = 403, message = INSUFFICIENT_PERMISSIONS) }) @PUT @Path("/{repositoryName}") @RequiresAuthentication @Validate @Override public Response updateRepository( final P2ProxyRepositoryApiRequest request, @ApiParam(value = "Name of the repository to update") @PathParam("repositoryName") final String repositoryName) { return super.updateRepository(request, repositoryName); }
Example #17
Source File: PypiProxyRepositoriesApiResource.java From nexus-public with Eclipse Public License 1.0 | 6 votes |
@ApiOperation("Update PyPI proxy repository") @ApiResponses(value = { @ApiResponse(code = 204, message = REPOSITORY_UPDATED), @ApiResponse(code = 401, message = AUTHENTICATION_REQUIRED), @ApiResponse(code = 403, message = INSUFFICIENT_PERMISSIONS) }) @PUT @Path("/{repositoryName}") @RequiresAuthentication @Validate @Override public Response updateRepository( final PypiProxyRepositoryApiRequest request, @ApiParam(value = "Name of the repository to update") @PathParam("repositoryName") final String repositoryName) { return super.updateRepository(request, repositoryName); }
Example #18
Source File: PypiHostedRepositoriesApiResource.java From nexus-public with Eclipse Public License 1.0 | 6 votes |
@ApiOperation("Update PyPI hosted repository") @ApiResponses(value = { @ApiResponse(code = 204, message = REPOSITORY_UPDATED), @ApiResponse(code = 401, message = AUTHENTICATION_REQUIRED), @ApiResponse(code = 403, message = INSUFFICIENT_PERMISSIONS) }) @PUT @Path("/{repositoryName}") @RequiresAuthentication @Validate @Override public Response updateRepository( final PypiHostedRepositoryApiRequest request, @ApiParam(value = "Name of the repository to update") @PathParam("repositoryName") final String repositoryName) { return super.updateRepository(request, repositoryName); }
Example #19
Source File: CocoapodsProxyRepositoriesApiResource.java From nexus-public with Eclipse Public License 1.0 | 6 votes |
@ApiOperation("Update Cocoapods proxy repository") @ApiResponses(value = { @ApiResponse(code = 204, message = REPOSITORY_UPDATED), @ApiResponse(code = 401, message = AUTHENTICATION_REQUIRED), @ApiResponse(code = 403, message = INSUFFICIENT_PERMISSIONS) }) @PUT @Path("/{repositoryName}") @RequiresAuthentication @Validate @Override public Response updateRepository( final CocoapodsProxyRepositoryApiRequest request, @ApiParam(value = "Name of the repository to update") @PathParam("repositoryName") final String repositoryName) { return super.updateRepository(request, repositoryName); }
Example #20
Source File: RawProxyRepositoriesApiResource.java From nexus-public with Eclipse Public License 1.0 | 6 votes |
@ApiOperation("Update raw proxy repository") @ApiResponses(value = { @ApiResponse(code = 204, message = REPOSITORY_UPDATED), @ApiResponse(code = 401, message = AUTHENTICATION_REQUIRED), @ApiResponse(code = 403, message = INSUFFICIENT_PERMISSIONS) }) @PUT @Path("/{repositoryName}") @RequiresAuthentication @Validate @Override public Response updateRepository( final RawProxyRepositoryApiRequest request, @ApiParam(value = "Name of the repository to update") @PathParam("repositoryName") final String repositoryName) { return super.updateRepository(request, repositoryName); }
Example #21
Source File: RawHostedRepositoriesApiResource.java From nexus-public with Eclipse Public License 1.0 | 6 votes |
@ApiOperation("Update raw hosted repository") @ApiResponses(value = { @ApiResponse(code = 204, message = REPOSITORY_UPDATED), @ApiResponse(code = 401, message = AUTHENTICATION_REQUIRED), @ApiResponse(code = 403, message = INSUFFICIENT_PERMISSIONS) }) @PUT @Path("/{repositoryName}") @RequiresAuthentication @Validate @Override public Response updateRepository( final RawHostedRepositoryApiRequest request, @ApiParam(value = "Name of the repository to update") @PathParam("repositoryName") final String repositoryName) { return super.updateRepository(request, repositoryName); }
Example #22
Source File: AptHostedRepositoriesApiResource.java From nexus-public with Eclipse Public License 1.0 | 6 votes |
@ApiOperation("Update APT hosted repository") @ApiResponses(value = { @ApiResponse(code = 204, message = REPOSITORY_UPDATED), @ApiResponse(code = 401, message = AUTHENTICATION_REQUIRED), @ApiResponse(code = 403, message = INSUFFICIENT_PERMISSIONS), @ApiResponse(code = 404, message = REPOSITORY_NOT_FOUND) }) @PUT @Path("/{repositoryName}") @RequiresAuthentication @Validate @Override public Response updateRepository( final AptHostedRepositoryApiRequest request, @ApiParam(value = "Name of the repository to update") @PathParam("repositoryName") final String repositoryName) { return super.updateRepository(request, repositoryName); }
Example #23
Source File: RawGroupRepositoriesApiResource.java From nexus-public with Eclipse Public License 1.0 | 6 votes |
@ApiOperation("Update raw group repository") @ApiResponses(value = { @ApiResponse(code = 204, message = REPOSITORY_UPDATED), @ApiResponse(code = 401, message = AUTHENTICATION_REQUIRED), @ApiResponse(code = 403, message = INSUFFICIENT_PERMISSIONS) }) @PUT @Path("/{repositoryName}") @RequiresAuthentication @Validate @Override public Response updateRepository( final RawGroupRepositoryApiRequest request, @ApiParam(value = "Name of the repository to update") @PathParam("repositoryName") final String repositoryName) { return super.updateRepository(request, repositoryName); }
Example #24
Source File: GolangGroupRepositoriesApiResource.java From nexus-public with Eclipse Public License 1.0 | 6 votes |
@ApiOperation("Update a Go group repository") @ApiResponses(value = { @ApiResponse(code = 204, message = REPOSITORY_UPDATED), @ApiResponse(code = 401, message = AUTHENTICATION_REQUIRED), @ApiResponse(code = 403, message = INSUFFICIENT_PERMISSIONS), @ApiResponse(code = 404, message = REPOSITORY_NOT_FOUND) }) @PUT @Path("/{repositoryName}") @RequiresAuthentication @Validate @Override public Response updateRepository( final GolangGroupRepositoryApiRequest request, @ApiParam(value = "Name of the repository to update") @PathParam("repositoryName") final String repositoryName) { return super.updateRepository(request, repositoryName); }
Example #25
Source File: AptProxyRepositoriesApiResource.java From nexus-public with Eclipse Public License 1.0 | 6 votes |
@ApiOperation("Update APT proxy repository") @ApiResponses(value = { @ApiResponse(code = 204, message = REPOSITORY_UPDATED), @ApiResponse(code = 401, message = AUTHENTICATION_REQUIRED), @ApiResponse(code = 403, message = INSUFFICIENT_PERMISSIONS), @ApiResponse(code = 404, message = REPOSITORY_NOT_FOUND) }) @PUT @Path("/{repositoryName}") @RequiresAuthentication @Validate @Override public Response updateRepository( final AptProxyRepositoryApiRequest request, @ApiParam(value = "Name of the repository to update") @PathParam("repositoryName") final String repositoryName) { return super.updateRepository(request, repositoryName); }
Example #26
Source File: GolangProxyRepositoriesApiResource.java From nexus-public with Eclipse Public License 1.0 | 6 votes |
@ApiOperation("Update a Go proxy repository") @ApiResponses(value = { @ApiResponse(code = 204, message = REPOSITORY_UPDATED), @ApiResponse(code = 401, message = AUTHENTICATION_REQUIRED), @ApiResponse(code = 403, message = INSUFFICIENT_PERMISSIONS), @ApiResponse(code = 404, message = REPOSITORY_NOT_FOUND) }) @PUT @Path("/{repositoryName}") @RequiresAuthentication @Validate @Override public Response updateRepository( final GolangProxyRepositoryApiRequest request, @ApiParam(value = "Name of the repository to update") @PathParam("repositoryName") final String repositoryName) { return super.updateRepository(request, repositoryName); }
Example #27
Source File: GolangHostedRepositoriesApiResource.java From nexus-public with Eclipse Public License 1.0 | 6 votes |
@ApiOperation("Update a Go hosted repository") @ApiResponses(value = { @ApiResponse(code = 204, message = REPOSITORY_UPDATED), @ApiResponse(code = 401, message = AUTHENTICATION_REQUIRED), @ApiResponse(code = 403, message = INSUFFICIENT_PERMISSIONS), @ApiResponse(code = 404, message = REPOSITORY_NOT_FOUND) }) @PUT @Path("/{repositoryName}") @RequiresAuthentication @Validate @Override public Response updateRepository( final GolangHostedRepositoryApiRequest request, @ApiParam(value = "Name of the repository to update") @PathParam("repositoryName") final String repositoryName) { return super.updateRepository(request, repositoryName); }
Example #28
Source File: MavenProxyRepositoriesApiResource.java From nexus-public with Eclipse Public License 1.0 | 6 votes |
@ApiOperation("Update Maven proxy repository") @ApiResponses(value = { @ApiResponse(code = 204, message = REPOSITORY_UPDATED), @ApiResponse(code = 401, message = AUTHENTICATION_REQUIRED), @ApiResponse(code = 403, message = INSUFFICIENT_PERMISSIONS) }) @PUT @Path("/{repositoryName}") @RequiresAuthentication @Validate @Override public Response updateRepository( final MavenProxyRepositoryApiRequest request, @ApiParam(value = "Name of the repository to update") @PathParam("repositoryName") final String repositoryName) { return super.updateRepository(request, repositoryName); }
Example #29
Source File: MavenGroupRepositoriesApiResource.java From nexus-public with Eclipse Public License 1.0 | 6 votes |
@ApiOperation("Update Maven group repository") @ApiResponses(value = { @ApiResponse(code = 204, message = REPOSITORY_UPDATED), @ApiResponse(code = 401, message = AUTHENTICATION_REQUIRED), @ApiResponse(code = 403, message = INSUFFICIENT_PERMISSIONS) }) @PUT @Path("/{repositoryName}") @RequiresAuthentication @Validate @Override public Response updateRepository( final MavenGroupRepositoryApiRequest request, @ApiParam(value = "Name of the repository to update") @PathParam("repositoryName") final String repositoryName) { return super.updateRepository(request, repositoryName); }
Example #30
Source File: MavenHostedRepositoriesApiResource.java From nexus-public with Eclipse Public License 1.0 | 6 votes |
@ApiOperation("Update Maven hosted repository") @ApiResponses(value = { @ApiResponse(code = 204, message = REPOSITORY_UPDATED), @ApiResponse(code = 401, message = AUTHENTICATION_REQUIRED), @ApiResponse(code = 403, message = INSUFFICIENT_PERMISSIONS) }) @PUT @Path("/{repositoryName}") @RequiresAuthentication @Validate @Override public Response updateRepository( final MavenHostedRepositoryApiRequest request, @ApiParam(value = "Name of the repository to update") @PathParam("repositoryName") final String repositoryName) { return super.updateRepository(request, repositoryName); }