Package com.sun.web.security

Examples of com.sun.web.security.RealmAdapter


            // create an invocation context that is of the type
            // SERVLET_INVOCATION
            final Context               invocationContext = new StandardContext();
            final WebBundleDescriptor   wbd               = new WebBundleDescriptor();
            Application.createApplication( mLifecycleModule.getName(),  wbd.getModuleDescriptor());
            invocationContext.setRealm( new RealmAdapter(wbd, false) );
            mLifecycleModule.onStartup( mServerContext, invocationContext);
        }
View Full Code Here


            return res;
        } else if (o instanceof WebModule) {
            WebModule webModule = (WebModule)o;
            Realm realm = webModule.getRealm();
            if (realm instanceof RealmAdapter) {
                RealmAdapter realmAdapter = (RealmAdapter)realm;
                Principal princ = getUserPrincipal();
                return realmAdapter.hasRole(servletName, princ, role);
            }
        }
        // This is a servlet endpoint
        return this.jaxwsContextDelegate.isUserInRole(role);
    }
View Full Code Here

    ((Container)inv.getContainerContext()).getSecurityManager();
      sm.preInvoke(inv);
  } else if (invType == inv.SERVLET_INVOCATION){
      Realm rlm = ((Context)inv.getContainerContext()).getRealm();
      if (rlm instanceof RealmAdapter) {
    RealmAdapter rad = (RealmAdapter) rlm;
    rad.preSetRunAsIdentity(inv);
      }
  }

  // push this invocation on the stack
        v.add(inv);
View Full Code Here

   
    sm.postInvoke(inv);
      } else if (invType == inv.SERVLET_INVOCATION){
    Realm rlm = ((Context)inv.getContainerContext()).getRealm();
    if (rlm instanceof RealmAdapter) {
        RealmAdapter rad = (RealmAdapter) rlm;
        rad.postSetRunAsIdentity (inv);
    }// else {
//         throw new InvocationException();
//     }
      }
View Full Code Here

    public void setParent(Container container) {
        super.setParent(container);
        // The following assumes that the realm has been set on this WebModule
        // before the WebModule is added as a child to the virtual server on
        // which it is being deployed.
        RealmAdapter ra = (RealmAdapter) getRealm();
        if (ra != null) {
            ra.setVirtualServer(container);
        }
    }
View Full Code Here

        if (webPrincipal==null) {
            sendAuthenticationEvents(false, hreq.getRequestURI(), null);          
            return authenticated;
        }
       
        RealmAdapter ra = new RealmAdapter(realmName);
        authenticated = ra.authenticate(webPrincipal);
        if( authenticated == false ) {
            sendAuthenticationEvents(false, hreq.getRequestURI(), webPrincipal);
            logger.fine("authentication failed for " +  endpointName);
        }
View Full Code Here

        HttpServletRequest hreq = (HttpServletRequest) request.getRequest();
        if (webModule != null && webModule.getAdHocServletName(hreq.getServletPath()) != null) {   
            webModule.getAdHocPipeline().invoke(request, response);
        } else {
            RealmAdapter realmAdapter = (RealmAdapter)webModule.getRealm();
            if (realmAdapter != null &&
                    realmAdapter.isSecurityExtensionEnabled()){
                doChainInvoke(request, response);
            } else {
                doInvoke(request, response);
            }
        }
View Full Code Here

     private RealmAdapter getRealmAdapter(WebBundleDescriptor wbd, boolean isSystemApp, String realmName) {
        ModuleType mType = ((wbd != null) ? wbd.getModuleType() : ModuleType.WAR);
        String mTyString = mType.toString();
        if ("org.jvnet.glassfish.comms.deployment.backend.SipArchiveDeployer".equals(mTyString)) {
            String realmClassName = PluggableContextInfo.getCustomRealmAdapter(mType.toString());
            RealmAdapter adapter = null;
            try {
                Class realmClass = Class.forName(realmClassName);
                Constructor ctor = realmClass.getConstructor(
                        new Class[]{com.sun.enterprise.deployment.WebBundleDescriptor.class, boolean.class, String.class});
                adapter = (RealmAdapter) ctor.newInstance(wbd, isSystemApp, realmName);
            } catch (Throwable t) {

                _logger.log(Level.SEVERE, "Unable to create context", t);
                return null;
            }
            return adapter;
        } else {
            return new RealmAdapter(wbd, isSystemApp, realmName);
        }

    }
View Full Code Here

            if (webPrincipal == null) {
                sendAuthenticationEvents(false, hreq.getRequestURI(), null);
                return authenticated;
            }

            RealmAdapter ra = new RealmAdapter(realmName,endpoint.getBundleDescriptor().getModuleID());
            authenticated = ra.authenticate(webPrincipal);
            if (authenticated == false) {
                sendAuthenticationEvents(false, hreq.getRequestURI(), webPrincipal);
                if (_logger.isLoggable(Level.FINE)) {
                    _logger.fine("authentication failed for " + endpointName);
                }
View Full Code Here

        return ctx.getCallerPrincipal();
    }

    public boolean isUserInRole(WebModule webModule, Principal principal, String servletName, String role) {
            if (webModule.getRealm() instanceof RealmAdapter) {
                RealmAdapter realmAdapter = (RealmAdapter)webModule.getRealm();
                return realmAdapter.hasRole(servletName, principal, role);
            }
        return false;
    }
View Full Code Here

TOP

Related Classes of com.sun.web.security.RealmAdapter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.