Package java.security

Examples of java.security.Policy.refresh()


        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

        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

        final AllPermission allPermission = new AllPermission();
        final HashMap grants = new HashMap();
        grants.put( codeSource, new Permission[]{allPermission} );

        final Policy policy = new DefaultPolicy( grants );
        policy.refresh();
        final PermissionCollection resultPermissions = policy.getPermissions( codeSource );
        final Enumeration enumeration = resultPermissions.elements();
        while( enumeration.hasMoreElements() )
        {
            final Permission permission = (Permission)enumeration.nextElement();
View Full Code Here

    public void testPolicyAccessPermissionForNonSpecifiedCodeBase()
        throws Exception
    {
        final Policy policy = new DefaultPolicy();
        policy.refresh();

        final URL url = new URL( "http://spice.sourceforge.net/-" );
        final CodeSource codeSource = new CodeSource( url, new Certificate[ 0 ] );
        final PermissionCollection permissions = policy.getPermissions( codeSource );
        assertEquals( "Expect no permissions for http://...", false, permissions.elements().hasMoreElements() );
View Full Code Here

      pc.addToRole("admin", permColl);
      pc.addToRole("janitor", permColl);
      pc.commit();
     
      Policy policy = Policy.getPolicy();
      policy.refresh();
     
      //Act like the Portal Container and check perm
      PolicyContext.setContextID("portal-context-1");
      checkAdminAccess( policy);
      checkEmployeeAccess( policy)
View Full Code Here

      Class[] ext = new Class[] {PortalPermission.class};
     
      ((DelegatingPolicy)policy).setExternalPermissionTypes(ext);
      Policy.setPolicy(policy);
      //Have the policy load/update itself
      policy.refresh();
   }
  
   protected void checkAdminAccess(Policy policy) throws Exception
   {
      //Check context access
View Full Code Here

      PortalObjectPermission contextPerm = new PortalObjectPermission("/","view");
      pc.addToRole("admin", contextPerm);
      pc.commit();
     
      Policy policy = Policy.getPolicy();
      policy.refresh();
     
      //Act like the Portal Container and check perm for portal
      PolicyContext.setContextID("portal-context");
      checkAdminAccess(policy);
      checkEmployeeAccess(policy);
View Full Code Here

            policyConfiguration.commit();
        }

        //refresh policy
        Policy policy = Policy.getPolicy();
        policy.refresh();

        if (defaultSubjectInfo == null) {
            defaultSubject = ContextManager.EMPTY;
        } else {
            defaultSubject = credentialStore.getSubject(defaultSubjectInfo.getRealm(), defaultSubjectInfo.getId());
View Full Code Here

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

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.