/* * oxAuth is available under the MIT License (2008). See http://opensource.org/licenses/MIT for full text. * * Copyright (c) 2014, Gluu */ package org.xdi.oxauth.interop; import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertNotNull; import java.util.Arrays; import org.testng.annotations.Parameters; import org.testng.annotations.Test; import org.xdi.oxauth.BaseTest; import org.xdi.oxauth.client.RegisterClient; import org.xdi.oxauth.client.RegisterRequest; import org.xdi.oxauth.client.RegisterResponse; import org.xdi.oxauth.model.common.AuthenticationMethod; import org.xdi.oxauth.model.common.SubjectType; import org.xdi.oxauth.model.crypto.signature.SignatureAlgorithm; import org.xdi.oxauth.model.register.ApplicationType; import org.xdi.oxauth.model.util.StringUtils; /** * OC5:FeatureTest-Enables Dynamic Registration * * @author Javier Rojas Blum Date: 07.27.2013 */ public class EnablesDynamicRegistration extends BaseTest { @Parameters({"redirectUris", "sectorIdentifierUri", "clientJwksUri"}) @Test public void enablesDynamicRegistration(final String redirectUris, final String sectorIdentifierUri, final String clientJwksUri) throws Exception { showTitle("OC5:FeatureTest-Enables Dynamic Registration"); RegisterRequest registerRequest = new RegisterRequest(ApplicationType.WEB, "oxAuth test app", StringUtils.spaceSeparatedToList(redirectUris)); registerRequest.setContacts(Arrays.asList("javier@gluu.org", "javier.rojas.blum@gmail.com")); registerRequest.setLogoUri("http://www.gluu.org/wp-content/themes/gluursn/images/logo.png"); registerRequest.setTokenEndpointAuthMethod(AuthenticationMethod.CLIENT_SECRET_JWT); registerRequest.setPolicyUri("http://www.gluu.org/policy"); registerRequest.setJwksUri(clientJwksUri); registerRequest.setSectorIdentifierUri(sectorIdentifierUri); registerRequest.setSubjectType(SubjectType.PUBLIC); registerRequest.setRequestObjectSigningAlg(SignatureAlgorithm.RS256); RegisterClient registerClient = new RegisterClient(registrationEndpoint); 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.getRegistrationClientUri()); assertNotNull(response.getClientIdIssuedAt()); assertNotNull(response.getClientSecretExpiresAt()); } }