|
45 | 45 | import org.springframework.web.client.HttpClientErrorException; |
46 | 46 | import org.springframework.web.client.RestOperations; |
47 | 47 | import org.springframework.web.client.RestTemplate; |
| 48 | +import org.springframework.web.util.UriComponents; |
48 | 49 | import org.springframework.web.util.UriComponentsBuilder; |
49 | 50 |
|
50 | 51 | /** |
@@ -82,11 +83,12 @@ private JwtDecoderProviderConfigurationUtils() { |
82 | 83 | } |
83 | 84 |
|
84 | 85 | static Map<String, Object> getConfigurationForOidcIssuerLocation(String oidcIssuerLocation) { |
85 | | - return getConfiguration(oidcIssuerLocation, rest, oidc(URI.create(oidcIssuerLocation))); |
| 86 | + UriComponents uri = UriComponentsBuilder.fromUriString(oidcIssuerLocation).build(); |
| 87 | + return getConfiguration(oidcIssuerLocation, rest, oidc(uri)); |
86 | 88 | } |
87 | 89 |
|
88 | 90 | static Map<String, Object> getConfigurationForIssuerLocation(String issuer, RestOperations rest) { |
89 | | - URI uri = URI.create(issuer); |
| 91 | + UriComponents uri = UriComponentsBuilder.fromUriString(issuer).build(); |
90 | 92 | return getConfiguration(issuer, rest, oidc(uri), oidcRfc8414(uri), oauth(uri)); |
91 | 93 | } |
92 | 94 |
|
@@ -183,25 +185,25 @@ private static Map<String, Object> getConfiguration(String issuer, RestOperation |
183 | 185 | throw new IllegalArgumentException(errorMessage); |
184 | 186 | } |
185 | 187 |
|
186 | | - private static URI oidc(URI issuer) { |
| 188 | + private static URI oidc(UriComponents issuer) { |
187 | 189 | // @formatter:off |
188 | | - return UriComponentsBuilder.fromUri(issuer) |
| 190 | + return UriComponentsBuilder.newInstance().uriComponents(issuer) |
189 | 191 | .replacePath(issuer.getPath() + OIDC_METADATA_PATH) |
190 | 192 | .build(Collections.emptyMap()); |
191 | 193 | // @formatter:on |
192 | 194 | } |
193 | 195 |
|
194 | | - private static URI oidcRfc8414(URI issuer) { |
| 196 | + private static URI oidcRfc8414(UriComponents issuer) { |
195 | 197 | // @formatter:off |
196 | | - return UriComponentsBuilder.fromUri(issuer) |
| 198 | + return UriComponentsBuilder.newInstance().uriComponents(issuer) |
197 | 199 | .replacePath(OIDC_METADATA_PATH + issuer.getPath()) |
198 | 200 | .build(Collections.emptyMap()); |
199 | 201 | // @formatter:on |
200 | 202 | } |
201 | 203 |
|
202 | | - private static URI oauth(URI issuer) { |
| 204 | + private static URI oauth(UriComponents issuer) { |
203 | 205 | // @formatter:off |
204 | | - return UriComponentsBuilder.fromUri(issuer) |
| 206 | + return UriComponentsBuilder.newInstance().uriComponents(issuer) |
205 | 207 | .replacePath(OAUTH_METADATA_PATH + issuer.getPath()) |
206 | 208 | .build(Collections.emptyMap()); |
207 | 209 | // @formatter:on |
|
0 commit comments