View Javadoc
1   /*
2    * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
3    * The software in this package is published under the terms of the CPAL v1.0
4    * license, a copy of which has been included with this distribution in the
5    * LICENSE.txt file.
6    */
7   package org.mule.security;
8   
9   import org.mule.api.MuleEvent;
10  import org.mule.api.endpoint.ImmutableEndpoint;
11  import org.mule.api.lifecycle.InitialisationException;
12  import org.mule.api.security.CryptoFailureException;
13  import org.mule.api.security.EncryptionStrategyNotFoundException;
14  import org.mule.api.security.EndpointSecurityFilter;
15  import org.mule.api.security.SecurityException;
16  import org.mule.api.security.SecurityProviderNotFoundException;
17  import org.mule.api.security.UnknownAuthenticationTypeException;
18  
19  /**
20   * <code>AbstractEndpointSecurityFilter</code> provides basic initialisation for
21   * all security filters, namely configuring the SecurityManager for this instance
22   */
23  @Deprecated
24  public abstract class AbstractEndpointSecurityFilter extends AbstractAuthenticationFilter implements EndpointSecurityFilter
25  {
26      protected ImmutableEndpoint endpoint;
27  
28      public ImmutableEndpoint getEndpoint()
29      {
30          return endpoint;
31      }
32  
33      public synchronized void setEndpoint(ImmutableEndpoint endpoint)
34      {
35          this.endpoint = endpoint;
36      }
37  
38      @Override
39      public void doFilter(MuleEvent event)
40          throws SecurityException, UnknownAuthenticationTypeException, CryptoFailureException,
41          SecurityProviderNotFoundException, EncryptionStrategyNotFoundException, InitialisationException
42      {
43          // lazy init the endpoint
44          if (endpoint == null)
45          {
46              endpoint = event.getEndpoint();
47          }
48          
49          super.doFilter(event);
50      }
51  
52  }