Search in sources :

Example 1 with AuthConfigRegistrationWrapper

use of com.sun.jaspic.services.AuthConfigRegistrationWrapper in project Payara by payara.

the class ClientPipeCreator method createSecurityPipe.

@Override
public Pipe createSecurityPipe(PolicyMap map, ClientPipeAssemblerContext ctxt, Pipe tail) {
    HashMap<String, Object> props = new HashMap<>();
    props.put(POLICY, map);
    props.put(WSDL_MODEL, ctxt.getWsdlModel());
    props.put(SERVICE, ctxt.getService());
    props.put(BINDING, ctxt.getBinding());
    props.put(ENDPOINT_ADDRESS, ctxt.getAddress());
    if (svcRef != null) {
        props.put(SERVICE_REF, svcRef);
    }
    props.put(NEXT_PIPE, tail);
    props.put(CONTAINER, ctxt.getContainer());
    props.put(ASSEMBLER_CONTEXT, ctxt);
    ClientSecurityPipe ret = new ClientSecurityPipe(props, tail);
    AuthConfigRegistrationWrapper listenerWrapper = ClientPipeCloser.getInstance().lookupListenerWrapper(svcRef);
    // there is a 1-1 mapping between Service_Ref and a ListenerWrapper
    if (listenerWrapper != null) {
        // override the listener that was created by the ConfigHelper CTOR :if one was already registered
        listenerWrapper.incrementReference();
        ret.getPipeHelper().setRegistrationWrapper(listenerWrapper);
    } else {
        // register a new listener
        ClientPipeCloser.getInstance().registerListenerWrapper(svcRef, ret.getPipeHelper().getRegistrationWrapper());
    }
    return ret;
}
Also used : AuthConfigRegistrationWrapper(com.sun.jaspic.services.AuthConfigRegistrationWrapper) HashMap(java.util.HashMap)

Example 2 with AuthConfigRegistrationWrapper

use of com.sun.jaspic.services.AuthConfigRegistrationWrapper in project Payara by payara.

the class ClientPipeCloser method cleanupClientPipe.

public void cleanupClientPipe(ServiceReferenceDescriptor desc) {
    AuthConfigRegistrationWrapper listenerWrapper = (AuthConfigRegistrationWrapper) svcRefListenerMap.get(desc);
    if (listenerWrapper != null) {
        listenerWrapper.disable();
    }
    svcRefListenerMap.remove(desc);
}
Also used : AuthConfigRegistrationWrapper(com.sun.jaspic.services.AuthConfigRegistrationWrapper)

Example 3 with AuthConfigRegistrationWrapper

use of com.sun.jaspic.services.AuthConfigRegistrationWrapper in project Payara by payara.

the class ClientPipeCloser method removeListenerWrapper.

public void removeListenerWrapper(AuthConfigRegistrationWrapper wrapper) {
    ServiceReferenceDescriptor entryToRemove = null;
    for (Entry<ServiceReferenceDescriptor, AuthConfigRegistrationWrapper> entry : svcRefListenerMap.entrySet()) {
        ServiceReferenceDescriptor svc = entry.getKey();
        AuthConfigRegistrationWrapper wrp = entry.getValue();
        if (wrp == wrapper) {
            entryToRemove = svc;
            break;
        }
    }
    if (entryToRemove != null) {
        svcRefListenerMap.remove(entryToRemove);
    }
}
Also used : AuthConfigRegistrationWrapper(com.sun.jaspic.services.AuthConfigRegistrationWrapper) ServiceReferenceDescriptor(com.sun.enterprise.deployment.ServiceReferenceDescriptor)

Aggregations

AuthConfigRegistrationWrapper (com.sun.jaspic.services.AuthConfigRegistrationWrapper)3 ServiceReferenceDescriptor (com.sun.enterprise.deployment.ServiceReferenceDescriptor)1 HashMap (java.util.HashMap)1