Java Code Examples for org.apache.cxf.rs.security.oauth2.utils.OAuthConstants#BEARER_TOKEN_TYPE

The following examples show how to use org.apache.cxf.rs.security.oauth2.utils.OAuthConstants#BEARER_TOKEN_TYPE . 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: OAuthJSONProviderTest.java    From cxf with Apache License 2.0 6 votes vote down vote up
@Test
public void testWriteBearerClientAccessToken() throws Exception {
    ClientAccessToken token = new ClientAccessToken(OAuthConstants.BEARER_TOKEN_TYPE, "1234");
    token.setExpiresIn(12345);
    token.setRefreshToken("5678");
    token.setApprovedScope("read");
    token.setParameters(Collections.singletonMap("my_parameter", "http://abc"));

    OAuthJSONProvider provider = new OAuthJSONProvider();
    ByteArrayOutputStream bos = new ByteArrayOutputStream();
    provider.writeTo(token,
                     ClientAccessToken.class,
                     ClientAccessToken.class,
                     new Annotation[]{},
                     MediaType.APPLICATION_JSON_TYPE,
                     new MetadataMap<String, Object>(),
                     bos);
    doReadClientAccessToken(bos.toString(), OAuthConstants.BEARER_TOKEN_TYPE, token.getParameters());
}
 
Example 2
Source File: BearerAccessToken.java    From cxf with Apache License 2.0 5 votes vote down vote up
public BearerAccessToken(Client client,
                         long lifetime) {
    super(client,
          OAuthConstants.BEARER_TOKEN_TYPE,
          OAuthUtils.generateRandomTokenKey(),
          lifetime,
          OAuthUtils.getIssuedAt());
}
 
Example 3
Source File: BearerAccessToken.java    From cxf with Apache License 2.0 4 votes vote down vote up
public BearerAccessToken(Client client,
                         String tokenKey,
                         long lifetime,
                         long issuedAt) {
    super(client, OAuthConstants.BEARER_TOKEN_TYPE, tokenKey, lifetime, issuedAt);
}