|
1 | 1 | /*
|
2 |
| - * Copyright 2002-2021 the original author or authors. |
| 2 | + * Copyright 2002-2022 the original author or authors. |
3 | 3 | *
|
4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License");
|
5 | 5 | * you may not use this file except in compliance with the License.
|
@@ -191,83 +191,6 @@ private void configureJwtClientAuthenticationConverter(Function<ClientRegistrati
|
191 | 191 | this.tokenResponseClient.addParametersConverter(jwtClientAuthenticationConverter);
|
192 | 192 | }
|
193 | 193 |
|
194 |
| - // @Test |
195 |
| - // public void |
196 |
| - // getTokenResponseWhenRedirectUriMalformedThenThrowIllegalArgumentException() throws |
197 |
| - // Exception { |
198 |
| - // this.exception.expect(IllegalArgumentException.class); |
199 |
| - // |
200 |
| - // String redirectUri = "http:\\example.com"; |
201 |
| - // when(this.clientRegistration.getRedirectUri()).thenReturn(redirectUri); |
202 |
| - // |
203 |
| - // this.tokenResponseClient.getTokenResponse( |
204 |
| - // new OAuth2AuthorizationCodeGrantRequest(this.clientRegistration, |
205 |
| - // this.authorizationExchange)); |
206 |
| - // } |
207 |
| - // |
208 |
| - // @Test |
209 |
| - // public void |
210 |
| - // getTokenResponseWhenTokenUriMalformedThenThrowIllegalArgumentException() throws |
211 |
| - // Exception { |
212 |
| - // this.exception.expect(IllegalArgumentException.class); |
213 |
| - // |
214 |
| - // String tokenUri = "http:\\provider.com\\oauth2\\token"; |
215 |
| - // when(this.providerDetails.getTokenUri()).thenReturn(tokenUri); |
216 |
| - // |
217 |
| - // this.tokenResponseClient.getTokenResponse( |
218 |
| - // new OAuth2AuthorizationCodeGrantRequest(this.clientRegistration, |
219 |
| - // this.authorizationExchange)); |
220 |
| - // } |
221 |
| - // |
222 |
| - // @Test |
223 |
| - // public void |
224 |
| - // getTokenResponseWhenSuccessResponseInvalidThenThrowOAuth2AuthorizationException() |
225 |
| - // throws Exception { |
226 |
| - // this.exception.expect(OAuth2AuthorizationException.class); |
227 |
| - // this.exception.expectMessage(containsString("invalid_token_response")); |
228 |
| - // |
229 |
| - // MockWebServer server = new MockWebServer(); |
230 |
| - // |
231 |
| - // String accessTokenSuccessResponse = "{\n" + |
232 |
| - // " \"access_token\": \"access-token-1234\",\n" + |
233 |
| - // " \"token_type\": \"bearer\",\n" + |
234 |
| - // " \"expires_in\": \"3600\",\n" + |
235 |
| - // " \"scope\": \"openid profile\",\n" + |
236 |
| - // " \"custom_parameter_1\": \"custom-value-1\",\n" + |
237 |
| - // " \"custom_parameter_2\": \"custom-value-2\"\n"; |
238 |
| - // // "}\n"; // Make the JSON invalid/malformed |
239 |
| - // |
240 |
| - // server.enqueue(new MockResponse() |
241 |
| - // .setHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE) |
242 |
| - // .setBody(accessTokenSuccessResponse)); |
243 |
| - // server.start(); |
244 |
| - // |
245 |
| - // String tokenUri = server.url("/oauth2/token").toString(); |
246 |
| - // when(this.providerDetails.getTokenUri()).thenReturn(tokenUri); |
247 |
| - // |
248 |
| - // try { |
249 |
| - // this.tokenResponseClient.getTokenResponse( |
250 |
| - // new OAuth2AuthorizationCodeGrantRequest(this.clientRegistration, |
251 |
| - // this.authorizationExchange)); |
252 |
| - // } finally { |
253 |
| - // server.shutdown(); |
254 |
| - // } |
255 |
| - // } |
256 |
| - // |
257 |
| - // @Test |
258 |
| - // public void |
259 |
| - // getTokenResponseWhenTokenUriInvalidThenThrowAuthenticationServiceException() throws |
260 |
| - // Exception { |
261 |
| - // this.exception.expect(AuthenticationServiceException.class); |
262 |
| - // |
263 |
| - // String tokenUri = "https://invalid-provider.com/oauth2/token"; |
264 |
| - // when(this.providerDetails.getTokenUri()).thenReturn(tokenUri); |
265 |
| - // |
266 |
| - // this.tokenResponseClient.getTokenResponse( |
267 |
| - // new OAuth2AuthorizationCodeGrantRequest(this.clientRegistration, |
268 |
| - // this.authorizationExchange)); |
269 |
| - // } |
270 |
| - // |
271 | 194 | @Test
|
272 | 195 | public void getTokenResponseWhenErrorResponseThenThrowOAuth2AuthorizationException() {
|
273 | 196 | String accessTokenErrorResponse = "{\n" + " \"error\": \"unauthorized_client\"\n" + "}\n";
|
|
0 commit comments