Examples of TokenRequest


Examples of org.springframework.security.oauth2.provider.TokenRequest

    authorizationParameters.put("code", code);
 
    //AuthorizationRequest oAuth2Request = createFromParameters(initialParameters);
    //oAuth2Request.setRequestParameters(authorizationParameters);

    TokenRequest tokenRequest = requestFactory.createTokenRequest(parameters, client);
    tokenRequest.setRequestParameters(authorizationParameters);
   
    AuthorizationCodeTokenGranter granter = new AuthorizationCodeTokenGranter(providerTokenServices,
        authorizationCodeServices, clientDetailsService, requestFactory);
    try {
      granter.getOAuth2Authentication(client, tokenRequest);
View Full Code Here

Examples of org.springframework.security.oauth2.provider.TokenRequest

      }
    });

    OAuth2AccessToken accessToken = getTokenServices().createAccessToken(createAuthentication());
    assertTrue(accessToken.getValue().startsWith("I'mEnhanced"));
    TokenRequest tokenRequest = new TokenRequest(Collections.singletonMap("client_id", "id"), "id", null, null);
    OAuth2AccessToken refreshedAccessToken = getTokenServices().refreshAccessToken(
        accessToken.getRefreshToken().getValue(), tokenRequest);
    assertTrue(refreshedAccessToken.getValue().startsWith("I'mEnhanced"));
  }
View Full Code Here

Examples of org.springframework.security.oauth2.provider.TokenRequest

  @Test
  public void testRefreshTokenMaintainsState() throws Exception {
    getTokenServices().setSupportRefreshToken(true);
    OAuth2AccessToken accessToken = getTokenServices().createAccessToken(createAuthentication());
    OAuth2RefreshToken expectedExpiringRefreshToken = accessToken.getRefreshToken();
    TokenRequest tokenRequest = new TokenRequest(Collections.singletonMap("client_id", "id"), "id", null, null);
    OAuth2AccessToken refreshedAccessToken = getTokenServices().refreshAccessToken(
        expectedExpiringRefreshToken.getValue(), tokenRequest);
    assertNotNull(refreshedAccessToken);
    assertEquals(1, getAccessTokenCount());
  }
View Full Code Here

Examples of org.springframework.security.oauth2.provider.TokenRequest

  public void testNotReuseRefreshTokenMaintainsState() throws Exception {
    getTokenServices().setSupportRefreshToken(true);
    getTokenServices().setReuseRefreshToken(false);
    OAuth2AccessToken accessToken = getTokenServices().createAccessToken(createAuthentication());
    OAuth2RefreshToken expectedExpiringRefreshToken = accessToken.getRefreshToken();
    TokenRequest tokenRequest = new TokenRequest(Collections.singletonMap("client_id", "id"), "id", null, null);
    OAuth2AccessToken refreshedAccessToken = getTokenServices().refreshAccessToken(
        expectedExpiringRefreshToken.getValue(), tokenRequest);
    assertNotNull(refreshedAccessToken);
    assertEquals(1, getRefreshTokenCount());
  }
View Full Code Here

Examples of org.springframework.security.oauth2.provider.TokenRequest

  @Before
  public void init() {
    token = new DefaultOAuth2AccessToken("FOO");
    ClientDetails client = new BaseClientDetails("client", null, "read", "client_credentials", "ROLE_CLIENT");
    authentication = new OAuth2Authentication(
        new TokenRequest(null, "client", null, "client_credentials").createOAuth2Request(client), null);
    tokenStore.clear();
  }
View Full Code Here

Examples of org.springframework.security.oauth2.provider.TokenRequest

  private Principal clientAuthentication = new UsernamePasswordAuthenticationToken("client", null,
      Collections.singleton(new SimpleGrantedAuthority("ROLE_CLIENT")));

  private TokenRequest createFromParameters(Map<String, String> parameters) {
    TokenRequest request = new TokenRequest(parameters, parameters.get(OAuth2Utils.CLIENT_ID),
        OAuth2Utils.parseParameterList(parameters.get(OAuth2Utils.SCOPE)),
        parameters.get(OAuth2Utils.GRANT_TYPE));
    return request;
  }
View Full Code Here

Examples of org.springframework.security.oauth2.provider.TokenRequest

  }

  @Test
  public void testTransformedRequest() {
    service.store(oauth2Request, tokenRequest);
    TokenRequest tokenRequest = new TokenRequest(Collections.<String, String> emptyMap(), "client", Collections.singleton("read"), "implicit");
    assertEquals(oauth2Request, service.remove(tokenRequest));
    assertEquals(null, service.remove(tokenRequest));
  }
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.