Hi, thanks for the reply
First of all I cannot use
<encryptionUser>useReqSigCert</encryptionUser> because I do not have
signed messages. In the server there is a database with the users and
their symmetric keys (predefined). I only use the UsernameToken in the
call from client to server and encryption with the symmetric key (that
is know at the client also).
Now, the server must understand for who user the response is, so that
in CallBack handler retrieve the key from the database (with the
username) and use it for encrypting the response. I tried to get the
message context but the call MessageContext.getCurrentMessageContext()
returns null in the response.
Thanks in advance,
Konstantinos
On 5/24/07, Dimuthu Leelaratne <[EMAIL PROTECTED]> wrote:
Hi
<encryptionUser>useReqSigCert</encryptionUser> is the provided method,
but if you do not want to use this then there is no straight forward
way to get this done. You can try the following, but i do not
recommend it, because it is more of a hack.
MessageContext msgcxt = MessageContext.getCurrentMessageContext();
Vector results = msgContext.getProperty(WSHandlerConstants.RECV_RESULTS);
//Get the user name from the above vector.
//Create the OMElement the way you want to by inserting the user to
the policy then create a policy object using it as follows.
Policy policyObj = PolicyEngine.getPolicy(OMElement);
String policykey = RampartMessageData.getServicePolicyKey(msgCtx);
msgcxt.setProperty(policykey, policyObj);
If you can explain the UseCase more, then you can file a JIRA for a new feature.
Thank you,
Dimuthu.
http://wso2.org
On 5/23/07, Konstantinos Pateras <[EMAIL PROTECTED]> wrote:
> Hi all,
>
> I have set up Axis2 1.1.1 and Rampart 1.1 and configure it (I
> followed the configuration instructions for Rampart 1.0 that are still
> supported). I use UsernameToken and encryption with a known key to
> both parts but I want to set the encryption user programmatically in
> server when it sends a response (OutflowSecurity). This is because
> each user has its own key stored in a database and is beeing retrieved
> in the PasswordCallbackHandler.
>
> Is there a way to do it like with
> <encryptionUser>useReqSigCert</encryptionUser> that is used when the
> incoming message is signed or can I get the calling user in
> PasswordCallbackHandler when I send the response? (i.e. using some Context)
>