View Javadoc

1   /*
2    * $Id: AbstractAuthenticationFilter.java 22374 2011-07-11 10:16:57Z dirk.olmes $
3    * --------------------------------------------------------------------------------------
4    * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
5    *
6    * The software in this package is published under the terms of the CPAL v1.0
7    * license, a copy of which has been included with this distribution in the
8    * LICENSE.txt file.
9    */
10  
11  package org.mule.security;
12  
13  import org.mule.api.MuleEvent;
14  import org.mule.api.lifecycle.InitialisationException;
15  import org.mule.api.security.AuthenticationFilter;
16  import org.mule.api.security.CredentialsAccessor;
17  import org.mule.api.security.CryptoFailureException;
18  import org.mule.api.security.EncryptionStrategyNotFoundException;
19  import org.mule.api.security.SecurityException;
20  import org.mule.api.security.SecurityProviderNotFoundException;
21  import org.mule.api.security.UnknownAuthenticationTypeException;
22  
23  /**
24   * <code>AbstractEndpointSecurityFilter</code> provides a framework to perform inbound
25   * or outbound authentication for messages.
26   */
27  public abstract class AbstractAuthenticationFilter extends AbstractSecurityFilter implements AuthenticationFilter
28  {
29      private boolean authenticate;
30      private CredentialsAccessor credentialsAccessor;
31  
32      public CredentialsAccessor getCredentialsAccessor()
33      {
34          return credentialsAccessor;
35      }
36  
37      public void setCredentialsAccessor(CredentialsAccessor credentialsAccessor)
38      {
39          this.credentialsAccessor = credentialsAccessor;
40      }
41      public boolean isAuthenticate()
42      {
43          return authenticate;
44      }
45  
46      public void setAuthenticate(boolean authenticate)
47      {
48          this.authenticate = authenticate;
49      }
50  
51      @Override
52      public void doFilter(MuleEvent event)
53          throws SecurityException, UnknownAuthenticationTypeException, CryptoFailureException,
54          SecurityProviderNotFoundException, EncryptionStrategyNotFoundException, InitialisationException
55      {
56          authenticate(event);
57      }
58  
59      public abstract void authenticate(MuleEvent event)
60              throws SecurityException, UnknownAuthenticationTypeException, CryptoFailureException,
61              SecurityProviderNotFoundException, EncryptionStrategyNotFoundException,
62              InitialisationException;
63  
64  }