Package java.security

Examples of java.security.AccessControlContext.checkPermission()



            /**
             * 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


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

        return true;
View Full Code Here

            // 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

            {
               AccessControlContext acc = AccessController.getContext();
               Boolean ok = Boolean.FALSE;
               try
               {
                  acc.checkPermission(methodX);
                  ok = Boolean.TRUE;
               }
               catch(AccessControlException e)
               {
                 
View Full Code Here

  public void checkRead(String filename, Object context)
  {
    if (! (context instanceof AccessControlContext))
      throw new SecurityException("Missing context");
    AccessControlContext ac = (AccessControlContext) context;
    ac.checkPermission(new FilePermission(filename, "read"));
  }

  /**
   * Check if the current thread is allowed to write the given file using the
   * FileDescriptor. This method is called from
View Full Code Here

  {
    if (! (context instanceof AccessControlContext))
      throw new SecurityException("Missing context");
    AccessControlContext ac = (AccessControlContext) context;
    if (port == -1)
      ac.checkPermission(new SocketPermission(host, "resolve"));
    else
      // Use the toString() hack to do the null check.
      ac.checkPermission(new SocketPermission(host.toString() + ":" + port,
                                              "connect"));
  }
View Full Code Here

    AccessControlContext ac = (AccessControlContext) context;
    if (port == -1)
      ac.checkPermission(new SocketPermission(host, "resolve"));
    else
      // Use the toString() hack to do the null check.
      ac.checkPermission(new SocketPermission(host.toString() + ":" + port,
                                              "connect"));
  }

  /**
   * Check if the current thread is allowed to listen to a specific port for
View Full Code Here

        // Can the user really use the broker?
    PolicyContext.setContextID(getBrokerPoicyContextId(client));
        AccessControlContext accessContext = getAccessControlContext(client);
        if (accessContext != null) {
            Permission permission = new JMSBrokerPermission(getBrokerName(client),JMSBrokerPermission.CONNECT_ACTION);
            accessContext.checkPermission(permission);
        }
    }

  /**
   * @param client
View Full Code Here

  public void authorizeConsumer(BrokerClient client, ConsumerInfo info) throws JMSException {
      PolicyContext.setContextID(getDestinationPoicyContextId(client, info.getDestination()));
        AccessControlContext accessContext = getAccessControlContext(client);
        if (accessContext != null) {
            Permission permission = new JMSDestinationPermission(info.getDestination().getPhysicalName(),JMSDestinationPermission.CONSUME_ACTION);
            accessContext.checkPermission(permission);
        }
    }

    public boolean authorizeReceive(BrokerClient client, ActiveMQMessage message) {
        try {
View Full Code Here

        try {
            PolicyContext.setContextID(getDestinationPoicyContextId(client, message.getJMSActiveMQDestination()));
            AccessControlContext accessContext = getAccessControlContext(client);
            if (accessContext != null) {
                Permission permission = new JMSDestinationPermission(message.getJMSActiveMQDestination().getPhysicalName(),JMSDestinationPermission.CONSUME_ACTION);
                accessContext.checkPermission(permission);
            }
        }
        catch (AccessControlException e) {
            return false;
        }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.