Package java.security

Examples of java.security.Policy$PolicyDelegate


        try {
            // The policy file may have been modified to adjust
            // permissions, so we're reloading it when loading or
            // reloading a Context
            Policy policy = Policy.getPolicy();
            policy.refresh();
        } catch (AccessControlException e) {
            // Some policy files may restrict this, even for the core,
            // so this exception is ignored
        }
View Full Code Here


        try {
            // The policy file may have been modified to adjust
            // permissions, so we're reloading it when loading or
            // reloading a Context
            Policy policy = Policy.getPolicy();
            policy.refresh();
        } catch (AccessControlException e) {
            // Some policy files may restrict this, even for the core,
            // so this exception is ignored
        }
View Full Code Here

    CodeSource ejbCS = clazz.getProtectionDomain().getCodeSource();

    try {
      setContextID( contextID );

      Policy policy = Policy.getPolicy();
      // Get the caller
      Subject caller = getContextSubject();

      Principal[] principals = null;
      if ( caller != null ) {
        // Get the caller principals
        Set principalsSet = caller.getPrincipals();
        principals = new Principal[ principalsSet.size() ];
        principalsSet.toArray( principals );
      }

      ProtectionDomain pd = new ProtectionDomain( ejbCS, null, null, principals );
      if ( !policy.implies( pd, methodPerm ) ) {
        String msg = "Denied: " + methodPerm + ", caller=" + caller;
        SecurityException e = new SecurityException( msg );
        throw e;
      }
    }
View Full Code Here

      return previousID;
    }
  }

  private void doPermissionCheckInContext(PermissionCheckEntityInformation entityInformation, PermissibleAction action) {
    final Policy policy = Policy.getPolicy();
    final Principal[] principals = getCallerPrincipals();

    final CodeSource codeSource = entityInformation.getEntity().getClass().getProtectionDomain().getCodeSource();
    final ProtectionDomain pd = new ProtectionDomain( codeSource, null, null, principals );

    // the action is known as 'method name' in JACC
    final EJBMethodPermission jaccPermission = new EJBMethodPermission(
        entityInformation.getEntityName(),
        action.getImpliedActions()[0],
        null,
        null
    );

    if ( ! policy.implies( pd, jaccPermission) ) {
      throw new SecurityException(
          String.format(
              "JACC denied permission to [%s.%s] for [%s]",
              entityInformation.getEntityName(),
              action.getImpliedActions()[0],
View Full Code Here

    CodeSource ejbCS = clazz.getProtectionDomain().getCodeSource();

    try {
      setContextID( contextID );

      Policy policy = Policy.getPolicy();
      // Get the caller
      Subject caller = getContextSubject();

      Principal[] principals = null;
      if ( caller != null ) {
        // Get the caller principals
        Set principalsSet = caller.getPrincipals();
        principals = new Principal[ principalsSet.size() ];
        principalsSet.toArray( principals );
      }

      ProtectionDomain pd = new ProtectionDomain( ejbCS, null, null, principals );
      if ( policy.implies( pd, methodPerm ) == false ) {
        String msg = "Denied: " + methodPerm + ", caller=" + caller;
        SecurityException e = new SecurityException( msg );
        throw e;
      }
    }
View Full Code Here

    CodeSource ejbCS = clazz.getProtectionDomain().getCodeSource();

    try {
      setContextID( contextID );

      Policy policy = Policy.getPolicy();
      // Get the caller
      Subject caller = getContextSubject();

      Principal[] principals = null;
      if ( caller != null ) {
        // Get the caller principals
        Set principalsSet = caller.getPrincipals();
        principals = new Principal[ principalsSet.size() ];
        principalsSet.toArray( principals );
      }

      ProtectionDomain pd = new ProtectionDomain( ejbCS, null, null, principals );
      if ( policy.implies( pd, methodPerm ) == false ) {
        String msg = "Denied: " + methodPerm + ", caller=" + caller;
        SecurityException e = new SecurityException( msg );
        throw e;
      }
    }
View Full Code Here

      Method findsc = null;

      //Try the Policy Provider
      try
      {
         Policy policy = Policy.getPolicy();
         findsc = policy.getClass().getMethod("findSecurityConstraints", sig);
         scarr = (SecurityConstraint[]) findsc.invoke(policy, args);
      }
      catch (Throwable t)
      {
         if (trace)
View Full Code Here

     * @return PermissionCollection for CodeSource
     */
    protected final PermissionCollection getPermissions(CodeSource codeSource) {
        if (!policy_refresh) {
            // Refresh the security policies
            Policy policy = Policy.getPolicy();
            policy.refresh();
            policy_refresh = true;
        }
        String codeUrl = codeSource.getLocation().toString();
        PermissionCollection pc;
        if ((pc = (PermissionCollection)loaderPC.get(codeUrl)) == null) {
View Full Code Here

        try {
            // The policy file may have been modified to adjust
            // permissions, so we're reloading it when loading or
            // reloading a Context
            Policy policy = Policy.getPolicy();
            policy.refresh();
        } catch (AccessControlException e) {
            // Some policy files may restrict this, even for the core,
            // so this exception is ignored
        }
View Full Code Here

        try {
            // The policy file may have been modified to adjust
            // permissions, so we're reloading it when loading or
            // reloading a Context
            Policy policy = Policy.getPolicy();
            policy.refresh();
        } catch (AccessControlException e) {
            // Some policy files may restrict this, even for the core,
            // so this exception is ignored
        }
View Full Code Here

TOP

Related Classes of java.security.Policy$PolicyDelegate

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.