瀏覽代碼

Polish JavaDoc

1. Removed comment about not changing field name in a
serialized object as this is true for all fields in a
Java-serialize POJO
2. Added example value for the constructor that demonstrates
the relationship between a role and an authority

Signed-off-by: Josh Cummings <3627351+jzheaux@users.noreply.github.com>
Josh Cummings 1 月之前
父節點
當前提交
eb43830260

+ 2 - 2
core/src/main/java/org/springframework/security/core/authority/SimpleGrantedAuthority.java

@@ -33,12 +33,12 @@ 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;
 
 
 	/**
 	/**
 	 * Constructs a {@code SimpleGrantedAuthority} using the provided authority.
 	 * Constructs a {@code SimpleGrantedAuthority} using the provided authority.
-	 * @param authority The provided authority such as prefixed role
+	 * @param authority The provided authority, including any prefix; for example,
+	 * {@code ROLE_ADMIN}
 	 */
 	 */
 	public SimpleGrantedAuthority(String authority) {
 	public SimpleGrantedAuthority(String authority) {
 		Assert.hasText(authority, "A granted authority textual representation is required");
 		Assert.hasText(authority, "A granted authority textual representation is required");