Tabnine Logo
Permission
Code IndexAdd Tabnine to your IDE (free)

How to use
Permission
in
java.security

Best Java code snippets using java.security.Permission (Showing top 20 results out of 1,611)

Refine searchRefine arrow

  • URL
  • Enumeration
  • Permissions
origin: igniterealtime/Openfire

String binaryPath = (new URL(Shaj.class.getProtectionDomain()
    .getCodeSource().getLocation(), ".")).openConnection()
    .getPermission().getName();
binaryPath = (new File(binaryPath)).getCanonicalPath();
origin: wildfly/wildfly

private void handlePermissionCheckEvent(SecurityPermissionCheckEvent event, StringBuilder stringBuilder) {
  handleDefiniteOutcomeEvent(event, stringBuilder);
  Permission permission = event.getPermission();
  stringBuilder.append(",permission=[type=").append(permission.getClass().getName());
  stringBuilder.append(",actions=").append(permission.getActions());
  stringBuilder.append(",name=").append(permission.getName()).append(']');
}
origin: robovm/robovm

  /**
   * Indicates whether the argument permission is implied by the permissions
   * contained in the receiver.
   *
   * @return boolean <code>true</code> if the argument permission is implied
   *         by the permissions in the receiver, and <code>false</code> if
   *         it is not.
   * @param permission
   *            java.security.Permission the permission to check
   */
  public boolean implies(Permission permission) {
    for (Enumeration elements = elements(); elements.hasMoreElements();) {
      if (((Permission)elements.nextElement()).implies(permission)) {
        return true;
      }
    }
    return false;
  }
}
origin: wildfly/wildfly

  public boolean implies(final Permission permission) {
    if (permission == null || getSourcePermission().getClass() != permission.getClass()) {
      return false;
    }
    final Permission all = this.all;
    if (all != null) {
      return all.implies(permission);
    }
    final Permission ourPermission = byName.get(permission.getName());
    return ourPermission != null && ourPermission.implies(permission);
  }
}
origin: org.apache.logging.log4j/log4j-core

  @Override
  public void checkPermission(final Permission perm) {
    if (perm instanceof RuntimePermission) {
      // deny access to the class to trigger the security exception
      if ("accessClassInPackage.sun.nio.ch".equals(perm.getName())) {
        throw new SecurityException(perm.toString());
      }
    }
  }
});
origin: org.glassfish.security/security

private static boolean grantedIsExcluded(Permission granted, Permissions excluded) {
boolean isExcluded = false;
if (excluded != null) {
  if (!excluded.implies(granted)) {
  Enumeration e = excluded.elements();
  while (!isExcluded && e.hasMoreElements()) {
    Permission excludedPerm = (Permission) e.nextElement();
    if (granted.implies(excludedPerm))  {
    isExcluded = true;
    }
  }
  } else {
  isExcluded = true;
  }
}
if (logger.isLoggable(Level.FINEST)){
  if (isExcluded) {
  logger.finest("JACC Policy Provider: permission is excluded: "+granted);
  }
}
return isExcluded;
}

origin: org.apache.geronimo.ext.openejb/openejb-core

  /**
   * Removes permissions from <code>toBeChecked</code> that are implied by
   * <code>permission</code>.
   *
   * @param toBeChecked the permissions that are to be checked and possibly culled
   * @param permission  the permission that is to be used for culling
   * @return the culled set of permissions that are not implied by <code>permission</code>
   */
  private Permissions cullPermissions(Permissions toBeChecked, Permission permission) {
    Permissions result = new Permissions();

    for (Enumeration e = toBeChecked.elements(); e.hasMoreElements();) {
      Permission test = (Permission) e.nextElement();
      if (!permission.implies(test)) {
        result.add(test);
      }
    }

    return result;
  }
}
origin: org.mobicents.servers.jainslee.core/components

