Search in sources :

Example 1 with ServerAuthConfig

use of com.sun.enterprise.security.jauth.jaspic.provider.ServerAuthConfig in project Payara by payara.

the class SecurityServiceImpl method validateRequest.

@Override
public boolean validateRequest(Object serverAuthConfig, StreamingHandler implementor, SOAPMessageContext context) {
    ServerAuthConfig authConfig = (ServerAuthConfig) serverAuthConfig;
    if (authConfig == null) {
        return true;
    }
    ServerAuthContext serverAuthContext = authConfig.getAuthContext(implementor, context.getMessage());
    req.set(new WeakReference<SOAPMessage>(context.getMessage()));
    if (serverAuthContext == null) {
        return true;
    }
    try {
        return WebServiceSecurity.validateRequest(context, serverAuthContext);
    } catch (AuthException ex) {
        _logger.log(SEVERE, EXCEPTION_THROWN, ex);
        if (req.get() != null) {
            req.get().clear();
            req.set(null);
        }
        throw new RuntimeException(ex);
    }
}
Also used : AuthException(com.sun.enterprise.security.jauth.AuthException) SOAPMessage(javax.xml.soap.SOAPMessage) ServerAuthConfig(com.sun.enterprise.security.jauth.jaspic.provider.ServerAuthConfig) ServerAuthContext(com.sun.enterprise.security.jauth.ServerAuthContext)

Example 2 with ServerAuthConfig

use of com.sun.enterprise.security.jauth.jaspic.provider.ServerAuthConfig in project Payara by payara.

the class SecurityServiceImpl method secureResponse.

@Override
public void secureResponse(Object serverAuthConfig, StreamingHandler implementor, SOAPMessageContext msgContext) {
    if (serverAuthConfig != null) {
        ServerAuthConfig config = (ServerAuthConfig) serverAuthConfig;
        SOAPMessage reqmsg = (req.get() != null) ? req.get().get() : msgContext.getMessage();
        try {
            ServerAuthContext serverAuthContext = config.getAuthContext(implementor, reqmsg);
            if (serverAuthContext != null) {
                try {
                    WebServiceSecurity.secureResponse(msgContext, serverAuthContext);
                } catch (AuthException ex) {
                    _logger.log(SEVERE, EXCEPTION_THROWN, ex);
                    throw new RuntimeException(ex);
                }
            }
        } finally {
            if (req.get() != null) {
                req.get().clear();
                req.set(null);
            }
        }
    }
}
Also used : AuthException(com.sun.enterprise.security.jauth.AuthException) SOAPMessage(javax.xml.soap.SOAPMessage) ServerAuthConfig(com.sun.enterprise.security.jauth.jaspic.provider.ServerAuthConfig) ServerAuthContext(com.sun.enterprise.security.jauth.ServerAuthContext)

Aggregations

AuthException (com.sun.enterprise.security.jauth.AuthException)2 ServerAuthContext (com.sun.enterprise.security.jauth.ServerAuthContext)2 ServerAuthConfig (com.sun.enterprise.security.jauth.jaspic.provider.ServerAuthConfig)2 SOAPMessage (javax.xml.soap.SOAPMessage)2