From 481bc295f6963dacfd9873014ae57daee6beb77d Mon Sep 17 00:00:00 2001 From: kohsuke Date: Sat, 1 Dec 2007 15:40:16 +0000 Subject: [PATCH] Moved Sid constants to the contract class. git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@6161 71c3de6d-444a-0410-be80-ed276b4c234a --- core/src/main/java/hudson/security/ACL.java | 24 +++++++++++++++++++++ 1 file changed, 24 insertions(+) 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"); }