private void doPermDump(PermissionCollection pc, String string) {
  Enumeration<Permission> en = pc.elements();
  while (en.hasMoreElements()) {
    Permission p = en.nextElement();
    logger.info(string + "===>P:" + p.getClass() + " N:" + p.getName() + " A:" + p.getActions());
  }
}
origin: org.eclipse.jetty/jetty-util

file =new File(url.toURI());
assertValidPath(file.toString());
if (!url.toString().startsWith("file:"))
  throw new IllegalArgumentException("!file:");
  String file_url="file:"+URIUtil.encodePath(url.toString().substring(5));
  URI uri = new URI(file_url);
  if (uri.getAuthority()==null)
  URLConnection connection=url.openConnection();
  Permission perm = connection.getPermission();
  file = new File(perm==null?url.getFile():perm.getName());
origin: org.mortbay.jetty/jetty-util

/**
 * Returns an File representing the given resource or NULL if this
 * is not possible.
 */
public File getFile()
  throws IOException
{
  // Try the permission hack
  if (checkConnection())
  {
    Permission perm = _connection.getPermission();
    if (perm instanceof java.io.FilePermission)
      return new File(perm.getName());
  }
  // Try the URL file arg
  try {return new File(_url.getFile());}
  catch(Exception e) {Log.ignore(e);}
  // Don't know the file
  return null;    
}
origin: org.mortbay.jetty/jetty-util

_file =new File(new URI(url.toString()));
  String file_url="file:"+URIUtil.encodePath(url.toString().substring(5));           
  URI uri = new URI(file_url);
  if (uri.getAuthority()==null) 
    _file = new File(uri);
  else
    _file = new File("//"+uri.getAuthority()+URIUtil.decodePath(url.getFile()));
  _file = new File(perm==null?url.getFile():perm.getName());
origin: org.glassfish.security/security

static Permissions addToRoleMap(HashMap<String, Permissions> map,
        String roleName, Permission p) {
  Permissions collection = map.get(roleName);
if (collection == null) {
  collection = new Permissions();
  map.put(roleName,collection);
}
collection.add(p);
if (logger.isLoggable(Level.FINE)){
  logger.log(Level.FINE,"JACC: constraint capture: adding methods to role: "+ roleName+" methods: " + p.getActions());
}
return collection;
}
  
origin: spring-projects/spring-framework

  @Override
  public void checkPermission(Permission perm) {
    // Disallowing access to System#getenv means that our
    // ReadOnlySystemAttributesMap will come into play.
    if ("getenv.*".equals(perm.getName())) {
      throw new AccessControlException("Accessing the system environment is disallowed");
    }
  }
};
origin: wildfly/wildfly

public boolean implies(final Permission permission) {
  for (Permission test : permissionsRef.get()) {
    if (test.implies(permission)) {
      return true;
    }
  }
  return false;
}
origin: org.apache.ant/ant

/**
 * The central point in checking permissions.
 * Overridden from java.lang.SecurityManager
 *
 * @param perm The permission requested.
 */
@Override
public void checkPermission(final java.security.Permission perm) {
  if (active) {
    if (delegateToOldSM && !perm.getName().equals("exitVM")) {
      boolean permOK = false;
      if (granted.implies(perm)) {
        permOK = true;
      }
      checkRevoked(perm);
      /*
       if the permission was not explicitly granted or revoked
       the original security manager will do its work
      */
      if (!permOK && origSm != null) {
        origSm.checkPermission(perm);
      }
    }  else {
      if (!granted.implies(perm)) {
        throw new SecurityException("Permission " + perm + " was not granted.");
      }
      checkRevoked(perm);
    }
  }
}
origin: org.osgi/org.osgi.compendium

/**
 * Returns the String representation of the action list.
 * 
 * @return Action list of this permission instance. It is always
 *         "privatearea".
 * @see java.security.Permission#getActions()
 */
public String getActions() {
  return delegate.getActions();
}
origin: org.osgi/org.osgi.compendium

/**
 * Returns a new PermissionCollection object for storing
 * DeploymentAdminPermission objects.
 * 
 * @return The new PermissionCollection.
 * @see java.security.Permission#newPermissionCollection()
 */
