Package hudson.plugins.collabnet.auth
Class CNFilter
- java.lang.Object
-
- hudson.plugins.collabnet.auth.CNFilter
-
- All Implemented Interfaces:
javax.servlet.Filter
public class CNFilter extends Object implements javax.servlet.Filter
Class for filtering CollabNet auth information for SSO.
-
-
Constructor Summary
Constructors Constructor Description CNFilter()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
destroy()
void
doFilter(javax.servlet.ServletRequest request, javax.servlet.ServletResponse response, javax.servlet.FilterChain chain)
Filter for the CollabNet plugin.static String
getCurrentBaseUrl(javax.servlet.http.HttpServletRequest req)
static String
getCurrentUrl(javax.servlet.http.HttpServletRequest req)
void
init(javax.servlet.FilterConfig filterConfig)
-
-
-
Method Detail
-
init
public void init(javax.servlet.FilterConfig filterConfig)
- Specified by:
init
in interfacejavax.servlet.Filter
-
doFilter
public void doFilter(javax.servlet.ServletRequest request, javax.servlet.ServletResponse response, javax.servlet.FilterChain chain) throws IOException, javax.servlet.ServletException
Filter for the CollabNet plugin. Handles 2 separate tasks: 1. Attempts to use CollabNet tokens to login (if they are present and we're not currently authed.). 2. If we have not yet logged into the CollabNet server, redirect to the CollabNet server and login.- Specified by:
doFilter
in interfacejavax.servlet.Filter
- Parameters:
request
- the servlet requestresponse
- the servlet responsechain
- remaining filters to handle.- Throws:
IOException
javax.servlet.ServletException
-
getCurrentBaseUrl
public static String getCurrentBaseUrl(javax.servlet.http.HttpServletRequest req)
- Parameters:
req
- the servlet request to pull data from, if root url is unset.- Returns:
- the best guess for the current base URL (i.e. just the scheme, server, port) plus the contextPath.
-
getCurrentUrl
public static String getCurrentUrl(javax.servlet.http.HttpServletRequest req)
- Returns:
- the best guess for the current full URL. It will use the "referer" field from the request to determine the url, if it is present.
-
destroy
public void destroy()
- Specified by:
destroy
in interfacejavax.servlet.Filter
-
-