diff --git a/core/src/main/java/hudson/security/ACL.java b/core/src/main/java/hudson/security/ACL.java index 84679ca06a..eec4decaf7 100644 --- a/core/src/main/java/hudson/security/ACL.java +++ b/core/src/main/java/hudson/security/ACL.java @@ -2,6 +2,8 @@ package hudson.security; import org.acegisecurity.AccessDeniedException; import org.acegisecurity.Authentication; +import org.acegisecurity.acls.sid.PrincipalSid; +import org.acegisecurity.acls.sid.Sid; import org.acegisecurity.context.SecurityContextHolder; /** @@ -30,4 +32,26 @@ public abstract class ACL { * Checks if the given principle has the given permission. */ public abstract boolean hasPermission(Authentication a, Permission permission); + + // + // Sid constants + // + + /** + * Special {@link Sid} that represents "everyone", even including anonymous users. + * + *
+ * This doesn't need to be included in {@link Authentication#getAuthorities()}, + * but {@link ACL} is responsible for checking it nontheless, as if it was the + * last entry in the granted authority. + */ + public static final Sid EVERYONE = new Sid() {}; + + /** + * {@link Sid} that represents the anonymous unauthenticated users. + *
+ * {@link HudsonFilter} sets this up, so this sid remains the same + * regardless of the current {@link SecurityRealm} in use. + */ + public static final Sid ANONYMOUS = new PrincipalSid("anonymous"); }