java.security.acl.Permission Java Examples

The following examples show how to use java.security.acl.Permission. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AclEntryImpl.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
private AclEntryImpl (AclEntryImpl i) throws UnknownHostException {
      setPrincipal(i.getPrincipal());
      permList = new Vector<Permission>();
      commList = new Vector<String>();

      for (Enumeration<String> en = i.communities(); en.hasMoreElements();){
        addCommunity(en.nextElement());
      }

      for (Enumeration<Permission> en = i.permissions(); en.hasMoreElements();){
        addPermission(en.nextElement());
      }
      if (i.isNegative()) setNegativePermissions();
}
 
Example #2
Source File: AclEntryImpl.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
private AclEntryImpl (AclEntryImpl i) throws UnknownHostException {
      setPrincipal(i.getPrincipal());
      permList = new Vector<Permission>();
      commList = new Vector<String>();

      for (Enumeration<String> en = i.communities(); en.hasMoreElements();){
        addCommunity(en.nextElement());
      }

      for (Enumeration<Permission> en = i.permissions(); en.hasMoreElements();){
        addPermission(en.nextElement());
      }
      if (i.isNegative()) setNegativePermissions();
}
 
Example #3
Source File: AclEntryImpl.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
private AclEntryImpl (AclEntryImpl i) throws UnknownHostException {
      setPrincipal(i.getPrincipal());
      permList = new Vector<Permission>();
      commList = new Vector<String>();

      for (Enumeration<String> en = i.communities(); en.hasMoreElements();){
        addCommunity(en.nextElement());
      }

      for (Enumeration<Permission> en = i.permissions(); en.hasMoreElements();){
        addPermission(en.nextElement());
      }
      if (i.isNegative()) setNegativePermissions();
}
 
Example #4
Source File: AclEntryImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
private AclEntryImpl (AclEntryImpl i) throws UnknownHostException {
      setPrincipal(i.getPrincipal());
      permList = new Vector<Permission>();
      commList = new Vector<String>();

      for (Enumeration<String> en = i.communities(); en.hasMoreElements();){
        addCommunity(en.nextElement());
      }

      for (Enumeration<Permission> en = i.permissions(); en.hasMoreElements();){
        addPermission(en.nextElement());
      }
      if (i.isNegative()) setNegativePermissions();
}
 
Example #5
Source File: AclEntryImpl.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
private AclEntryImpl (AclEntryImpl i) throws UnknownHostException {
      setPrincipal(i.getPrincipal());
      permList = new Vector<Permission>();
      commList = new Vector<String>();

      for (Enumeration<String> en = i.communities(); en.hasMoreElements();){
        addCommunity(en.nextElement());
      }

      for (Enumeration<Permission> en = i.permissions(); en.hasMoreElements();){
        addPermission(en.nextElement());
      }
      if (i.isNegative()) setNegativePermissions();
}
 
Example #6
Source File: AclEntryImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
private AclEntryImpl (AclEntryImpl i) throws UnknownHostException {
      setPrincipal(i.getPrincipal());
      permList = new Vector<Permission>();
      commList = new Vector<String>();

      for (Enumeration<String> en = i.communities(); en.hasMoreElements();){
        addCommunity(en.nextElement());
      }

      for (Enumeration<Permission> en = i.permissions(); en.hasMoreElements();){
        addPermission(en.nextElement());
      }
      if (i.isNegative()) setNegativePermissions();
}
 
Example #7
Source File: AclEntryImpl.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
private AclEntryImpl (AclEntryImpl i) throws UnknownHostException {
      setPrincipal(i.getPrincipal());
      permList = new Vector<Permission>();
      commList = new Vector<String>();

      for (Enumeration<String> en = i.communities(); en.hasMoreElements();){
        addCommunity(en.nextElement());
      }

      for (Enumeration<Permission> en = i.permissions(); en.hasMoreElements();){
        addPermission(en.nextElement());
      }
      if (i.isNegative()) setNegativePermissions();
}
 
