mirror of
https://github.com/jenkinsci/jenkins.git
synced 2026-11-06 08:36:01 +00:00
added a convenience method.
git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@6328 71c3de6d-444a-0410-be80-ed276b4c234a
This commit is contained in:
1 parent
03d6a8e425
commit
4e5d783914
2 files changed
+18
-2
No files matched your search
@@ -32,6 +32,7 @@ import org.kohsuke.stapler.Ancestor;
|
||||
import org.kohsuke.stapler.Stapler;
|
||||
import org.kohsuke.stapler.StaplerRequest;
|
||||
import org.kohsuke.stapler.StaplerResponse;
|
||||
import org.acegisecurity.providers.anonymous.AnonymousAuthenticationToken;
|
||||
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.Cookie;
|
||||
@@ -723,4 +724,11 @@ public class Functions {
|
||||
}
|
||||
|
||||
private static final Pattern LINE_END = Pattern.compile("\r?\n");
|
||||
|
||||
/**
|
||||
* Checks if the current user is anonymous.
|
||||
*/
|
||||
public static boolean isAnonymous() {
|
||||
return Hudson.getAuthentication() instanceof AnonymousAuthenticationToken;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user