use of org.xdi.oxauth.client.RegisterClient in project oxAuth by GluuFederation.
the class RejectRegistrationOfRedirectUriWithFragment method rejectRegistrationOfRedirectUriWithFragment.
@Parameters({ "redirectUri" })
@Test
public void rejectRegistrationOfRedirectUriWithFragment(final String redirectUri) throws Exception {
showTitle("OC5:FeatureTest-Reject Registration of redirect uri with Fragment");
List<ResponseType> responseTypes = Arrays.asList(ResponseType.CODE);
// 1. Register client
RegisterRequest registerRequest = new RegisterRequest(ApplicationType.WEB, "oxAuth test app", StringUtils.spaceSeparatedToList(redirectUri + "#foo1=bar"));
registerRequest.setResponseTypes(responseTypes);
RegisterClient registerClient = new RegisterClient(registrationEndpoint);
registerClient.setRequest(registerRequest);
RegisterResponse registerResponse = registerClient.exec();
showClient(registerClient);
assertEquals(registerResponse.getStatus(), 400, "Unexpected response code: " + registerResponse.getStatus());
assertNotNull(registerResponse.getErrorType(), "The error type is null");
assertNotNull(registerResponse.getErrorDescription(), "The error description is null");
}
use of org.xdi.oxauth.client.RegisterClient in project oxAuth by GluuFederation.
the class ClientWhiteListBlackListRedirectUris method requestClientUpdate.
@Test(dependsOnMethods = "requestClientAssociate")
public void requestClientUpdate() throws Exception {
showTitle("requestClientUpdate");
final String redirectUris = "https://www.attacker.com";
final RegisterRequest registerRequest = new RegisterRequest(registrationAccessToken1);
registerRequest.setHttpMethod(HttpMethod.PUT);
registerRequest.setRedirectUris(StringUtils.spaceSeparatedToList(redirectUris));
final RegisterClient registerClient = new RegisterClient(registrationClientUri1);
registerClient.setRequest(registerRequest);
registerClient.setExecutor(clientExecutor(true));
final RegisterResponse response = registerClient.exec();
showClient(registerClient);
assertEquals(response.getStatus(), 400, "Unexpected response code: " + response.getEntity());
assertNotNull(response.getEntity(), "The entity is null");
assertNotNull(response.getErrorType(), "The error type is null");
assertNotNull(response.getErrorDescription(), "The error description is null");
}
use of org.xdi.oxauth.client.RegisterClient in project oxAuth by GluuFederation.
the class ClientWhiteListBlackListRedirectUris method requestClientAssociateInBlackList.
@Test
public void requestClientAssociateInBlackList() throws Exception {
showTitle("requestClientAssociateInBlackList");
final String redirectUris = "https://www.attacker.com";
RegisterClient registerClient = new RegisterClient(registrationEndpoint);
RegisterResponse response = registerClient.execRegister(ApplicationType.WEB, "oxAuth test app", StringUtils.spaceSeparatedToList(redirectUris));
showClient(registerClient);
assertEquals(response.getStatus(), 400, "Unexpected response code: " + response.getEntity());
assertNotNull(response.getEntity(), "The entity is null");
assertNotNull(response.getErrorType(), "The error type is null");
assertNotNull(response.getErrorDescription(), "The error description is null");
}
use of org.xdi.oxauth.client.RegisterClient in project oxAuth by GluuFederation.
the class RegistrationRestWebServiceHttpTest method registerWithApplicationTypeNativeAndSubjectTypePairwise.
@Parameters({ "redirectUris", "sectorIdentifierUri" })
@Test
public void registerWithApplicationTypeNativeAndSubjectTypePairwise(final String redirectUris, final String sectorIdentifierUri) throws Exception {
showTitle("registerWithApplicationTypeNativeAndSubjectTypePairwise");
List<String> redirectUriList = Lists.newArrayList(StringUtils.spaceSeparatedToList(redirectUris));
RegisterRequest registerRequest = new RegisterRequest(ApplicationType.NATIVE, "oxAuth native test app", redirectUriList);
registerRequest.setSubjectType(SubjectType.PAIRWISE);
registerRequest.setSectorIdentifierUri(sectorIdentifierUri);
RegisterClient registerClient = new RegisterClient(registrationEndpoint);
registerClient.setExecutor(clientExecutor(true));
registerClient.setRequest(registerRequest);
RegisterResponse response = registerClient.exec();
showClient(registerClient);
assertEquals(response.getStatus(), 200, "Unexpected response code: " + response.getEntity());
assertNotNull(response.getClientId());
assertNotNull(response.getClientSecret());
assertNotNull(response.getRegistrationAccessToken());
assertNotNull(response.getClientSecretExpiresAt());
}
use of org.xdi.oxauth.client.RegisterClient in project oxAuth by GluuFederation.
the class RegistrationRestWebServiceHttpTest method requestClientRegistrationFail4.
@Parameters({ "redirectUris" })
@Test
public void requestClientRegistrationFail4(final String redirectUris) throws Exception {
showTitle("requestClientRegistrationFail4");
RegisterRequest registerRequest = new RegisterRequest(ApplicationType.WEB, "oxAuth test app", StringUtils.spaceSeparatedToList(redirectUris));
// id_token signature cannot be none
registerRequest.setIdTokenSignedResponseAlg(SignatureAlgorithm.NONE);
RegisterClient registerClient = new RegisterClient(registrationEndpoint);
registerClient.setRequest(registerRequest);
registerClient.setExecutor(clientExecutor(true));
RegisterResponse response = registerClient.exec();
showClient(registerClient);
assertEquals(response.getStatus(), 400);
assertNotNull(response.getEntity());
assertNotNull(response.getErrorType());
assertNotNull(response.getErrorDescription());
}
Aggregations