parent
ecf4dbfb18
commit
9ebd94a3a8
2 changed files with 27 additions and 1 deletions
|
@ -142,7 +142,11 @@ public class UserInfoEndpoint {
|
|||
authorization(accessToken);
|
||||
|
||||
try {
|
||||
if (MediaType.APPLICATION_FORM_URLENCODED.equalsIgnoreCase(headers.getHeaderString(HttpHeaders.CONTENT_TYPE))) {
|
||||
|
||||
String contentType = headers.getHeaderString(HttpHeaders.CONTENT_TYPE);
|
||||
jakarta.ws.rs.core.MediaType mediaType = jakarta.ws.rs.core.MediaType.valueOf(contentType);
|
||||
|
||||
if (jakarta.ws.rs.core.MediaType.APPLICATION_FORM_URLENCODED_TYPE.isCompatible(mediaType)) {
|
||||
MultivaluedMap<String, String> formParams = request.getDecodedFormParameters();
|
||||
checkAccessTokenDuplicated(formParams);
|
||||
accessToken = formParams.getFirst(OAuth2Constants.ACCESS_TOKEN);
|
||||
|
|
|
@ -207,6 +207,28 @@ public class UserInfoTest extends AbstractKeycloakTest {
|
|||
client.close();
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSuccess_postMethod_charset_body() throws Exception {
|
||||
Client client = AdminClientUtil.createResteasyClient();
|
||||
|
||||
try {
|
||||
AccessTokenResponse accessTokenResponse = executeGrantAccessTokenRequest(client);
|
||||
|
||||
Form form = new Form();
|
||||
form.param("access_token", accessTokenResponse.getToken());
|
||||
|
||||
WebTarget userInfoTarget = UserInfoClientUtil.getUserInfoWebTarget(client);
|
||||
Response response = userInfoTarget.request()
|
||||
.header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_FORM_URLENCODED_TYPE.withCharset("utf-8"))
|
||||
.post(Entity.form(form));
|
||||
|
||||
testSuccessfulUserInfoResponse(response);
|
||||
|
||||
} finally {
|
||||
client.close();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// KEYCLOAK-8838
|
||||
|
|
Loading…
Reference in a new issue