Deepal...that is what I don't understand. The MessageContext is not passed
to the PasswordCallback. Here is an example PasswordCallback:
import java.io.IOException;
import javax.security.auth.callback.Callback;
import javax.security.auth.callback.CallbackHandler;
import javax.security.auth.callback.UnsupportedCallbackException;
import org.apache.ws.security.WSPasswordCallback;
public class PWCallback implements CallbackHandler {
public void handle(Callback[] callbacks) throws IOException,
UnsupportedCallbackException {
for (int i = 0; i < callbacks.length; i++) {
if (callbacks[i] instanceof WSPasswordCallback) {
WSPasswordCallback pc = (WSPasswordCallback)callbacks[i];
// set the password given a username
if ("wss4j".equals(pc.getIdentifer())) {
pc.setPassword("security");
}
} else {
throw new UnsupportedCallbackException(callbacks[i],
"Unrecognized Callback");
}
}
}
}
In Axis1 I could call MessageContext.getCurrentContext(); and get the
MessageContext within the PasswordCallback class. But in Axis2 if I call
MessageContext.getCurrentMessageContext(); it returns null. Any ideas?
Thanks
Chad
On 6/11/07, Deepal Jayasinghe <[EMAIL PROTECTED]> wrote:
Hi Chad ,
What I told was , Message context is available to security handler , and
security handler is the one who call PasswordCallback , so that handler
should pass the MC to the PasswordCallback.
Thanks
Deepal
> Thanks Deepal for your response. If I understand you correctly it is
> possible to get the MessageContext from within the PasswordCallback.
> Can you give an example?
>
> Thanks
> Chad
>
> On 6/11/07, *Deepal Jayasinghe* <[EMAIL PROTECTED]
> <mailto:[EMAIL PROTECTED]>> wrote:
>
> Hi Chad ,
> > With Axis1 this was possible by calling
> > MessageContext.getCurrentContext(); This doesn't appear to be
> > possible in Axis2, is that right?
> It does , but only for the service impl class, not for others.
> Since all
> the handlers have access to message context directly.
>
> Thanks
> Deepal
>
>
>
---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: [EMAIL PROTECTED]
> <mailto:[EMAIL PROTECTED]>
>
>
--
Thanks,
Deepal
................................................................
"The highest tower is built one brick at a time"
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]