Package java.security

Examples of java.security.AccessControlContext


     * @return the resulting class loader
     */
    public static URLClassLoader newInstance(final URL[] urls,
               final ClassLoader parent) {
  // Save the caller's context
  AccessControlContext acc = AccessController.getContext();
  // Need a privileged block to create the class loader
  URLClassLoader ucl =
      (URLClassLoader) AccessController.doPrivileged(new PrivilegedAction() {
    public Object run() {
        return new FactoryURLClassLoader(urls, parent);
View Full Code Here


     * @param urls the URLs to search for classes and resources
     * @return the resulting class loader
     */
    public static URLClassLoader newInstance(final URL[] urls) {
  // Save the caller's context
  AccessControlContext acc = AccessController.getContext();
  // Need a privileged block to create the class loader
  URLClassLoader ucl = (URLClassLoader)
      AccessController.doPrivileged(new PrivilegedAction() {
    public Object run() {
        return new FactoryURLClassLoader(urls);
View Full Code Here

                AccessController.doPrivileged(new PrivilegedAction() {
                    public Object run() {
            sm.checkPackageAccess(name.substring(0, i));
            return null;
                    }
                }, new AccessControlContext(new ProtectionDomain[] {pd}));
      }
  }
  domains.add(pd);
    }
View Full Code Here

    * @return the result
    * @throws Throwable for any error
    */
   protected static Object dispatchJoinPoint(final KernelControllerContext context, final Joinpoint joinpoint) throws Throwable
   {
      AccessControlContext access = null;
      if (context instanceof AbstractKernelControllerContext)
      {
         AbstractKernelControllerContext theContext = (AbstractKernelControllerContext) context;
         access = theContext.getAccessControlContext();
      }
View Full Code Here

        ContextManager.setCallers(subject, subject);

        try {

            AccessControlContext acc = ContextManager.getCurrentContext();

            /**
             * JACC v1.0 secion 4.1.1
             */
            WebUserDataPermission wudp = new WebUserDataPermission(request);
            acc.checkPermission(wudp);

        } catch (AccessControlException ace) {
            response.sendError(Response.SC_FORBIDDEN);
            return false;
        }
View Full Code Here

            ContextManager.setCallers(currentCaller, currentCaller);
        }

        try {

            AccessControlContext acc = ContextManager.getCurrentContext();

            /**
             * JACC v1.0 section 4.1.2
             */
            acc.checkPermission(new WebResourcePermission(request));

        } catch (AccessControlException ace) {
            response.sendError(Response.SC_FORBIDDEN);
            return false;
        }
View Full Code Here

        //Set the caller
        Subject currentCaller = ((JAASTomcatPrincipal) principal).getSubject();
        ContextManager.setCallers(currentCaller, currentCaller);

        AccessControlContext acc = ContextManager.getCurrentContext();

        try {
            /**
             * JACC v1.0 section 4.1.3
             */
            acc.checkPermission(new WebRoleRefPermission(name, role));
        } catch (AccessControlException e) {
            return false;
        }

        return true;
View Full Code Here

            String name = (type == null) ? null : type.getSpecName();

            Permission permission = new EJBMethodPermission(ejbName, name, method);

            AccessControlContext accessContext = ContextManager.getCurrentContext();

            if (permission != null) accessContext.checkPermission(permission);

        } catch (AccessControlException e) {
            return false;
        }
        return true;
View Full Code Here

    public boolean isUserInRole(Principal user, String role) {
        if (user == null || role == null) {
            return false;
        }

        AccessControlContext acc = ContextManager.getCurrentContext();
        try {
            // JACC v1.0 secion B.19
            String servletName = InternalJettyServletHolder.getCurrentServletName();
            if (servletName == null || servletName.equals("jsp")) {
                servletName = "";
            }
            acc.checkPermission(new WebRoleRefPermission(servletName, role));
        } catch (AccessControlException e) {
            return false;
        }
        return true;
    }
View Full Code Here

        SecurityManager sm = System.getSecurityManager();
        if (sm != null) sm.checkPermission(SET_CONTEXT);

        if (subject == null) throw new IllegalArgumentException("Subject must not be null");

        AccessControlContext acc = (AccessControlContext) Subject.doAsPrivileged(subject, new PrivilegedAction() {
            public Object run() {
                return AccessController.getContext();
            }
        }, null);
View Full Code Here

TOP

Related Classes of java.security.AccessControlContext

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.