org.opennms.web.acegisecurity
Class NtlmAuthenticationProcessingFilter

java.lang.Object
  extended by org.acegisecurity.providers.ldap.authenticator.AbstractLdapAuthenticator
      extended by org.acegisecurity.providers.ldap.authenticator.BindAuthenticator
          extended by org.opennms.web.acegisecurity.NtlmAuthenticationProcessingFilter
All Implemented Interfaces:
Filter, org.acegisecurity.providers.ldap.LdapAuthenticator, org.springframework.beans.factory.InitializingBean, org.springframework.context.ApplicationEventPublisherAware, org.springframework.context.MessageSourceAware

public class NtlmAuthenticationProcessingFilter
extends org.acegisecurity.providers.ldap.authenticator.BindAuthenticator
implements Filter, org.springframework.beans.factory.InitializingBean, org.springframework.context.ApplicationEventPublisherAware, org.springframework.context.MessageSourceAware

Processes an authentication form.

Login forms must present two parameters to this filter: a username and password. The parameter names to use are contained in the static fields #ACEGI_SECURITY_FORM_USERNAME_KEY and #ACEGI_SECURITY_FORM_PASSWORD_KEY.

Do not use this class directly. Instead configure web.xml to use the org.acegisecurity.util.FilterToBeanProxy.

Version:
$Id: AuthenticationProcessingFilter.java 1496 2006-05-23 13:38:33 +0000 (Tue, 23 May 2006) benalex $
Author:
Ben Alex, Colin Sampaleanu

Field Summary
protected  org.acegisecurity.ui.AuthenticationDetailsSource authenticationDetailsSource
           
protected  org.springframework.context.ApplicationEventPublisher eventPublisher
           
protected  org.springframework.context.support.MessageSourceAccessor messages
           
protected  List<String> skipNtlmAuthUrls
           
 
Constructor Summary
NtlmAuthenticationProcessingFilter(org.acegisecurity.ldap.InitialDirContextFactory initialDirContextFactory)
           
 
Method Summary
 void afterPropertiesSet()
           
 org.acegisecurity.Authentication attemptAuthentication(ServletRequest request, ServletResponse response, FilterChain chain)
          This method simply calls negotiate( req, resp, false ) and then chain.doFilter.
 void destroy()
          Does nothing.
protected  String determineTargetUrl(HttpServletRequest request)
           
 void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
           
 org.acegisecurity.ui.AuthenticationDetailsSource getAuthenticationDetailsSource()
           
 String getDefaultDomain()
           
 String getDefaultTargetUrl()
          Supplies the default target Url that will be used if no saved request is found or the alwaysUseDefaultTargetUrl propert is set to true.
 String getDomainController()
           
 Properties getExceptionMappings()
           
 org.acegisecurity.providers.ldap.LdapAuthoritiesPopulator getLdapAuthoritiesPopulator()
           
 Properties getProperties()
           
 String getRealm()
           
 org.acegisecurity.ui.rememberme.RememberMeServices getRememberMeServices()
           
 List<String> getSkipNtlmAuthUrls()
           
 void init(FilterConfig arg0)
          Does JCIFS Initialization.
 boolean isAlwaysUseDefaultTargetUrl()
           
 boolean isEnableBasic()
           
 boolean isInsecureBasic()
           
 boolean isLoadBalance()
           
protected  jcifs.smb.NtlmPasswordAuthentication negotiate(HttpServletRequest req, HttpServletResponse resp, boolean skipAuthentication)
          Negotiate password hashes with MSIE clients using NTLM SSP
protected  void onPreAuthentication(HttpServletRequest request, HttpServletResponse response)
           
protected  void onSuccessfulAuthentication(HttpServletRequest request, HttpServletResponse response, org.acegisecurity.Authentication authResult)
           
protected  void onUnsuccessfulAuthentication(HttpServletRequest request, HttpServletResponse response, org.acegisecurity.AuthenticationException failed)
           
 void setAlwaysUseDefaultTargetUrl(boolean alwaysUseDefaultTargetUrl)
           
 void setApplicationEventPublisher(org.springframework.context.ApplicationEventPublisher eventPublisher)
           
 void setAuthenticationDetailsSource(org.acegisecurity.ui.AuthenticationDetailsSource authenticationDetailsSource)
           
 void setDefaultDomain(String defaultDomain)
           
 void setDefaultTargetUrl(String defaultTargetUrl)
           
