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.config.MuleProperties;
11  import org.mule.api.security.CredentialsAccessor;
12  
13  /**
14   * <code>MuleHeaderCredentialsAccessor</code> obtains and sets the user credentials
15   * as Mule property headers.
16   */
17  public class MuleHeaderCredentialsAccessor implements CredentialsAccessor
18  {
19      public Object getCredentials(MuleEvent event)
20      {
21          return event.getMessage().getInboundProperty(MuleProperties.MULE_USER_PROPERTY);
22      }
23  
24      public void setCredentials(MuleEvent event, Object credentials)
25      {
26          event.getMessage().setOutboundProperty(MuleProperties.MULE_USER_PROPERTY, credentials);
27      }
28  }