Skip to content

Fix HttpSecurity jee() Javadoc example for mappableRoles #6958

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

Closed
eleftherias opened this issue Jun 5, 2019 · 0 comments · Fixed by #6959
Closed

Fix HttpSecurity jee() Javadoc example for mappableRoles #6958

eleftherias opened this issue Jun 5, 2019 · 0 comments · Fixed by #6959
Assignees
Labels
in: docs An issue in Documentation or samples type: bug A general bug
Milestone

Comments

@eleftherias
Copy link
Contributor

Summary

The example configuration in the Javadoc for the jee() method in HttpSecurity incorrectly demonstrates that the parameters for mappableRoles() are prefixed with "ROLE_".

The method implementation of mappableRoles() adds the prefix "ROLE_" to any parameter, therefore if a user were to use the demonstrated configuration, then the list of mappableRoles would be ["ROLE_ROLE_USER", "ROLE_ROLE_ADMIN"].

Actual Behavior

The Javadoc states that mappableRoles are configured as follows:

@Override
protected void configure(HttpSecurity http) throws Exception {
        http.authorizeRequests().antMatchers("/**").hasRole("USER").and()
        // Example jee() configuration
                        .jee().mappableRoles("ROLE_USER", "ROLE_ADMIN");
}

Expected Behavior

The Javadoc should provide the following example configuration:

@Override
protected void configure(HttpSecurity http) throws Exception {
        http.authorizeRequests().antMatchers("/**").hasRole("USER").and()
        // Example jee() configuration
                        .jee().mappableRoles("USER", "ADMIN");
 }
@eleftherias eleftherias added the in: docs An issue in Documentation or samples label Jun 5, 2019
@eleftherias eleftherias self-assigned this Jun 5, 2019
eleftherias added a commit to eleftherias/spring-security that referenced this issue Jun 5, 2019
@rwinch rwinch added the type: bug A general bug label Jun 7, 2019
@rwinch rwinch added this to the 5.2.0.M3 milestone Jun 7, 2019
rwinch pushed a commit that referenced this issue Jun 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: docs An issue in Documentation or samples type: bug A general bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants