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());
}
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;
}
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;
}
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());
}
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());
}
Aggregations