Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add oauth2Login MockMvc Test Support #7789

Closed
jzheaux opened this issue Jan 7, 2020 · 0 comments
Closed

Add oauth2Login MockMvc Test Support #7789

jzheaux opened this issue Jan 7, 2020 · 0 comments
Assignees
Milestone

Comments

@jzheaux
Copy link
Contributor

@jzheaux jzheaux commented Jan 7, 2020

Related to #7618

When testing applications that use OAuth 2.0 Login, it would be nice to have MockMvc support like:

this.mvc(get("/")
    .with(oauth2Login()));

or

this.mvc(get("/")
    .with(oauth2Login()
        .attribute("name", "value")
        .authorities(new SimpleGrantedAuthority("SCOPE_read")));

as well as other builder methods relative to generating an authentication statement around an OAuth2User principal.

Note that the attribute method is necessary since the OAuth 2.0 spec doesn't specify any particular claims. It, then, correlates to the idToken and userInfo methods in the oidcLogin() MockMvc support.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant
You can’t perform that action at this time.