Example #8
Source File: AclEntryImpl.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
private AclEntryImpl (AclEntryImpl i) throws UnknownHostException {
      setPrincipal(i.getPrincipal());
      permList = new Vector<Permission>();
      commList = new Vector<String>();

      for (Enumeration<String> en = i.communities(); en.hasMoreElements();){
        addCommunity(en.nextElement());
      }

      for (Enumeration<Permission> en = i.permissions(); en.hasMoreElements();){
        addPermission(en.nextElement());
      }
      if (i.isNegative()) setNegativePermissions();
}
 
Example #9
Source File: AclEntryImpl.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Constructs an ACL entry with a specified principal.
 *
 * @param p the principal to be set for this entry.
 */
public AclEntryImpl (Principal p) throws UnknownHostException {
      princ = p;
      permList = new Vector<Permission>();
      commList = new Vector<String>();
}
 
Example #10
Source File: AclEntryImpl.java    From dragonwell8_jdk with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Contructs an empty ACL entry.
 */
public AclEntryImpl (){
      princ = null;
      permList = new Vector<Permission>();
      commList = new Vector<String>();
}
 
Example #11
Source File: AclEntryImpl.java    From jdk1.8-source-analysis with Apache License 2.0 4 votes vote down vote up
/**
 * Constructs an ACL entry with a specified principal.
 *
 * @param p the principal to be set for this entry.
 */
public AclEntryImpl (Principal p) throws UnknownHostException {
      princ = p;
      permList = new Vector<Permission>();
      commList = new Vector<String>();
}
 
Example #12
Source File: AclEntryImpl.java    From dragonwell8_jdk with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Constructs an ACL entry with a specified principal.
 *
 * @param p the principal to be set for this entry.
 */
public AclEntryImpl (Principal p) throws UnknownHostException {
      princ = p;
      permList = new Vector<Permission>();
      commList = new Vector<String>();
}
 
Example #13
Source File: AclEntryImpl.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Contructs an empty ACL entry.
 */
public AclEntryImpl (){
      princ = null;
      permList = new Vector<Permission>();
      commList = new Vector<String>();
}
 
Example #14
Source File: AclEntryImpl.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Constructs an ACL entry with a specified principal.
 *
 * @param p the principal to be set for this entry.
 */
public AclEntryImpl (Principal p) throws UnknownHostException {
      princ = p;
      permList = new Vector<Permission>();
      commList = new Vector<String>();
}
 
Example #15
Source File: AclEntryImpl.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Contructs an empty ACL entry.
 */
public AclEntryImpl (){
      princ = null;
      permList = new Vector<Permission>();
      commList = new Vector<String>();
}
 
Example #16
Source File: AclEntryImpl.java    From jdk1.8-source-analysis with Apache License 2.0 4 votes vote down vote up
/**
 * Contructs an empty ACL entry.
 */
public AclEntryImpl (){
      princ = null;
      permList = new Vector<Permission>();
      commList = new Vector<String>();
}
 
Example #17
Source File: AclEntryImpl.java    From JDKSourceCode1.8 with MIT License 4 votes vote down vote up
/**
 * Contructs an empty ACL entry.
 */
public AclEntryImpl (){
      princ = null;
      permList = new Vector<Permission>();
      commList = new Vector<String>();
}
 
Example #18
Source File: AclEntryImpl.java    From JDKSourceCode1.8 with MIT License 4 votes vote down vote up
/**
 * Constructs an ACL entry with a specified principal.
 *
 * @param p the principal to be set for this entry.
 */
public AclEntryImpl (Principal p) throws UnknownHostException {
      princ = p;
      permList = new Vector<Permission>();
      commList = new Vector<String>();
}
 
Example #19
Source File: AclEntryImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Contructs an empty ACL entry.
 */
public AclEntryImpl (){
      princ = null;
      permList = new Vector<Permission>();
      commList = new Vector<String>();
}
 
