mirror of
https://github.com/spring-projects/spring-security.git
synced 2025-11-10 19:48:50 +00:00
Polish SimpleGrantedAuthority
1. Add Javadoc to state that role is prefixed. 2. Rename constructor argument from `role` to `authority` for better readability. Signed-off-by: Yanming Zhou <zhouyanming@gmail.com>
This commit is contained in:
parent
0927bed66a
commit
b55c28cf25
@ -27,16 +27,22 @@ import org.springframework.util.Assert;
|
|||||||
* {@link org.springframework.security.core.Authentication Authentication} object.
|
* {@link org.springframework.security.core.Authentication Authentication} object.
|
||||||
*
|
*
|
||||||
* @author Luke Taylor
|
* @author Luke Taylor
|
||||||
|
* @author Yanming Zhou
|
||||||
*/
|
*/
|
||||||
public final class SimpleGrantedAuthority implements GrantedAuthority {
|
public final class SimpleGrantedAuthority implements GrantedAuthority {
|
||||||
|
|
||||||
private static final long serialVersionUID = 620L;
|
private static final long serialVersionUID = 620L;
|
||||||
|
|
||||||
|
// CAUTION renaming to authority will break serialization compatibility
|
||||||
private final String role;
|
private final String role;
|
||||||
|
|
||||||
public SimpleGrantedAuthority(String role) {
|
/**
|
||||||
Assert.hasText(role, "A granted authority textual representation is required");
|
* Constructs a {@code SimpleGrantedAuthority} using the provided authority.
|
||||||
this.role = role;
|
* @param authority The provided authority such as prefixed role
|
||||||
|
*/
|
||||||
|
public SimpleGrantedAuthority(String authority) {
|
||||||
|
Assert.hasText(authority, "A granted authority textual representation is required");
|
||||||
|
this.role = authority;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user