01: /*
02: * $Id: MuleHeaderCredentialsAccessor.java 10489 2008-01-23 17:53:38Z dfeist $
03: * --------------------------------------------------------------------------------------
04: * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com
05: *
06: * The software in this package is published under the terms of the CPAL v1.0
07: * license, a copy of which has been included with this distribution in the
08: * LICENSE.txt file.
09: */
10:
11: package org.mule.security;
12:
13: import org.mule.api.MuleEvent;
14: import org.mule.api.config.MuleProperties;
15: import org.mule.api.security.CredentialsAccessor;
16:
17: /**
18: * <code>MuleHeaderCredentialsAccessor</code> obtains and sets the user credentials
19: * as Mule property headers.
20: */
21: public class MuleHeaderCredentialsAccessor implements
22: CredentialsAccessor {
23: public Object getCredentials(MuleEvent event) {
24: return event.getMessage().getProperty(
25: MuleProperties.MULE_USER_PROPERTY);
26: }
27:
28: public void setCredentials(MuleEvent event, Object credentials) {
29: event.getMessage().setProperty(
30: MuleProperties.MULE_USER_PROPERTY, credentials);
31: }
32: }
|