Package java.security

Examples of java.security.Permissions$MyPermissionCollection


  /* (non-Javadoc)
   * @see java.security.Policy#getPermissions(java.security.CodeSource)
   */
  @Override
  public PermissionCollection getPermissions(CodeSource codeSource) {
    PermissionCollection result = new Permissions();
    return result;
  }
View Full Code Here


  @Override
  public PermissionCollection getPermissions(ProtectionDomain domain) {
    Principal[] principals = domain.getPrincipals();
    GVSPrincipal[] gvsPrincipals = getGVSPrincipals(principals);

    PermissionCollection result = new Permissions();
    
    /*if (gvsPrincipals.length == 0) {
        //allow everything
        result.add(new GVSImpersonatePermission());
        result.add(new GVSSetClockPermission());
    } else {*/
      //Resource userRes = gvsPrincipals[0].getUserResource();
      //This variant ensures up-to-date authorization
      for (GVSPrincipal principal : gvsPrincipals) {
        if (principal == SuperUserGVSPrincipal.instance) {
          result.add(new GVSImpersonatePermission());
          result.add(new GVSSetClockPermission());
        }
        Resource userRes = getUserResource(principal.getUserName());
        if (userRes.hasProperty(RDF.type, AUTHORIZATION.ClockMaster));
        StmtIterator impersonateStmt = userRes.listProperties(AUTHORIZATION.mayImpersonate);
        while (impersonateStmt.hasNext()) {
          result.add(new GVSImpersonatePermission(new SourceImpl(impersonateStmt.nextStatement().getResource().toString())));
        }
      }
     
    //}
    return result;
View Full Code Here

  /* (non-Javadoc)
   * @see java.security.Policy#getPermissions(java.security.CodeSource)
   */
  @Override
  public PermissionCollection getPermissions(CodeSource arg0) {
    PermissionCollection result = new Permissions();
    result.add(new GVSImpersonatePermission());
    result.add(new GVSSetClockPermission());
    return result;
  }
View Full Code Here

      synchronized(this) {
        if (!hasPermissions) {
          hasPermissions = true;
          getParents();

          Permissions perms = new Permissions();
          for (int i=0; i<_groups.length; i++) {
            PermissionCollection groupCol = _groups[i].getCombinedPermissions();
            if (groupCol != null) {
              for (Enumeration enu = groupCol.elements(); enu.hasMoreElements(); ) {
                perms.add((Permission)enu.nextElement());
              }
            }
          }
          //combine own permissions
          for (Enumeration enu = getPermissions().elements(); enu.hasMoreElements(); ) {
            perms.add((Permission)enu.nextElement());
          }
         
          _combined = perms;
        }
      }
View Full Code Here

    return null;
  }
 

  static PermissionCollection loadPermissions(DirContext ctx, String dn) throws Exception {
    Permissions result = new Permissions();
    Attributes attrs = ctx.getAttributes(dn, new String[] { "description" });
    Attribute desc = attrs.get("description");
    if (desc != null) {
      for (int i=0, l=desc.size(); i<l; i++) {
        try {
          String[] permSt = parsePermission((String)desc.get(i));
          result.add( PolicyPreferences.createPermission(permSt) );
        } catch(Throwable t) {
          throw new OperationFailedException("LDAPRealm.loadPermissions(): "+t.getMessage());
        }
      }
    }
View Full Code Here

    try {
      connImpl = getConnection();
      ctx = (DirContext)connImpl.getConnection();

      PermissionCollection storage = LDAPRealm.loadPermissions(ctx, dn);
      PermissionCollection altered = new Permissions();
     
      boolean found = false;
      for (Enumeration enu=storage.elements(); enu.hasMoreElements(); ) {
        Permission p = (Permission)enu.nextElement();
        if (perm.equals(p)) {
          found = true;
        } else {
          altered.add(p);
        }
      }
      if (found) {
        LDAPRealm.savePermissions(ctx, dn, altered);
        _zone.log().error("--removePermissions() perm removed: "+altered);
View Full Code Here

  protected void addInitialPermission(Permission perm)
  {
    _permissions.add(perm);
    if (_collection == null) {
      _collection = new Permissions();
    }
    _collection.add(perm);
  }
View Full Code Here

    if (!hasPermissions) {
      synchronized(this) {
        if (!hasPermissions) {
          hasPermissions = true;
          getParents();
          Permissions perms = new Permissions();
          for (int i=0; i<parents.length; i++) {
            PermissionCollection parentCol = parents[i].getCombinedPermissions();
            if (parentCol != null) {
              for (Enumeration enu = parentCol.elements(); enu.hasMoreElements(); ) {
                perms.add((Permission)enu.nextElement());
              }
            }
          }
          //combine own permissions
          for (Enumeration enu = getPermissions().elements(); enu.hasMoreElements(); ) {
            perms.add((Permission)enu.nextElement());
          }
         
          combined = perms;
        }
      }
View Full Code Here

        // initial state is open
        resetState();

        // init permissions
        excludedPermissions = new Permissions();
        uncheckedPermissions = new Permissions();
        rolePermissions = new HashMap<String, PermissionCollection>();
    }
View Full Code Here

        }
        PermissionCollection permissionsOfRole = rolePermissions.get(roleName);

        // create permission object if no previous permission for the given role
        if (permissionsOfRole == null) {
            permissionsOfRole = new Permissions();
        }
        permissionsOfRole.add(permission);

        // add to the list
        rolePermissions.put(roleName, permissionsOfRole);
View Full Code Here

TOP

Related Classes of java.security.Permissions$MyPermissionCollection

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.