Update Deprecated Property in Opaque Token Introspectors

Update NimbusOpaqueTokenIntrospector and NimbusReactiveOpaqueTokenIntrospector to use MediaType.APPLICATION_JSON instead of the deprecated MediaType.APPLICATION_JSON_UTF8

Closes gh-9353
This commit is contained in:
Marcus Hert da Coregio 2021-05-06 10:04:49 -03:00 committed by Josh Cummings
parent 457c2a2d06
commit 6413511eb6
3 changed files with 6 additions and 6 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -109,7 +109,7 @@ public class NimbusOpaqueTokenIntrospector implements OpaqueTokenIntrospector {
private HttpHeaders requestHeaders() {
HttpHeaders headers = new HttpHeaders();
headers.setAccept(Collections.singletonList(MediaType.APPLICATION_JSON_UTF8));
headers.setAccept(Collections.singletonList(MediaType.APPLICATION_JSON));
return headers;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -106,7 +106,7 @@ public class NimbusReactiveOpaqueTokenIntrospector implements ReactiveOpaqueToke
// @formatter:off
return this.webClient.post()
.uri(this.introspectionUri)
.header(HttpHeaders.ACCEPT, MediaType.APPLICATION_JSON_UTF8_VALUE)
.header(HttpHeaders.ACCEPT, MediaType.APPLICATION_JSON_VALUE)
.body(BodyInserters.fromFormData("token", token))
.exchange();
// @formatter:on

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2020 the original author or authors.
* Copyright 2002-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -244,7 +244,7 @@ public class NimbusReactiveOpaqueTokenIntrospectorTests {
given(clientResponse.statusCode()).willReturn(HttpStatus.OK);
given(clientResponse.bodyToMono(String.class)).willReturn(Mono.just(response));
ClientResponse.Headers headers = mock(ClientResponse.Headers.class);
given(headers.contentType()).willReturn(Optional.of(MediaType.APPLICATION_JSON_UTF8));
given(headers.contentType()).willReturn(Optional.of(MediaType.APPLICATION_JSON));
given(clientResponse.headers()).willReturn(headers);
given(spec.exchange()).willReturn(Mono.just(clientResponse));
return webClient;