public PermissionCollection newPermissionCollection() {
  return delegate.newPermissionCollection();
}
origin: com.remondis.limbus/limbus-engine-impl

private void logDefaultPermissions(Set<Permission> permissions) {
 if (log.isDebugEnabled()) {
  if (permissions.isEmpty()) {
   log.debug(
     "Granting no sandbox permissions by default for Limbus plugins. Edit classpath file {} to change this.",
     SANDBOX_DEFAULT_PERMISSIONS);
  } else {
   log.debug(
     "Granting the following permissions by default for Limbus plugins. Edit classpath file {} to change this.",
     SANDBOX_DEFAULT_PERMISSIONS);
   for (Permission p : permissions) {
    log.debug("- Granting permission: {}", p.toString());
   }
  }
 }
}
origin: org.osgi/org.osgi.compendium

/**
 * Checks two DeploymentAdminPermission objects for equality. Two permission
 * objects are equal if:
 * <p>
 * 
 * <ul>
 * <li>their target filters are semantically equal and</li>
 * <li>their actions are the same</li>
 * </ul>
 * 
 * @param obj The reference object with which to compare.
 * @return true if the two objects are equal.
 * @see java.lang.Object#equals(java.lang.Object)
 */
public boolean equals(Object obj) {
  if (obj == this)
    return true;
  if (!(obj instanceof DeploymentAdminPermission))
    return false;
  DeploymentAdminPermission dap = (DeploymentAdminPermission) obj;
  return delegate.equals(dap.delegate);
}
origin: org.glassfish.main.security/security-ee

private static boolean grantedIsExcluded(Permission granted, Permissions excluded) {
boolean isExcluded = false;
if (excluded != null) {
  if (!excluded.implies(granted)) {
  Enumeration e = excluded.elements();
  while (!isExcluded && e.hasMoreElements()) {
    Permission excludedPerm = (Permission) e.nextElement();
    if (granted.implies(excludedPerm))  {
    isExcluded = true;
    }
  }
  } else {
  isExcluded = true;
  }
}
if (logger.isLoggable(Level.FINEST)){
  if (isExcluded) {
  logger.finest("JACC Policy Provider: permission is excluded: "+granted);
  }
}
return isExcluded;
}

java.securityPermission

Javadoc

Legacy security code; do not use.

Most used methods

  • getName
    Returns the name of this Permission. For example, in the case of a java.io.FilePermission, the name
  • getActions
    Returns the actions as a String. This is abstract so subclasses can defer creating a String represen
  • implies
    Checks if the specified permission's actions are "implied by" this object's actions. This must be im
  • newPermissionCollection
    Returns an empty PermissionCollection for a given Permission object, or null if one is not defined.
  • toString
    Returns a string describing this Permission. The convention is to specify the class name, the permis
  • equals
    Checks two Permission objects for equality. Do not use the equals method for making access control d
  • hashCode
    Returns the hash code value for this Permission object. The required hashCode behavior for Permissio
  • checkGuard
    Implements the guard interface for a permission. The SecurityManager.checkPermission method is calle

Popular in Java

  • Finding current android device location
  • getResourceAsStream (ClassLoader)
  • getSystemService (Context)
  • startActivity (Activity)
  • BorderLayout (java.awt)
    A border layout lays out a container, arranging and resizing its components to fit in five regions:
  • BufferedWriter (java.io)
    Wraps an existing Writer and buffers the output. Expensive interaction with the underlying reader is
  • OutputStream (java.io)
    A writable sink for bytes.Most clients will use output streams that write data to the file system (
  • Timer (java.util)
    Timers schedule one-shot or recurring TimerTask for execution. Prefer java.util.concurrent.Scheduled
  • ExecutorService (java.util.concurrent)
    An Executor that provides methods to manage termination and methods that can produce a Future for tr
  • Manifest (java.util.jar)
    The Manifest class is used to obtain attribute information for a JarFile and its entries.
  • From CI to AI: The AI layer in your organization
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now