[ 
https://issues.apache.org/jira/browse/RAMPART-69?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12643324#action_12643324
 ] 

Aaron Evans commented on RAMPART-69:
------------------------------------

I agree.  The fact that I have to use some kind of static singleton mechanism 
to get at my authentication service from within my password callback handler is 
pretty lame.

If I had access to the MesssageContext (and therefore the servlet context) from 
within my password callback handler, I'd be much happier...

> RampartReceiver should store current MessageContext to simplify access 
> MessageContext from CallbackHandler
> ----------------------------------------------------------------------------------------------------------
>
>                 Key: RAMPART-69
>                 URL: https://issues.apache.org/jira/browse/RAMPART-69
>             Project: Rampart
>          Issue Type: Improvement
>          Components: rampart-core
>    Affects Versions: 1.3
>         Environment: all
>            Reporter: Bernhard Roider
>
> RampartReceiver should store current MessageContext to simplify access 
> MessageContext from CallbackHandler.
> This Feature is simple to implement and opens many ways to customise 
> CallbackHandler and TokenIssuer.
> Possible solution;
> public class RampartReceiver(..) {
> ...
>    RampartEngine engine = new RampartEngine();
>    Vector wsResult;
>    MessageContext oldCtx = MessageContext.getCurrentMessageContext();
>    try {
>             // save current MessageContext
>             MessageContext.setCurrentMessageContext(msgContext);
>             wsResult = engine.process(msgContext);
>             
>         } catch (WSSecurityException e) {
>             e.printStackTrace();
>             throw new AxisFault(e.getMessage(), e);
>         } catch (WSSPolicyException e) {
>             e.printStackTrace();
>             throw new AxisFault(e.getMessage(), e);
>         } catch (RampartException e) {
>             e.printStackTrace();
>             throw new AxisFault(e.getMessage(), e);
>         } finally {
>            // restore old MessageContext
>            MessageContext.setCurrentMessageContext(oldContext);
>         }
> P.S.: it would be better (for future Axis2 Version compatibility) if the 
> RampartReceiver extends AbstractHandler

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to