Package org.jivesoftware.admin
Class AuthCheckFilter
- java.lang.Object
-
- org.jivesoftware.admin.AuthCheckFilter
-
- All Implemented Interfaces:
javax.servlet.Filter
public class AuthCheckFilter extends Object implements javax.servlet.Filter
A simple filter which checks for the auth token in the user's session. If it's not there the filter will redirect to the login page.
-
-
Field Summary
Fields Modifier and Type Field Description static SystemProperty<Class>
SERVLET_REQUEST_AUTHENTICATOR
-
Constructor Summary
Constructors Constructor Description AuthCheckFilter()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static void
addExclude(String exclude)
Adds a new string that when present in the requested URL will skip the "is logged" checking.void
destroy()
void
doFilter(javax.servlet.ServletRequest req, javax.servlet.ServletResponse res, javax.servlet.FilterChain chain)
static AuthCheckFilter
getInstance()
Returns a singleton instance of the AuthCheckFilter.void
init(javax.servlet.FilterConfig config)
static boolean
isServletRequestAuthenticatorInstanceOf(Class<? extends ServletRequestAuthenticator> clazz)
Indicates if the currently-installed ServletRequestAuthenticator is an instance of a specific class.static void
removeExclude(String exclude)
Removes a string that when present in the requested URL will skip the "is logged" checking.static boolean
testURLPassesExclude(String url, String exclude)
Returns true if a URL passes an exclude rule.
-
-
-
Field Detail
-
SERVLET_REQUEST_AUTHENTICATOR
public static final SystemProperty<Class> SERVLET_REQUEST_AUTHENTICATOR
-
-
Method Detail
-
getInstance
public static AuthCheckFilter getInstance()
Returns a singleton instance of the AuthCheckFilter.- Returns:
- an instance.
-
isServletRequestAuthenticatorInstanceOf
public static boolean isServletRequestAuthenticatorInstanceOf(Class<? extends ServletRequestAuthenticator> clazz)
Indicates if the currently-installed ServletRequestAuthenticator is an instance of a specific class.- Parameters:
clazz
- the class to check- Returns:
true
if the currently-installed ServletRequestAuthenticator is an instance of clazz, otherwisefalse
.
-
addExclude
public static void addExclude(String exclude)
Adds a new string that when present in the requested URL will skip the "is logged" checking.- Parameters:
exclude
- the string to exclude.
-
removeExclude
public static void removeExclude(String exclude)
Removes a string that when present in the requested URL will skip the "is logged" checking.- Parameters:
exclude
- the string that was being excluded.
-
testURLPassesExclude
public static boolean testURLPassesExclude(String url, String exclude)
Returns true if a URL passes an exclude rule.- Parameters:
url
- the URL to test.exclude
- the exclude rule.- Returns:
- true if the URL passes the exclude test.
-
init
public void init(javax.servlet.FilterConfig config) throws javax.servlet.ServletException
- Specified by:
init
in interfacejavax.servlet.Filter
- Throws:
javax.servlet.ServletException
-
doFilter
public void doFilter(javax.servlet.ServletRequest req, javax.servlet.ServletResponse res, javax.servlet.FilterChain chain) throws IOException, javax.servlet.ServletException
- Specified by:
doFilter
in interfacejavax.servlet.Filter
- Throws:
IOException
javax.servlet.ServletException
-
destroy
public void destroy()
- Specified by:
destroy
in interfacejavax.servlet.Filter
-
-