Example #20
Source File: AclEntryImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Constructs an ACL entry with a specified principal.
 *
 * @param p the principal to be set for this entry.
 */
public AclEntryImpl (Principal p) throws UnknownHostException {
      princ = p;
      permList = new Vector<Permission>();
      commList = new Vector<String>();
}
 
Example #21
Source File: AclEntryImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Contructs an empty ACL entry.
 */
public AclEntryImpl (){
      princ = null;
      permList = new Vector<Permission>();
      commList = new Vector<String>();
}
 
Example #22
Source File: AclEntryImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Constructs an ACL entry with a specified principal.
 *
 * @param p the principal to be set for this entry.
 */
public AclEntryImpl (Principal p) throws UnknownHostException {
      princ = p;
      permList = new Vector<Permission>();
      commList = new Vector<String>();
}
 
Example #23
Source File: AclEntryImpl.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Contructs an empty ACL entry.
 */
public AclEntryImpl (){
      princ = null;
      permList = new Vector<Permission>();
      commList = new Vector<String>();
}
 
Example #24
Source File: AclEntryImpl.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Constructs an ACL entry with a specified principal.
 *
 * @param p the principal to be set for this entry.
 */
public AclEntryImpl (Principal p) throws UnknownHostException {
      princ = p;
      permList = new Vector<Permission>();
      commList = new Vector<String>();
}
 
Example #25
Source File: AclImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Returns an enumeration for the set of allowed permissions for
 * the specified principal
 * (representing an entity such as an individual or a group).
 * This set of allowed permissions is calculated as follows:
 * <UL>
 * <LI>If there is no entry in this Access Control List for the specified
 * principal, an empty permission set is returned.</LI>
 * <LI>Otherwise, the principal's group permission sets are determined.
 * (A principal can belong to one or more groups, where a group is a group
 * of principals, represented by the Group interface.)</LI>
 * </UL>
 * @param user the principal whose permission set is to be returned.
 * @return the permission set specifying the permissions the principal
 *     is allowed.
 * @see java.security.Principal
 */
@Override
public Enumeration<Permission> getPermissions(Principal user){
      Vector<Permission> empty = new Vector<>();
      for (Enumeration<AclEntry> e = entryList.elements();e.hasMoreElements();){
        AclEntry ent = e.nextElement();
        if (ent.getPrincipal().equals(user))
              return ent.permissions();
      }
      return empty.elements();
}
 
Example #26
Source File: AclImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Checks whether or not the specified principal has the specified
 * permission.
 * If it does, true is returned, otherwise false is returned.
 * More specifically, this method checks whether the passed permission
 * is a member of the allowed permission set of the specified principal.
 * The allowed permission set is determined by the same algorithm as is
 * used by the getPermissions method.
 *
 * @param user the principal, assumed to be a valid authenticated Principal.
 * @param community the community name associated with the principal.
 * @param perm the permission to be checked for.
 * @return true if the principal has the specified permission, false
 *        otherwise.
 * @see java.security.Principal
 * @see java.security.Permission
 */
public boolean checkPermission(Principal user, String community,
                               java.security.acl.Permission perm) {
      for (Enumeration<AclEntry> e = entryList.elements();e.hasMoreElements();){
        AclEntryImpl ent = (AclEntryImpl) e.nextElement();
        if (ent.getPrincipal().equals(user))
              if (ent.checkPermission(perm) && ent.checkCommunity(community)) return true;
      }
      return false;
}
 
Example #27
Source File: AclImpl.java    From jdk1.8-source-analysis with Apache License 2.0 3 votes vote down vote up
/**
 * Checks whether or not the specified principal has the specified
 * permission.
 * If it does, true is returned, otherwise false is returned.
 * More specifically, this method checks whether the passed permission
 * is a member of the allowed permission set of the specified principal.
 * The allowed permission set is determined by the same algorithm as is
 * used by the getPermissions method.
 *
 * @param user the principal, assumed to be a valid authenticated Principal.
 * @param perm the permission to be checked for.
 * @return true if the principal has the specified permission,
 *         false otherwise.
 * @see java.security.Principal
 * @see java.security.Permission
 */
