|
60 | 60 | import org.springframework.security.config.test.SpringTestContextExtension; |
61 | 61 | import org.springframework.security.core.Authentication; |
62 | 62 | import org.springframework.security.core.GrantedAuthority; |
| 63 | +import org.springframework.security.core.authority.FactorGrantedAuthority; |
63 | 64 | import org.springframework.security.core.session.SessionRegistry; |
64 | 65 | import org.springframework.security.core.session.SessionRegistryImpl; |
65 | 66 | import org.springframework.security.crypto.password.NoOpPasswordEncoder; |
@@ -210,7 +211,8 @@ public void requestWhenAuthenticationRequestThenTokenResponseIncludesIdToken() t |
210 | 211 | registeredClient); |
211 | 212 | MvcResult mvcResult = this.mvc |
212 | 213 | .perform(get(DEFAULT_AUTHORIZATION_ENDPOINT_URI).queryParams(authorizationRequestParameters) |
213 | | - .with(user("user").roles("A", "B"))) |
| 214 | + .with(user("user").roles("A", "B") |
| 215 | + .authorities(FactorGrantedAuthority.fromAuthority(FactorGrantedAuthority.PASSWORD_AUTHORITY)))) |
214 | 216 | .andExpect(status().is3xxRedirection()) |
215 | 217 | .andReturn(); |
216 | 218 | String redirectedUrl = mvcResult.getResponse().getRedirectedUrl(); |
@@ -270,7 +272,8 @@ public void requestWhenRefreshTokenRequestThenIdTokenContainsSidClaim() throws E |
270 | 272 | registeredClient); |
271 | 273 | MvcResult mvcResult = this.mvc |
272 | 274 | .perform(get(DEFAULT_AUTHORIZATION_ENDPOINT_URI).queryParams(authorizationRequestParameters) |
273 | | - .with(user("user").roles("A", "B"))) |
| 275 | + .with(user("user").roles("A", "B") |
| 276 | + .authorities(FactorGrantedAuthority.fromAuthority(FactorGrantedAuthority.PASSWORD_AUTHORITY)))) |
274 | 277 | .andExpect(status().is3xxRedirection()) |
275 | 278 | .andReturn(); |
276 | 279 | String redirectedUrl = mvcResult.getResponse().getRedirectedUrl(); |
@@ -335,7 +338,8 @@ public void requestWhenLogoutRequestThenLogout() throws Exception { |
335 | 338 | registeredClient); |
336 | 339 | MvcResult mvcResult = this.mvc |
337 | 340 | .perform(get(issuer.concat(DEFAULT_AUTHORIZATION_ENDPOINT_URI)).queryParams(authorizationRequestParameters) |
338 | | - .with(user("user"))) |
| 341 | + .with(user("user") |
| 342 | + .authorities(FactorGrantedAuthority.fromAuthority(FactorGrantedAuthority.PASSWORD_AUTHORITY)))) |
339 | 343 | .andExpect(status().is3xxRedirection()) |
340 | 344 | .andReturn(); |
341 | 345 |
|
@@ -388,7 +392,8 @@ public void requestWhenLogoutRequestWithOtherUsersIdTokenThenNotLogout() throws |
388 | 392 | registeredClient1); |
389 | 393 | MvcResult mvcResult = this.mvc |
390 | 394 | .perform(get(DEFAULT_AUTHORIZATION_ENDPOINT_URI).queryParams(authorizationRequestParameters) |
391 | | - .with(user("user1"))) |
| 395 | + .with(user("user1") |
| 396 | + .authorities(FactorGrantedAuthority.fromAuthority(FactorGrantedAuthority.PASSWORD_AUTHORITY)))) |
392 | 397 | .andExpect(status().is3xxRedirection()) |
393 | 398 | .andReturn(); |
394 | 399 |
|
@@ -424,7 +429,8 @@ public void requestWhenLogoutRequestWithOtherUsersIdTokenThenNotLogout() throws |
424 | 429 | authorizationRequestParameters = getAuthorizationRequestParameters(registeredClient2); |
425 | 430 | mvcResult = this.mvc |
426 | 431 | .perform(get(DEFAULT_AUTHORIZATION_ENDPOINT_URI).queryParams(authorizationRequestParameters) |
427 | | - .with(user("user2"))) |
| 432 | + .with(user("user2") |
| 433 | + .authorities(FactorGrantedAuthority.fromAuthority(FactorGrantedAuthority.PASSWORD_AUTHORITY)))) |
428 | 434 | .andExpect(status().is3xxRedirection()) |
429 | 435 | .andReturn(); |
430 | 436 |
|
@@ -497,7 +503,8 @@ public void requestWhenAuthenticationRequestWithOfflineAccessScopeThenTokenRespo |
497 | 503 | registeredClient); |
498 | 504 | MvcResult mvcResult = this.mvc |
499 | 505 | .perform(get(DEFAULT_AUTHORIZATION_ENDPOINT_URI).queryParams(authorizationRequestParameters) |
500 | | - .with(user("user"))) |
| 506 | + .with(user("user") |
| 507 | + .authorities(FactorGrantedAuthority.fromAuthority(FactorGrantedAuthority.PASSWORD_AUTHORITY)))) |
501 | 508 | .andExpect(status().is3xxRedirection()) |
502 | 509 | .andReturn(); |
503 | 510 | String redirectedUrl = mvcResult.getResponse().getRedirectedUrl(); |
@@ -537,7 +544,8 @@ public void requestWhenAuthenticationRequestWithoutOfflineAccessScopeThenTokenRe |
537 | 544 | registeredClient); |
538 | 545 | MvcResult mvcResult = this.mvc |
539 | 546 | .perform(get(DEFAULT_AUTHORIZATION_ENDPOINT_URI).queryParams(authorizationRequestParameters) |
540 | | - .with(user("user"))) |
| 547 | + .with(user("user") |
| 548 | + .authorities(FactorGrantedAuthority.fromAuthority(FactorGrantedAuthority.PASSWORD_AUTHORITY)))) |
541 | 549 | .andExpect(status().is3xxRedirection()) |
542 | 550 | .andReturn(); |
543 | 551 | String redirectedUrl = mvcResult.getResponse().getRedirectedUrl(); |
|
0 commit comments