Package org.apache.cxf.rs.security.oauth2.tokens.bearer

Examples of org.apache.cxf.rs.security.oauth2.tokens.bearer.BearerAccessToken


        return new Client("alice", "alice", true);
    }

    public ServerAccessToken createAccessToken(AccessTokenRegistration accessToken)
        throws OAuthServiceException {
        return new BearerAccessToken(accessToken.getClient(), 3600);
    }
View Full Code Here


        return new Client("alice", "alice", true);
    }

    public ServerAccessToken createAccessToken(AccessTokenRegistration accessToken)
        throws OAuthServiceException {
        return new BearerAccessToken(accessToken.getClient(), 3600);
    }
View Full Code Here

    }

    @Override
    public ServerAccessToken createAccessToken(AccessTokenRegistration accessToken)
        throws OAuthServiceException {
        return new BearerAccessToken(accessToken.getClient(), 3600);
    }
View Full Code Here

    }

    @Override
    public ServerAccessToken createAccessToken(AccessTokenRegistration accessToken)
        throws OAuthServiceException {
        return new BearerAccessToken(accessToken.getClient(), 3600);
    }
View Full Code Here

    }

    @Override
    public ServerAccessToken createAccessToken(AccessTokenRegistration accessToken)
        throws OAuthServiceException {
        return new BearerAccessToken(accessToken.getClient(), 3600);
    }
View Full Code Here

        createNewRefreshToken(at);
        return at;
    }
   
    protected ServerAccessToken createNewAccessToken(Client client) {
        return new BearerAccessToken(client, accessTokenLifetime);
    }
View Full Code Here

  }
 
  // token management
  public ServerAccessToken createAccessToken(AccessTokenRegistration reg)
    throws OAuthServiceException {
    ServerAccessToken token = new BearerAccessToken(reg.getClient(), 3600L);
   
    List<String> scope = reg.getApprovedScope().isEmpty() ? reg.getRequestedScope()
                                                      : reg.getApprovedScope();
    token.setScopes(convertScopeToPermissions(reg.getClient(), scope));
    token.setSubject(reg.getSubject());
    token.setGrantType(reg.getGrantType());
   
    at = token;
   
    return token;
  }
View Full Code Here

    }

    @Override
    public ServerAccessToken createAccessToken(AccessTokenRegistration accessToken)
        throws OAuthServiceException {
        return new BearerAccessToken(accessToken.getClient(), 3600);
    }
View Full Code Here

    }
   
    @Test
    public void testBearerTokenCertAndSecretKey() throws Exception {
        AccessTokenRegistration atr = prepareTokenRegistration();
        BearerAccessToken token = p.createAccessTokenInternal(atr);
       
        KeyPairGenerator kpg = KeyPairGenerator.getInstance("RSA");
        KeyPair keyPair = kpg.generateKeyPair();
        PublicKey publicKey = keyPair.getPublic();
        PrivateKey privateKey = keyPair.getPrivate();
       
        SecretKey secretKey = CryptoUtils.getSecretKey("AES");
        String encryptedSecretKey = CryptoUtils.encryptSecretKey(secretKey, publicKey);
       
        String encryptedToken = ModelEncryptionSupport.encryptAccessToken(token, secretKey);
        token.setTokenKey(encryptedToken);
        SecretKey decryptedSecretKey = CryptoUtils.decryptSecretKey(encryptedSecretKey, privateKey);
        ServerAccessToken token2 = ModelEncryptionSupport.decryptAccessToken(p, encryptedToken, decryptedSecretKey);
        // compare tokens
        compareAccessTokens(token, token2);
    }
View Full Code Here

   
    @Test
    public void testBearerTokenJSON() throws Exception {
        AccessTokenRegistration atr = prepareTokenRegistration();
       
        BearerAccessToken token = p.createAccessTokenInternal(atr);
        JSONProvider<BearerAccessToken> jsonp = new JSONProvider<BearerAccessToken>();
        jsonp.setMarshallAsJaxbElement(true);
        jsonp.setUnmarshallAsJaxbElement(true);
        ByteArrayOutputStream bos = new ByteArrayOutputStream();
        jsonp.writeTo(token, BearerAccessToken.class, new Annotation[]{}, MediaType.APPLICATION_JSON_TYPE,
View Full Code Here

TOP

Related Classes of org.apache.cxf.rs.security.oauth2.tokens.bearer.BearerAccessToken

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.