Package org.springframework.security.oauth2.provider.client

Examples of org.springframework.security.oauth2.provider.client.BaseClientDetails


  }

  @Test
  public void testUpdateClientSecret() {

    BaseClientDetails clientDetails = new BaseClientDetails();
    clientDetails.setClientId("newClientIdWithNoDetails");

    service.setPasswordEncoder(new PasswordEncoder() {

      public boolean matches(CharSequence rawPassword,
          String encodedPassword) {
        return true;
      }

      public String encode(CharSequence rawPassword) {
        return "BAR";
      }
    });
    service.addClientDetails(clientDetails);
    service.updateClientSecret(clientDetails.getClientId(), "foo");

    Map<String, Object> map = jdbcTemplate.queryForMap(SELECT_SQL,
        "newClientIdWithNoDetails");

    assertEquals("newClientIdWithNoDetails", map.get("client_id"));
View Full Code Here


  }

  @Test
  public void testUpdateClientRedirectURI() {

    BaseClientDetails clientDetails = new BaseClientDetails();
    clientDetails.setClientId("newClientIdWithNoDetails");

    service.addClientDetails(clientDetails);

    String[] redirectURI = { "http://localhost:8080",
        "http://localhost:9090" };
    clientDetails.setRegisteredRedirectUri(new HashSet<String>(Arrays
        .asList(redirectURI)));

    service.updateClientDetails(clientDetails);

    Map<String, Object> map = jdbcTemplate.queryForMap(SELECT_SQL,
View Full Code Here

  }

  @Test(expected = NoSuchClientException.class)
  public void testUpdateNonExistentClient() {

    BaseClientDetails clientDetails = new BaseClientDetails();
    clientDetails.setClientId("nosuchClientIdWithNoDetails");

    service.updateClientDetails(clientDetails);
  }
View Full Code Here

  }

  @Test
  public void testRemoveClient() {

    BaseClientDetails clientDetails = new BaseClientDetails();
    clientDetails.setClientId("deletedClientIdWithNoDetails");

    service.addClientDetails(clientDetails);
    service.removeClientDetails(clientDetails.getClientId());

    int count = jdbcTemplate.queryForObject(
        "select count(*) from oauth_client_details where client_id=?",
        Integer.class, "deletedClientIdWithNoDetails");

View Full Code Here

  }

  @Test(expected = NoSuchClientException.class)
  public void testRemoveNonExistentClient() {

    BaseClientDetails clientDetails = new BaseClientDetails();
    clientDetails.setClientId("nosuchClientIdWithNoDetails");

    service.removeClientDetails(clientDetails.getClientId());
  }
View Full Code Here

  }

  @Test
  public void testFindClients() {

    BaseClientDetails clientDetails = new BaseClientDetails();
    clientDetails.setClientId("aclient");

    service.addClientDetails(clientDetails);
    int count = service.listClientDetails().size();

    assertEquals(1, count);
View Full Code Here

    AuthorizationRequest authorizationRequest = new AuthorizationRequest();
    authorizationRequest.setClientId("client");
    authorizationRequest.setScope(Arrays.asList("read", "write"));
    authentication = new OAuth2Authentication(authorizationRequest.createOAuth2Request(), userAuthentication);
    InMemoryClientDetailsService clientDetailsService = new InMemoryClientDetailsService();
    client = new BaseClientDetails("client", "source", "read,write", "authorization_code,client_credentials",
        "read");
    clientDetailsService.setClientDetailsStore(Collections.singletonMap("client", client));
    voter.setClientDetailsService(clientDetailsService);
  }
View Full Code Here

  private TokenRequest tokenRequest;

  public ResourceOwnerPasswordTokenGranterTests() {
    String clientId = "client";
    BaseClientDetails clientDetails = new BaseClientDetails();
    clientDetails.setClientId(clientId);

    providerTokenServices.setTokenStore(new InMemoryTokenStore());
    Map<String, String> parameters = new HashMap<String, String>();
    parameters.put("username", "foo");
    parameters.put("password", "bar");
View Full Code Here

  private OAuth2WebSecurityExpressionHandler handler = new OAuth2WebSecurityExpressionHandler();

  @Test
  public void testScopesWithOr() throws Exception {
    AuthorizationRequest request = new AuthorizationRequest("foo", Collections.singleton("read"));
    request.setResourceIdsAndAuthoritiesFromClientDetails(new BaseClientDetails("foo", "bar", "",
        "client_credentials", "ROLE_USER"));
    request.setApproved(true);
    OAuth2Request clientAuthentication = request.createOAuth2Request();
    Authentication userAuthentication = new UsernamePasswordAuthenticationToken("user", "pass",
        AuthorityUtils.createAuthorityList("ROLE_USER"));
View Full Code Here

  }

  @Test
  public void testOauthClient() throws Exception {
    AuthorizationRequest request = new AuthorizationRequest("foo", Collections.singleton("read"));
    request.setResourceIdsAndAuthoritiesFromClientDetails(new BaseClientDetails("foo", "", "",
        "client_credentials", "ROLE_CLIENT"));

    OAuth2Request clientAuthentication = RequestTokenFactory
        .createOAuth2Request(request.getRequestParameters(), request.getClientId(), request.getAuthorities(),
            request.isApproved(), request.getScope(), request.getResourceIds(), request.getRedirectUri(),
View Full Code Here

TOP

Related Classes of org.springframework.security.oauth2.provider.client.BaseClientDetails

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.