Examples of AuthenticationResponse


Examples of org.archfirst.bfoms.domain.security.AuthenticationResponse

        if (password == null || password.isEmpty() ) {
            throw new WebApplicationException(Response.Status.UNAUTHORIZED);
        }

        // Authenticate the user before returning any information
        AuthenticationResponse response =
            securityService.authenticateUser(username, password);
       
        // Don't return user information if authentication failed
        if (!response.isSuccess()) {
            throw new WebApplicationException(Response.Status.UNAUTHORIZED);
        }

        return mapper.map(response.getUser(), User.class);
    }
View Full Code Here

Examples of org.archfirst.bfoms.domain.security.AuthenticationResponse

    }
   
    public Result authenticateUser(
            String username,
            String password) {
        AuthenticationResponse response =
            securityService.authenticateUser(username, password);
        if (response.isSuccess()) {
            Person person = response.getUser().getPerson();
            return new Result(true, person.getFirstName(), person.getLastName());
        }
        else {
            return new Result(false, "", "");
        }
View Full Code Here

Examples of org.archfirst.bfoms.webservice.security.AuthenticationResponse

    }

    @Test
    public void testSuccessfulAuthentication() {
        registerUsers();
        AuthenticationResponse response =
            securityTxnService.authenticateUser("jhorner", "cool");
        Assert.assertEquals(response.isSuccess(), true);
        Assert.assertEquals(response.getUser().getUsername(), "jhorner");
        Assert.assertEquals(response.getUser().getFirstName(), "John");
    }
View Full Code Here

Examples of org.archfirst.bfoms.webservice.security.AuthenticationResponse

    }
   
    @Test
    public void testIncorrectUsername() {
        registerUsers();
        AuthenticationResponse response =
            securityTxnService.authenticateUser("jhorn", "cool");
        Assert.assertEquals(response.isSuccess(), false);
    }
View Full Code Here

Examples of org.archfirst.bfoms.webservice.security.AuthenticationResponse

    }
   
    @Test
    public void testIncorrectPassword() {
        registerUsers();
        AuthenticationResponse response =
            securityTxnService.authenticateUser("jhorner", "bool");
        Assert.assertEquals(response.isSuccess(), false);
    }
View Full Code Here

Examples of org.jclouds.openstack.domain.AuthenticationResponse

      Builder<String, URI> builder = ImmutableMap.builder();
      for (Entry<String, String> entry : from.getHeaders().entries()) {
         if (entry.getKey().endsWith(URL_SUFFIX))
            builder.put(entry.getKey(), getURI(entry.getValue()));
      }
      AuthenticationResponse response = new AuthenticationResponse(checkNotNull(from.getFirstHeaderOrNull(AUTH_TOKEN),
               AUTH_TOKEN), builder.build());
      logger.debug("will connect to: ", response);
      return response;
   }
View Full Code Here

Examples of org.jclouds.openstack.domain.AuthenticationResponse

      HttpResponse response = HttpResponse.builder().statusCode(204).message("No Content")
                                          .addHeader("X-Auth-Token", "token")
                                          .addHeader("X-Storage-Token", "token")
                                          .addHeader("X-Storage-Url", "http://127.0.0.1:8080/v1/token").build();

      AuthenticationResponse md = parser.apply(response);
      assertEquals(md, new AuthenticationResponse("token", ImmutableMap.<String, URI> of("X-Storage-Url", URI
               .create("http://fooman:8080/v1/token"))));
   }
View Full Code Here

Examples of org.jclouds.openstack.domain.AuthenticationResponse

      Builder<String, URI> builder = ImmutableMap.builder();
      for (Entry<String, String> entry : from.getHeaders().entries()) {
         if (entry.getKey().toLowerCase().endsWith(URL_SUFFIX.toLowerCase()))
            builder.put(entry.getKey(), getURI(entry.getValue()));
      }
      AuthenticationResponse response = new AuthenticationResponse(checkNotNull(from.getFirstHeaderOrNull(AUTH_TOKEN),
               AUTH_TOKEN), builder.build());
      logger.debug("will connect to: ", response);
      return response;
   }
View Full Code Here

Examples of org.jclouds.openstack.domain.AuthenticationResponse

         super(null);
      }

      @Override
      public AuthenticationResponse load(Credentials input) {
         return new AuthenticationResponse("authToken", ImmutableMap.<String, URI> of(
                  AuthHeaders.SERVER_MANAGEMENT_URL, URI.create("http://endpoint/vapi-version"),
                  AuthHeaders.STORAGE_URL, URI.create("http://storage")));
      }
View Full Code Here

Examples of org.jclouds.openstack.domain.AuthenticationResponse

      HttpResponse response = HttpResponse.builder().statusCode(204).message("No Content")
                                          .addHeader("X-Auth-Token", "token")
                                          .addHeader("X-Storage-Token", "token")
                                          .addHeader("X-Storage-Url", "http://127.0.0.1:8080/v1/token").build();

      AuthenticationResponse md = parser.apply(response);
      assertEquals(md, new AuthenticationResponse("token", ImmutableMap.<String, URI> of("X-Storage-Url",
               URI.create("http://fooman:8080/v1/token"))));
   }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.