protected  void setDetails(HttpServletRequest request, org.acegisecurity.providers.UsernamePasswordAuthenticationToken authRequest)
          Provided so that subclasses may configure what is put into the authentication request's details property.
 void setDomainController(String domainController)
           
 void setEnableBasic(boolean enableBasic)
           
 void setExceptionMappings(Properties exceptionMappings)
           
 void setInsecureBasic(boolean insecureBasic)
           
 void setLdapAuthoritiesPopulator(org.acegisecurity.providers.ldap.LdapAuthoritiesPopulator ldapAuthoritiesPopulator)
           
 void setLoadBalance(boolean loadBalance)
           
 void setMessageSource(org.springframework.context.MessageSource messageSource)
           
 void setProperties(Properties properties)
           
 void setRealm(String realm)
           
 void setRememberMeServices(org.acegisecurity.ui.rememberme.RememberMeServices rememberMeServices)
           
 void setSkipNtlmAuthUrls(List<String> skipNtlmAuthUrls)
           
protected  void successfulAuthentication(HttpServletRequest request, HttpServletResponse response, org.acegisecurity.Authentication authResult)
           
protected  void unsuccessfulAuthentication(HttpServletRequest request, HttpServletResponse response, org.acegisecurity.AuthenticationException failed)
           
 
Methods inherited from class org.acegisecurity.providers.ldap.authenticator.BindAuthenticator
authenticate
 
Methods inherited from class org.acegisecurity.providers.ldap.authenticator.AbstractLdapAuthenticator
getInitialDirContextFactory, getUserAttributes, getUserDetailsMapper, getUserDns, getUserSearch, setUserAttributes, setUserDetailsMapper, setUserDnPatterns, setUserSearch
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

eventPublisher

protected org.springframework.context.ApplicationEventPublisher eventPublisher

authenticationDetailsSource

protected org.acegisecurity.ui.AuthenticationDetailsSource authenticationDetailsSource

messages

protected org.springframework.context.support.MessageSourceAccessor messages

skipNtlmAuthUrls

protected List<String> skipNtlmAuthUrls
Constructor Detail

NtlmAuthenticationProcessingFilter

public NtlmAuthenticationProcessingFilter(org.acegisecurity.ldap.InitialDirContextFactory initialDirContextFactory)
Method Detail

afterPropertiesSet

public void afterPropertiesSet()
                        throws Exception
Specified by:
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
Overrides:
afterPropertiesSet in class org.acegisecurity.providers.ldap.authenticator.AbstractLdapAuthenticator
Throws:
Exception

destroy

public void destroy()
Does nothing. We use IoC container lifecycle services instead.

Specified by:
destroy in interface Filter

doFilter

public void doFilter(ServletRequest request,
                     ServletResponse response,
                     FilterChain chain)
              throws IOException,
                     ServletException
Specified by:
doFilter in interface Filter
Throws:
IOException
ServletException

getDefaultTargetUrl

public String getDefaultTargetUrl()
Supplies the default target Url that will be used if no saved request is found or the alwaysUseDefaultTargetUrl propert is set to true. Override this method of you want to provide a customized default Url (for example if you want different Urls depending on the authorities of the user who has just logged in).

Returns:
the defaultTargetUrl property

getExceptionMappings

public Properties getExceptionMappings()

getRememberMeServices

public org.acegisecurity.ui.rememberme.RememberMeServices getRememberMeServices()

init

public void init(FilterConfig arg0)
          throws ServletException
Does JCIFS Initialization. We use IoC container lifecycle services instead.

Specified by:
init in interface Filter
Parameters:
arg0 - ignored
Throws:
ServletException - ignored

attemptAuthentication

public org.acegisecurity.Authentication attemptAuthentication(ServletRequest request,
                                                              ServletResponse response,
                                                              FilterChain chain)
                                                       throws IOException,
                                                              ServletException,
                                                              org.acegisecurity.AuthenticationException
This method simply calls negotiate( req, resp, false ) and then chain.doFilter. You can override and call negotiate manually to achive a variety of different behavior.

Throws:
IOException
ServletException
org.acegisecurity.AuthenticationException

negotiate

protected jcifs.smb.NtlmPasswordAuthentication negotiate(HttpServletRequest req,
                                                         HttpServletResponse resp,
                                                         boolean skipAuthentication)
                                                  throws IOException,
                                                         ServletException
Negotiate password hashes with MSIE clients using NTLM SSP

Parameters:
req - The servlet request
resp - The servlet response
skipAuthentication - If true the negotiation is only done if it is initiated by the client (MSIE post requests after successful NTLM SSP authentication). If false and the user has not been authenticated yet the client will be forced to send an authentication (server sends HttpServletResponse.SC_UNAUTHORIZED).
Returns:
True if the negotiation is complete, otherwise false
Throws:
IOException
ServletException

