@Override
    public void postInvoke(WebSecurityContext webSecurityContext) throws AuthenticationException {
        AuthStatus status = null;
        if (webSecurityContext != null) {
            JaspiAuthContext jaspiContext = (JaspiAuthContext) webSecurityContext.getJaspiAuthContext();
            if (!jaspiContext.runSecureResponse()) {
                if (tc.isDebugEnabled())
                    Tr.debug(tc, "postInvoke", "skip secureResponse.");
                return;
            }
            MessageInfo msgInfo = (MessageInfo) jaspiContext.getMessageInfo();
            ServerAuthContext authContext = (ServerAuthContext) jaspiContext.getServerAuthContext();
            Subject serviceSubject = webSecurityContext.getReceivedSubject();
            try {
                if (tc.isDebugEnabled())
                    Tr.debug(tc, "secureResponse with Jaspi",
                             new Object[] { "authContext=" + authContext, "serviceSubject=" + serviceSubject, msgInfo });

                status = authContext.secureResponse(msgInfo, serviceSubject);
                if (tc.isDebugEnabled())
                    Tr.debug(tc, "secureResponse status: " + status);

                // TODO Which reply or exception?
                if (AuthStatus.SEND_SUCCESS != status &&

                    AuthStatus.SEND_FAILURE != status &&

                    AuthStatus.SEND_CONTINUE != status) {

                    if (tc.isDebugEnabled())
                        Tr.debug(tc, "secureResponse  AuthStatus=" + status);
                    String msg = "Unexpected AuthStatus received during secureResponse() status=" + status
                                 + ", MessageInfo=" + msgInfo + ", ServerAuthContext=" + authContext;
                    throw new AuthenticationException(msg);
                }
            } catch (AuthException e) {
                /*
                 * The runtime must perform whatever processing it requires to complete the processing of a request that failed after
                 * (or during) service invocation, and prior to communicating the invocation result to the client runtime. The runtime
                 * may send (without calling secureResponse) an appropriate response message of its choice. If a failure message is
                 * returned, it should indicate that the failure in request processing occurred after the service invocation.
                 */
                throw new AuthenticationException("JASPI authentication failed after invoking the requested target service.", e);
            }
        }
    }
@ Override public void postInvoke ( WebSecurityContext webSecurityContext ) throws AuthenticationException { AuthStatus status = null ; if ( webSecurityContext != null ) { JaspiAuthContext jaspiContext = ( JaspiAuthContext ) webSecurityContext . getJaspiAuthContext ( ) ; if ( ! jaspiContext . runSecureResponse ( ) ) { if ( tc . isDebugEnabled ( ) ) Tr . debug ( tc , "postInvoke" , "skip secureResponse." ) ; return ; } MessageInfo msgInfo = ( MessageInfo ) jaspiContext . getMessageInfo ( ) ; ServerAuthContext authContext = ( ServerAuthContext ) jaspiContext . getServerAuthContext ( ) ; Subject serviceSubject = webSecurityContext . getReceivedSubject ( ) ; try { if ( tc . isDebugEnabled ( ) ) Tr . debug ( tc , "secureResponse with Jaspi" , new Object [ ] { "authContext=" + authContext , "serviceSubject=" + serviceSubject , msgInfo } ) ; status = authContext . secureResponse ( msgInfo , serviceSubject ) ; if ( tc . isDebugEnabled ( ) ) Tr . debug ( tc , "secureResponse status: " + status ) ; if ( AuthStatus . SEND_SUCCESS != status && AuthStatus . SEND_FAILURE != status && AuthStatus . SEND_CONTINUE != status ) { if ( tc . isDebugEnabled ( ) ) Tr . debug ( tc , "secureResponse  AuthStatus=" + status ) ; String msg = "Unexpected AuthStatus received during secureResponse() status=" + status + ", MessageInfo=" + msgInfo + ", ServerAuthContext=" + authContext ; throw new AuthenticationException ( msg ) ; } } catch ( AuthException e ) { throw new AuthenticationException ( "JASPI authentication failed after invoking the requested target service." , e ) ; } } }
/*
(non-Javadoc)

@see com.ibm.ws.webcontainer.security.JaspiService#postInvoke(com.ibm.ws.webcontainer.security.WebSecurityContext)