|
65 | 65 | @AttachClaims(value = { |
66 | 66 | @Claim(name = "user_id", value = "6", type = Long.class), |
67 | 67 | @Claim(name = "role_id", value = "1"), |
68 | | - @Claim(name = "is_social_user", value = "false") |
69 | | -}, claims = {"role_name:ADMIN", "user_name=ahunigel"}) |
| 68 | + @Claim(name = "is_social_user", value = "false")}, |
| 69 | + claims = { "email:[email protected]", "user_name=ahunigel"} |
| 70 | +) |
70 | 71 | @WithMockUser() |
71 | 72 | ``` |
72 | 73 | or |
|
76 | 77 | @Claim(name = "user_id", value = "6", type = Long.class), |
77 | 78 | @Claim(name = "role_id", value = "1"), |
78 | 79 | @Claim(name = "is_social_user", value = "false")}, |
79 | | - claims = {"role_name:ADMIN", "user_name=ahunigel"}) |
| 80 | + claims = { "email:[email protected]", "user_name=ahunigel"} |
| 81 | + ) |
80 | 82 | ) |
81 | 83 | ``` |
82 | 84 |
|
| 85 | +## References |
| 86 | +- [How to get @WebMvcTest work with OAuth?](https://stackoverflow.com/questions/48540152/how-to-get-webmvctest-work-with-oauth) |
| 87 | +- [Faking OAuth2 Single Sign-on in Spring](http://engineering.pivotal.io/post/faking_oauth_sso/) |
| 88 | +- [@WithSecurityContext](https://docs.spring.io/spring-security/site/docs/current/reference/html/test-method.html#test-method-withsecuritycontext) |
| 89 | +- [Spring MVC Test Integration](https://docs.spring.io/spring-security/site/docs/current/reference/html/test-mockmvc.html) |
| 90 | +- [OAuth2 Autoconfig](https://docs.spring.io/spring-security-oauth2-boot/docs/current/reference/htmlsingle/) |
| 91 | +- [Retrieve User Information in Spring Security](https://www.baeldung.com/get-user-in-spring-security) |
| 92 | + |
83 | 93 | ## TODOs |
84 | 94 |
|
85 | 95 | - For oauth2 request, add ability to set ResourceServerSecurityConfigurer.stateless to false, maybe add an |
|
0 commit comments