Package org.sonatype.security.rest.model

Examples of org.sonatype.security.rest.model.UserResourceRequest


    String entityText = RequestFacade.doGetForText("service/local/users/" + userId);

    XStreamRepresentation representation =
        new XStreamRepresentation(XStreamFactory.getXmlXStream(), entityText, MediaType.APPLICATION_XML);

    UserResourceRequest resourceResponse =
        (UserResourceRequest) representation.getPayload(new UserResourceRequest());

    return resourceResponse.getData();
  }
View Full Code Here


    String userId = (method == Method.POST) ? "" : "/" + resource.getUserId();

    String serviceURI = "service/local/users" + userId;

    UserResourceRequest userRequest = new UserResourceRequest();
    userRequest.setData(resource);

    // now set the payload
    representation.setPayload(userRequest);

    return RequestFacade.sendMessage(serviceURI, method, representation);
View Full Code Here

    LOG.debug(" getResourceFromResponse: " + responseString);

    XStreamRepresentation representation = new XStreamRepresentation(xstream, responseString, mediaType);

    // this
    UserResourceRequest resourceResponse =
        (UserResourceRequest) representation.getPayload(new UserResourceRequest());

    return resourceResponse.getData();
  }
View Full Code Here

    this.setModifiable(true);
  }

  @Override
  public Object getPayloadInstance() {
    return new UserResourceRequest();
  }
View Full Code Here

  @Override
  @POST
  public UserResourceResponse put(Context context, Request request, Response response, Object payload)
      throws ResourceException
  {
    UserResourceRequest resourceRequest = (UserResourceRequest) payload;
    UserResourceResponse result = null;

    if (resourceRequest != null) {
      UserResource resource = resourceRequest.getData();

      // the password can not be set on update, The only way to set a password is using the users_setpw resource
      if (StringUtils.isNotEmpty(resource.getPassword())) {
        throw new PlexusResourceException(
            Status.CLIENT_ERROR_BAD_REQUEST,
            this.getErrorResponse("*",
                "Updating a users password using this URI is not allowed."));
      }

      try {
        User user = restToSecurityModel(getSecuritySystem().getUser(resource.getUserId()), resource);

        validateUserContainment(user);

        getSecuritySystem().updateUser(user);

        result = new UserResourceResponse();

        result.setData(resourceRequest.getData());

        result.getData().setResourceURI(createChildReference(request, resource.getUserId()).toString());

      }
      catch (InvalidConfigurationException e) {
View Full Code Here

    this.setModifiable(true);
  }

  @Override
  public Object getPayloadInstance() {
    return new UserResourceRequest();
  }
View Full Code Here

  @Override
  @POST
  public UserResourceResponse post(Context context, Request request, Response response, Object payload)
      throws ResourceException
  {
    UserResourceRequest requestResource = (UserResourceRequest) payload;
    UserResourceResponse result = null;

    if (requestResource != null) {
      UserResource resource = requestResource.getData();

      try {
        User user = restToSecurityModel(null, resource);

        validateUserContainment(user);
View Full Code Here

      throws Exception
  {

    PlexusResource resource = this.lookup(PlexusResource.class, "UserListPlexusResource");

    UserResourceRequest resourceRequest = new UserResourceRequest();
    UserResource userResource = new UserResource();
    resourceRequest.setData(userResource);
    userResource.setEmail("test@test.com");
    userResource.setFirstName("firstAddUser");
    userResource.setStatus("active");
    userResource.setUserId("testAddUser");
    userResource.addRole("admin");
View Full Code Here

      throws Exception
  {

    PlexusResource resource = this.lookup(PlexusResource.class, "UserListPlexusResource");

    UserResourceRequest resourceRequest = new UserResourceRequest();
    UserResource userResource = new UserResource();
    resourceRequest.setData(userResource);
    userResource.setEmail("testInvalidEmailAddUser");
    userResource.setFirstName("firstTestInvalidEmailAddUser");
    userResource.setLastName("firstTestInvalidEmailAddUser");
    userResource.setStatus("active");
    userResource.setUserId("testInvalidEmailAddUser");
View Full Code Here

      throws Exception
  {

    PlexusResource resource = this.lookup(PlexusResource.class, "UserListPlexusResource");

    UserResourceRequest resourceRequest = new UserResourceRequest();
    UserResource userResource = new UserResource();
    resourceRequest.setData(userResource);
    userResource.setEmail("testUserIdWithSpace@testUserIdWithSpace.com");
    userResource.setFirstName("testUserIdWithSpace");
    userResource.setLastName("Last Name testUserIdWithSpace");
    userResource.setStatus("active");
    userResource.setUserId("test User Id With Space");
View Full Code Here

TOP

Related Classes of org.sonatype.security.rest.model.UserResourceRequest

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.