View Javadoc

1   /*
2    * $Id: AbstractEndpointSecurityFilter.java 22156 2011-06-08 21:36:30Z dfeist $
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.endpoint.ImmutableEndpoint;
15  import org.mule.api.endpoint.InboundEndpoint;
16  import org.mule.api.lifecycle.InitialisationException;
17  import org.mule.api.security.CryptoFailureException;
18  import org.mule.api.security.EncryptionStrategyNotFoundException;
19  import org.mule.api.security.EndpointSecurityFilter;
20  import org.mule.api.security.SecurityException;
21  import org.mule.api.security.SecurityProviderNotFoundException;
22  import org.mule.api.security.UnknownAuthenticationTypeException;
23  
24  /**
25   * <code>AbstractEndpointSecurityFilter</code> provides basic initialisation for all security filters, namely
26   * configuring the SecurityManager for this instance
27   */
28  @Deprecated
29  public abstract class AbstractEndpointSecurityFilter extends AbstractAuthenticationFilter
30      implements EndpointSecurityFilter
31  {
32      protected ImmutableEndpoint endpoint;
33  
34      public ImmutableEndpoint getEndpoint()
35      {
36          return endpoint;
37      }
38  
39      public synchronized void setEndpoint(ImmutableEndpoint endpoint)
40      {
41          this.endpoint = endpoint;
42      }
43  
44      @Override
45      public void doFilter(MuleEvent event)
46          throws SecurityException, UnknownAuthenticationTypeException, CryptoFailureException,
47          SecurityProviderNotFoundException, EncryptionStrategyNotFoundException, InitialisationException
48      {
49          super.doFilter(event);
50      }
51  
52      public void authenticate(MuleEvent event)
53          throws SecurityException, UnknownAuthenticationTypeException, CryptoFailureException,
54          SecurityProviderNotFoundException, EncryptionStrategyNotFoundException, InitialisationException
55      {
56          if (endpoint == null || endpoint instanceof InboundEndpoint)
57          {
58              authenticateInbound(event);
59          }
60          else
61          {
62              authenticateOutbound(event);
63          }
64      }
65  
66      protected abstract void authenticateInbound(MuleEvent event)
67          throws SecurityException, CryptoFailureException, SecurityProviderNotFoundException,
68          EncryptionStrategyNotFoundException, UnknownAuthenticationTypeException;
69  
70      protected abstract void authenticateOutbound(MuleEvent event)
71          throws SecurityException, SecurityProviderNotFoundException, CryptoFailureException;
72  
73  }