Search in sources :

Example 81 with JwtAuthorizationRequest

use of org.gluu.oxauth.client.model.authorize.JwtAuthorizationRequest in project oxAuth by GluuFederation.

the class CibaPollModeJwtAuthRequestTests method pollFlowES512HappyFlow.

@Parameters({ "ES512_keyId", "userId", "dnName", "keyStoreFile", "keyStoreSecret", "clientJwksUri" })
@Test
public void pollFlowES512HappyFlow(final String keyId, final String userId, final String dnName, final String keyStoreFile, final String keyStoreSecret, final String clientJwksUri) throws Exception {
    showTitle("pollFlowES512HappyFlow");
    registerPollClient(clientJwksUri, BackchannelTokenDeliveryMode.POLL, AsymmetricSignatureAlgorithm.ES512);
    JwtAuthorizationRequest jwtAuthorizationRequest = createJwtRequest(keyStoreFile, keyStoreSecret, dnName, userId, keyId, SignatureAlgorithm.ES512);
    processCibaAuthorizationEndpointSuccessfulCall(jwtAuthorizationRequest.getEncodedJwt(), registerResponse.getClientId(), registerResponse.getClientSecret());
}
Also used : JwtAuthorizationRequest(org.gluu.oxauth.client.model.authorize.JwtAuthorizationRequest) Parameters(org.testng.annotations.Parameters) BaseTest(org.gluu.oxauth.BaseTest) Test(org.testng.annotations.Test)

Example 82 with JwtAuthorizationRequest

use of org.gluu.oxauth.client.model.authorize.JwtAuthorizationRequest in project oxAuth by GluuFederation.

the class CibaPollModeJwtAuthRequestTests method createJwtRequest.

/**
 * Creates a new JwtAuthorizationRequest using default configuration and params.
 */
private JwtAuthorizationRequest createJwtRequest(String keyStoreFile, String keyStoreSecret, String dnName, String userId, String keyId, SignatureAlgorithm signatureAlgorithm) throws Exception {
    OxAuthCryptoProvider cryptoProvider = new OxAuthCryptoProvider(keyStoreFile, keyStoreSecret, dnName);
    String clientId = registerResponse.getClientId();
    int now = (int) (System.currentTimeMillis() / 1000);
    JwtAuthorizationRequest jwtAuthorizationRequest = new JwtAuthorizationRequest(null, signatureAlgorithm, cryptoProvider);
    jwtAuthorizationRequest.setAud(issuer);
    jwtAuthorizationRequest.setLoginHint(userId);
    jwtAuthorizationRequest.setNbf(now);
    jwtAuthorizationRequest.setScopes(Collections.singletonList("openid"));
    jwtAuthorizationRequest.setIss(clientId);
    jwtAuthorizationRequest.setBindingMessage("1234");
    jwtAuthorizationRequest.setExp((int) (DateUtils.addMinutes(new Date(), 5).getTime() / 1000));
    jwtAuthorizationRequest.setIat(now);
    jwtAuthorizationRequest.setJti(UUID.randomUUID().toString());
    jwtAuthorizationRequest.setKeyId(keyId);
    return jwtAuthorizationRequest;
}
Also used : OxAuthCryptoProvider(org.gluu.oxauth.model.crypto.OxAuthCryptoProvider) JwtAuthorizationRequest(org.gluu.oxauth.client.model.authorize.JwtAuthorizationRequest) Date(java.util.Date)

Example 83 with JwtAuthorizationRequest

use of org.gluu.oxauth.client.model.authorize.JwtAuthorizationRequest in project oxAuth by GluuFederation.

the class CibaPingModeJwtAuthRequestTests method createJwtRequest.

/**
 * Creates a new JwtAuthorizationRequest using default configuration and params.
 */
private JwtAuthorizationRequest createJwtRequest(String keyStoreFile, String keyStoreSecret, String dnName, String userId, String keyId, SignatureAlgorithm signatureAlgorithm) throws Exception {
    OxAuthCryptoProvider cryptoProvider = new OxAuthCryptoProvider(keyStoreFile, keyStoreSecret, dnName);
    String clientId = registerResponse.getClientId();
    int now = (int) (System.currentTimeMillis() / 1000);
    JwtAuthorizationRequest jwtAuthorizationRequest = new JwtAuthorizationRequest(null, signatureAlgorithm, cryptoProvider);
    jwtAuthorizationRequest.setClientNotificationToken("notification-token-123");
    jwtAuthorizationRequest.setAud(issuer);
    jwtAuthorizationRequest.setLoginHint(userId);
    jwtAuthorizationRequest.setNbf(now);
    jwtAuthorizationRequest.setScopes(Collections.singletonList("openid"));
    jwtAuthorizationRequest.setIss(clientId);
    jwtAuthorizationRequest.setBindingMessage("1234");
    jwtAuthorizationRequest.setExp((int) (DateUtils.addMinutes(new Date(), 5).getTime() / 1000));
    jwtAuthorizationRequest.setIat(now);
    jwtAuthorizationRequest.setJti(UUID.randomUUID().toString());
    jwtAuthorizationRequest.setKeyId(keyId);
    return jwtAuthorizationRequest;
}
Also used : OxAuthCryptoProvider(org.gluu.oxauth.model.crypto.OxAuthCryptoProvider) JwtAuthorizationRequest(org.gluu.oxauth.client.model.authorize.JwtAuthorizationRequest) Date(java.util.Date)