getDefaultDomain

public String getDefaultDomain()

setDefaultDomain

public void setDefaultDomain(String defaultDomain)

getDomainController

public String getDomainController()

setDomainController

public void setDomainController(String domainController)

isLoadBalance

public boolean isLoadBalance()

setLoadBalance

public void setLoadBalance(boolean loadBalance)

isEnableBasic

public boolean isEnableBasic()

setEnableBasic

public void setEnableBasic(boolean enableBasic)

isInsecureBasic

public boolean isInsecureBasic()

setInsecureBasic

public void setInsecureBasic(boolean insecureBasic)

getRealm

public String getRealm()

setRealm

public void setRealm(String realm)

getProperties

public Properties getProperties()

setProperties

public void setProperties(Properties properties)

isAlwaysUseDefaultTargetUrl

public boolean isAlwaysUseDefaultTargetUrl()

onPreAuthentication

protected void onPreAuthentication(HttpServletRequest request,
                                   HttpServletResponse response)
                            throws org.acegisecurity.AuthenticationException,
                                   IOException
Throws:
org.acegisecurity.AuthenticationException
IOException

onSuccessfulAuthentication

protected void onSuccessfulAuthentication(HttpServletRequest request,
                                          HttpServletResponse response,
                                          org.acegisecurity.Authentication authResult)
                                   throws IOException
Throws:
IOException

onUnsuccessfulAuthentication

protected void onUnsuccessfulAuthentication(HttpServletRequest request,
                                            HttpServletResponse response,
                                            org.acegisecurity.AuthenticationException failed)
                                     throws IOException
Throws:
IOException

setAlwaysUseDefaultTargetUrl

public void setAlwaysUseDefaultTargetUrl(boolean alwaysUseDefaultTargetUrl)

setApplicationEventPublisher

public void setApplicationEventPublisher(org.springframework.context.ApplicationEventPublisher eventPublisher)
Specified by:
setApplicationEventPublisher in interface org.springframework.context.ApplicationEventPublisherAware

setAuthenticationDetailsSource

public void setAuthenticationDetailsSource(org.acegisecurity.ui.AuthenticationDetailsSource authenticationDetailsSource)

setDefaultTargetUrl

public void setDefaultTargetUrl(String defaultTargetUrl)

setExceptionMappings

public void setExceptionMappings(Properties exceptionMappings)

setMessageSource

public void setMessageSource(org.springframework.context.MessageSource messageSource)
Specified by:
setMessageSource in interface org.springframework.context.MessageSourceAware
Overrides:
setMessageSource in class org.acegisecurity.providers.ldap.authenticator.AbstractLdapAuthenticator

setRememberMeServices

public void setRememberMeServices(org.acegisecurity.ui.rememberme.RememberMeServices rememberMeServices)

successfulAuthentication

protected void successfulAuthentication(HttpServletRequest request,
                                        HttpServletResponse response,
                                        org.acegisecurity.Authentication authResult)
                                 throws IOException
Throws:
IOException

determineTargetUrl

protected String determineTargetUrl(HttpServletRequest request)

unsuccessfulAuthentication

protected void unsuccessfulAuthentication(HttpServletRequest request,
                                          HttpServletResponse response,
                                          org.acegisecurity.AuthenticationException failed)
                                   throws IOException
Throws:
IOException

getAuthenticationDetailsSource

public org.acegisecurity.ui.AuthenticationDetailsSource getAuthenticationDetailsSource()

setDetails

protected void setDetails(HttpServletRequest request,
                          org.acegisecurity.providers.UsernamePasswordAuthenticationToken authRequest)
Provided so that subclasses may configure what is put into the authentication request's details property.

Parameters:
request - that an authentication request is being created for
authRequest - the authentication request object that should have its details set

getSkipNtlmAuthUrls

public List<String> getSkipNtlmAuthUrls()

setSkipNtlmAuthUrls

public void setSkipNtlmAuthUrls(List<String> skipNtlmAuthUrls)

getLdapAuthoritiesPopulator

public org.acegisecurity.providers.ldap.LdapAuthoritiesPopulator getLdapAuthoritiesPopulator()

setLdapAuthoritiesPopulator

public void setLdapAuthoritiesPopulator(org.acegisecurity.providers.ldap.LdapAuthoritiesPopulator ldapAuthoritiesPopulator)


Copyright ? 2007. All Rights Reserved.