@Override
public boolean checkPermission(Principal user,
                               java.security.acl.Permission perm) {
      for (Enumeration<AclEntry> e = entryList.elements();e.hasMoreElements();){
        AclEntry ent = e.nextElement();
        if (ent.getPrincipal().equals(user))
              if (ent.checkPermission(perm)) return true;
      }
      return false;
}
 
Example #28
Source File: AclImpl.java    From jdk1.8-source-analysis with Apache License 2.0 3 votes vote down vote up
/**
 * Checks whether or not the specified principal has the specified
 * permission.
 * If it does, true is returned, otherwise false is returned.
 * More specifically, this method checks whether the passed permission
 * is a member of the allowed permission set of the specified principal.
 * The allowed permission set is determined by the same algorithm as is
 * used by the getPermissions method.
 *
 * @param user the principal, assumed to be a valid authenticated Principal.
 * @param community the community name associated with the principal.
 * @param perm the permission to be checked for.
 * @return true if the principal has the specified permission, false
 *        otherwise.
 * @see java.security.Principal
 * @see java.security.Permission
 */
public boolean checkPermission(Principal user, String community,
                               java.security.acl.Permission perm) {
      for (Enumeration<AclEntry> e = entryList.elements();e.hasMoreElements();){
        AclEntryImpl ent = (AclEntryImpl) e.nextElement();
        if (ent.getPrincipal().equals(user))
              if (ent.checkPermission(perm) && ent.checkCommunity(community)) return true;
      }
      return false;
}
 
Example #29
Source File: AclImpl.java    From JDKSourceCode1.8 with MIT License 3 votes vote down vote up
/**
 * Checks whether or not the specified principal has the specified
 * permission.
 * If it does, true is returned, otherwise false is returned.
 * More specifically, this method checks whether the passed permission
 * is a member of the allowed permission set of the specified principal.
 * The allowed permission set is determined by the same algorithm as is
 * used by the getPermissions method.
 *
 * @param user the principal, assumed to be a valid authenticated Principal.
 * @param community the community name associated with the principal.
 * @param perm the permission to be checked for.
 * @return true if the principal has the specified permission, false
 *        otherwise.
 * @see java.security.Principal
 * @see java.security.Permission
 */
public boolean checkPermission(Principal user, String community,
                               java.security.acl.Permission perm) {
      for (Enumeration<AclEntry> e = entryList.elements();e.hasMoreElements();){
        AclEntryImpl ent = (AclEntryImpl) e.nextElement();
        if (ent.getPrincipal().equals(user))
              if (ent.checkPermission(perm) && ent.checkCommunity(community)) return true;
      }
      return false;
}
 
Example #30
Source File: AclImpl.java    From JDKSourceCode1.8 with MIT License 3 votes vote down vote up
/**
 * Checks whether or not the specified principal has the specified
 * permission.
 * If it does, true is returned, otherwise false is returned.
 * More specifically, this method checks whether the passed permission
 * is a member of the allowed permission set of the specified principal.
 * The allowed permission set is determined by the same algorithm as is
 * used by the getPermissions method.
 *
 * @param user the principal, assumed to be a valid authenticated Principal.
 * @param perm the permission to be checked for.
 * @return true if the principal has the specified permission,
 *         false otherwise.
 * @see java.security.Principal
 * @see java.security.Permission
 */
@Override
public boolean checkPermission(Principal user,
                               java.security.acl.Permission perm) {
      for (Enumeration<AclEntry> e = entryList.elements();e.hasMoreElements();){
        AclEntry ent = e.nextElement();
        if (ent.getPrincipal().equals(user))
              if (ent.checkPermission(perm)) return true;
      }
      return false;
}