com.atlassian.jira.web.filters
Class JiraLoginFilter

java.lang.Object
  extended by com.atlassian.jira.web.filters.JiraLoginFilter
All Implemented Interfaces:
javax.servlet.Filter

public class JiraLoginFilter
extends Object
implements javax.servlet.Filter

This Filter implementation is a composite of the Seraph provided LoginFilter and HttpAuthFilter, which will allow HTTP basic Auth and os_username based login.

It can be derived because of the fragile base class pattern in Java but really it because Serpah was never designed to be extended and has package protected classes and other shenanigans that prevent proper derivation. Buts that ok, because this pattern is more unit testable and less fragile! Long live interfaces!

Also as it turns out this class is logically the same as having a HttpAuthFilter follow a LoginFilter in the web.xml. But by making a composite we dont have to rely on one failign to work followed by one working. Instead we make a decision as to which one to call and thn invoke it.

And if we change the login rules in the future, we are in a better position this way in terms of coupling and encapsulation.


Constructor Summary
JiraLoginFilter()
          This is the production constructor that will be called by the servlet container.
 
Method Summary
 void destroy()
          Delegates the filter destroy to both filters.
 void doFilter(javax.servlet.ServletRequest servletRequest, javax.servlet.ServletResponse servletResponse, javax.servlet.FilterChain filterChain)
           
 void init(javax.servlet.FilterConfig filterConfig)
          Delegates the initialisation to both filters.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JiraLoginFilter

public JiraLoginFilter()
This is the production constructor that will be called by the servlet container. It is the one that sets up the LoginFilter and HttpAuthFilter

Method Detail

doFilter

public void doFilter(javax.servlet.ServletRequest servletRequest,
                     javax.servlet.ServletResponse servletResponse,
                     javax.servlet.FilterChain filterChain)
              throws IOException,
                     javax.servlet.ServletException
Specified by:
doFilter in interface javax.servlet.Filter
Throws:
IOException
javax.servlet.ServletException

init

public void init(javax.servlet.FilterConfig filterConfig)
          throws javax.servlet.ServletException
Delegates the initialisation to both filters.

Specified by:
init in interface javax.servlet.Filter
Parameters:
filterConfig - the servlet filter config in play
Throws:
javax.servlet.ServletException - if stuff goes wrong

destroy

public void destroy()
Delegates the filter destroy to both filters.

Specified by:
destroy in interface javax.servlet.Filter


Copyright © 2002-2013 Atlassian. All Rights Reserved.