Search in sources :

Example 6 with EJBInvocation

use of org.glassfish.ejb.api.EJBInvocation in project Payara by payara.

the class WebServiceContextImpl method isUserInRole.

public boolean isUserInRole(String role) {
    WebServiceContractImpl wscImpl = WebServiceContractImpl.getInstance();
    ComponentInvocation.ComponentInvocationType EJBInvocationType = ComponentInvocation.ComponentInvocationType.EJB_INVOCATION;
    InvocationManager mgr = wscImpl.getInvocationManager();
    if ((mgr != null) && (EJBInvocationType.equals(mgr.getCurrentInvocation().getInvocationType()))) {
        EJBInvocation inv = (EJBInvocation) mgr.getCurrentInvocation();
        boolean res = inv.isCallerInRole(role);
        return res;
    }
    // This is a servlet endpoint
    boolean ret = this.jaxwsContextDelegate.isUserInRole(role);
    // handling for webservice with WS-Security
    if (!ret && secServ != null) {
        if (mgr.getCurrentInvocation().getContainer() instanceof WebModule) {
            Principal p = getUserPrincipal();
            ret = secServ.isUserInRole((WebModule) mgr.getCurrentInvocation().getContainer(), p, servletName, role);
        }
    }
    return ret;
}
Also used : ComponentInvocation(org.glassfish.api.invocation.ComponentInvocation) InvocationManager(org.glassfish.api.invocation.InvocationManager) EJBInvocation(org.glassfish.ejb.api.EJBInvocation) WebModule(com.sun.enterprise.web.WebModule) Principal(java.security.Principal)

Aggregations

EJBInvocation (org.glassfish.ejb.api.EJBInvocation)6 ComponentInvocation (org.glassfish.api.invocation.ComponentInvocation)4 InvocationManager (org.glassfish.api.invocation.InvocationManager)4 Method (java.lang.reflect.Method)2 Principal (java.security.Principal)2 WebModule (com.sun.enterprise.web.WebModule)1 Implementor (com.sun.xml.rpc.spi.runtime.Implementor)1 WSBinding (com.sun.xml.ws.api.WSBinding)1 InstanceResolver (com.sun.xml.ws.api.server.InstanceResolver)1 Invoker (com.sun.xml.ws.api.server.Invoker)1 SDDocumentSource (com.sun.xml.ws.api.server.SDDocumentSource)1 WSEndpoint (com.sun.xml.ws.api.server.WSEndpoint)1 ServletAdapterList (com.sun.xml.ws.transport.http.servlet.ServletAdapterList)1 URI (java.net.URI)1 URL (java.net.URL)1 UnmarshalException (java.rmi.UnmarshalException)1 ArrayList (java.util.ArrayList)1 Collection (java.util.Collection)1 EJBContext (javax.ejb.EJBContext)1 WebServiceFeature (javax.xml.ws.WebServiceFeature)1