Example 84 with JwtAuthorizationRequest

use of org.gluu.oxauth.client.model.authorize.JwtAuthorizationRequest in project oxAuth by GluuFederation.

the class CibaPingModeJwtAuthRequestTests method pingFlowES512HappyFlow.

@Parameters({ "ES512_keyId", "userId", "dnName", "keyStoreFile", "keyStoreSecret", "clientJwksUri", "backchannelClientNotificationEndpoint" })
@Test
public void pingFlowES512HappyFlow(final String keyId, final String userId, final String dnName, final String keyStoreFile, final String keyStoreSecret, final String clientJwksUri, final String backchannelClientNotificationEndpoint) throws Exception {
    showTitle("pingFlowES512HappyFlow");
    registerPingClient(clientJwksUri, BackchannelTokenDeliveryMode.PING, AsymmetricSignatureAlgorithm.ES512, backchannelClientNotificationEndpoint);
    JwtAuthorizationRequest jwtAuthorizationRequest = createJwtRequest(keyStoreFile, keyStoreSecret, dnName, userId, keyId, SignatureAlgorithm.ES512);
    processCibaAuthorizationEndpointSuccessfulCall(jwtAuthorizationRequest.getEncodedJwt(), registerResponse.getClientId(), registerResponse.getClientSecret());
}
Also used : JwtAuthorizationRequest(org.gluu.oxauth.client.model.authorize.JwtAuthorizationRequest) Parameters(org.testng.annotations.Parameters) BaseTest(org.gluu.oxauth.BaseTest) Test(org.testng.annotations.Test)

Example 85 with JwtAuthorizationRequest

use of org.gluu.oxauth.client.model.authorize.JwtAuthorizationRequest in project oxAuth by GluuFederation.

the class CibaPingModeJwtAuthRequestTests method cibaPingJWTRequestIdTokenHint.

@Parameters({ "PS256_keyId", "userId", "dnName", "keyStoreFile", "keyStoreSecret", "clientJwksUri", "backchannelClientNotificationEndpoint" })
@Test(dependsOnMethods = "idTokenHintRS384")
public void cibaPingJWTRequestIdTokenHint(final String keyId, final String userId, final String dnName, final String keyStoreFile, final String keyStoreSecret, final String clientJwksUri, final String backchannelClientNotificationEndpoint) throws Exception {
    showTitle("cibaPingJWTRequestIdTokenHint");
    registerPingClient(clientJwksUri, BackchannelTokenDeliveryMode.PING, AsymmetricSignatureAlgorithm.PS256, backchannelClientNotificationEndpoint);
    // 1. Request doesn't include Aud
    JwtAuthorizationRequest jwtAuthorizationRequest = createJwtRequest(keyStoreFile, keyStoreSecret, dnName, userId, keyId, SignatureAlgorithm.PS256);
    jwtAuthorizationRequest.setLoginHint(null);
    jwtAuthorizationRequest.setIdTokenHint(idTokenHintRS384);
    processCibaAuthorizationEndpointSuccessfulCall(jwtAuthorizationRequest.getEncodedJwt(), registerResponse.getClientId(), registerResponse.getClientSecret());
}
Also used : JwtAuthorizationRequest(org.gluu.oxauth.client.model.authorize.JwtAuthorizationRequest) Parameters(org.testng.annotations.Parameters) BaseTest(org.gluu.oxauth.BaseTest) Test(org.testng.annotations.Test)

Aggregations

JwtAuthorizationRequest (org.gluu.oxauth.client.model.authorize.JwtAuthorizationRequest)158 BaseTest (org.gluu.oxauth.BaseTest)156 Parameters (org.testng.annotations.Parameters)156 Test (org.testng.annotations.Test)156 Claim (org.gluu.oxauth.client.model.authorize.Claim)136 ResponseType (org.gluu.oxauth.model.common.ResponseType)134 OxAuthCryptoProvider (org.gluu.oxauth.model.crypto.OxAuthCryptoProvider)128 AuthorizationRequest (org.gluu.oxauth.client.AuthorizationRequest)125 AuthorizationResponse (org.gluu.oxauth.client.AuthorizationResponse)99 RegisterClient (org.gluu.oxauth.client.RegisterClient)99 RegisterRequest (org.gluu.oxauth.client.RegisterRequest)99 RegisterResponse (org.gluu.oxauth.client.RegisterResponse)99 UserInfoClient (org.gluu.oxauth.client.UserInfoClient)86 UserInfoResponse (org.gluu.oxauth.client.UserInfoResponse)86 AuthorizeClient (org.gluu.oxauth.client.AuthorizeClient)73 Jwt (org.gluu.oxauth.model.jwt.Jwt)47 URI (java.net.URI)39 URISyntaxException (java.net.URISyntaxException)39 Builder (javax.ws.rs.client.Invocation.Builder)39 Response (javax.ws.rs.core.Response)39