74 RegisterRequest registerRequest =
new RegisterRequest(ApplicationType.WEB,
"oxAuth test app",
75 StringUtils.spaceSeparatedToList(redirectUris));
76 registerRequest.setContacts(Arrays.asList(
"javier@gluu.org",
"javier.rojas.blum@gmail.com"));
77 registerRequest.setScope(Arrays.asList(
"openid",
"address",
"profile",
"email",
"phone",
"clientinfo",
"invalid_scope"));
78 registerRequest.setLogoUri(
"http://www.gluu.org/wp-content/themes/gluursn/images/logo.png");
79 registerRequest.setTokenEndpointAuthMethod(AuthenticationMethod.CLIENT_SECRET_JWT);
80 registerRequest.setPolicyUri(
"http://www.gluu.org/policy");
81 registerRequest.setJwksUri(
"http://www.gluu.org/jwks");
82 registerRequest.setSectorIdentifierUri(sectorIdentifierUri);
83 registerRequest.setSubjectType(SubjectType.PAIRWISE);
84 registerRequest.setRequestUris(Arrays.asList(
"http://www.gluu.org/request"));
85 registerRequest.setFrontChannelLogoutUris(Lists.newArrayList(logoutUri));
86 registerRequest.setFrontChannelLogoutSessionRequired(
true);
87 registerRequest.setIdTokenSignedResponseAlg(SignatureAlgorithm.RS512);
88 registerRequest.setIdTokenEncryptedResponseAlg(KeyEncryptionAlgorithm.RSA1_5);
89 registerRequest.setIdTokenEncryptedResponseEnc(BlockEncryptionAlgorithm.A128CBC_PLUS_HS256);
90 registerRequest.setUserInfoSignedResponseAlg(SignatureAlgorithm.RS384);
91 registerRequest.setUserInfoEncryptedResponseAlg(KeyEncryptionAlgorithm.A128KW);
92 registerRequest.setUserInfoEncryptedResponseEnc(BlockEncryptionAlgorithm.A128GCM);
93 registerRequest.setRequestObjectSigningAlg(SignatureAlgorithm.RS256);
94 registerRequest.setRequestObjectEncryptionAlg(KeyEncryptionAlgorithm.A256KW);
95 registerRequest.setRequestObjectEncryptionEnc(BlockEncryptionAlgorithm.A256CBC_PLUS_HS512);
96 registerRequest.setTokenEndpointAuthMethod(AuthenticationMethod.CLIENT_SECRET_JWT);
97 registerRequest.setTokenEndpointAuthSigningAlg(SignatureAlgorithm.ES256);
100 registerClient.setRequest(registerRequest);
102 RegisterResponse response = registerClient.exec();
105 assertEquals(response.getStatus(), 200,
"Unexpected response code: " + response.getEntity());
106 assertNotNull(response.getClientId());
107 assertNotNull(response.getClientSecret());
108 assertNotNull(response.getRegistrationAccessToken());
109 assertNotNull(response.getClientSecretExpiresAt());
110 assertNotNull(response.getClaims().get(SCOPE.toString()));
111 assertNotNull(response.getClaims().get(FRONT_CHANNEL_LOGOUT_SESSION_REQUIRED.toString()));
112 assertTrue(Boolean.parseBoolean(response.getClaims().get(FRONT_CHANNEL_LOGOUT_SESSION_REQUIRED.toString())));
113 assertNotNull(response.getClaims().get(FRONT_CHANNEL_LOGOUT_URI.toString()));
114 assertTrue(
new JSONArray(response.getClaims().get(FRONT_CHANNEL_LOGOUT_URI.toString())).getString(0).equals(logoutUri));
115 assertNotNull(response.getClaims().get(ID_TOKEN_SIGNED_RESPONSE_ALG.toString()));
116 assertEquals(SignatureAlgorithm.RS512,
117 SignatureAlgorithm.fromString(response.getClaims().get(ID_TOKEN_SIGNED_RESPONSE_ALG.toString())));
118 assertNotNull(response.getClaims().get(ID_TOKEN_ENCRYPTED_RESPONSE_ALG.toString()));
119 assertEquals(KeyEncryptionAlgorithm.RSA1_5,
120 KeyEncryptionAlgorithm.fromName(response.getClaims().get(ID_TOKEN_ENCRYPTED_RESPONSE_ALG.toString())));
121 assertNotNull(response.getClaims().get(ID_TOKEN_ENCRYPTED_RESPONSE_ENC.toString()));
122 assertEquals(BlockEncryptionAlgorithm.A128CBC_PLUS_HS256,
123 BlockEncryptionAlgorithm.fromName(response.getClaims().get(ID_TOKEN_ENCRYPTED_RESPONSE_ENC.toString())));
124 assertNotNull(response.getClaims().get(USERINFO_SIGNED_RESPONSE_ALG.toString()));
125 assertEquals(SignatureAlgorithm.RS384,
126 SignatureAlgorithm.fromString(response.getClaims().get(USERINFO_SIGNED_RESPONSE_ALG.toString())));
127 assertNotNull(response.getClaims().get(USERINFO_ENCRYPTED_RESPONSE_ALG.toString()));
128 assertEquals(KeyEncryptionAlgorithm.A128KW,
129 KeyEncryptionAlgorithm.fromName(response.getClaims().get(USERINFO_ENCRYPTED_RESPONSE_ALG.toString())));
130 assertNotNull(response.getClaims().get(USERINFO_ENCRYPTED_RESPONSE_ENC.toString()));
131 assertEquals(BlockEncryptionAlgorithm.A128GCM,
132 BlockEncryptionAlgorithm.fromName(response.getClaims().get(USERINFO_ENCRYPTED_RESPONSE_ENC.toString())));
133 assertNotNull(response.getClaims().get(REQUEST_OBJECT_SIGNING_ALG.toString()));
134 assertEquals(SignatureAlgorithm.RS256,
135 SignatureAlgorithm.fromString(response.getClaims().get(REQUEST_OBJECT_SIGNING_ALG.toString())));
136 assertNotNull(response.getClaims().get(REQUEST_OBJECT_ENCRYPTION_ALG.toString()));
137 assertEquals(KeyEncryptionAlgorithm.A256KW,
138 KeyEncryptionAlgorithm.fromName(response.getClaims().get(REQUEST_OBJECT_ENCRYPTION_ALG.toString())));
139 assertNotNull(response.getClaims().get(REQUEST_OBJECT_ENCRYPTION_ENC.toString()));
140 assertEquals(BlockEncryptionAlgorithm.A256CBC_PLUS_HS512,
141 BlockEncryptionAlgorithm.fromName(response.getClaims().get(REQUEST_OBJECT_ENCRYPTION_ENC.toString())));
142 assertNotNull(response.getClaims().get(TOKEN_ENDPOINT_AUTH_METHOD.toString()));
143 assertEquals(AuthenticationMethod.CLIENT_SECRET_JWT,
144 AuthenticationMethod.fromString(response.getClaims().get(TOKEN_ENDPOINT_AUTH_METHOD.toString())));
145 assertNotNull(response.getClaims().get(TOKEN_ENDPOINT_AUTH_SIGNING_ALG.toString()));
146 assertEquals(SignatureAlgorithm.ES256,
147 SignatureAlgorithm.fromString(response.getClaims().get(TOKEN_ENDPOINT_AUTH_SIGNING_ALG.toString())));
148 JSONArray scopesJsonArray =
new JSONArray(StringUtils.spaceSeparatedToList(response.getClaims().get(SCOPE.toString())));
149 List<String> scopes =
new ArrayList<String>();
150 for (
int i = 0; i < scopesJsonArray.length(); i++) {
151 scopes.add(scopesJsonArray.get(i).toString());
153 assertTrue(scopes.contains(
"openid"));
154 assertTrue(scopes.contains(
"address"));
155 assertTrue(scopes.contains(
"email"));
156 assertTrue(scopes.contains(
"profile"));
157 assertTrue(scopes.contains(
"phone"));
158 assertTrue(scopes.contains(
"clientinfo"));
String registrationEndpoint
Definition: BaseTest.java:81
static void showClient(BaseClient client)
Definition: BaseTest.java:775
String registrationAccessToken1
Definition: RegistrationRestWebServiceHttpTest.java:42
void showTitle(String title)
Definition: BaseTest.java:761
String registrationClientUri1
Definition: RegistrationRestWebServiceHttpTest.java:43
static ClientExecutor clientExecutor()
Definition: BaseTest.java:822