@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()); } } } });
@Override public void checkPermission(final Permission perm) { if (perm instanceof RuntimePermission) { // deny access to the classloader to trigger the security exception if ("getClassLoader".equals(perm.getName())) { throw new SecurityException(perm.toString()); } } } });
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()); } } } }
public void detectException(String checkName, Permission perm) { for (StackTraceElement elem : Thread.currentThread().getStackTrace()) { if ("com.mtso.blazer.ObjectGenerator".equals(elem.getClassName()) && "generate".equals(elem.getMethodName())) { manager.getStdOut().println("[*] BlazerSecurityManager permissions monitor --> " + perm.toString()); } } }
/** * Set the set of permissions required for read access to a triple-collection, if * the set is non-empty the default TCPermisson is no longer required. * * @param GraphUri * @param permissionDescriptions */ public void setRequiredReadPermissions(IRI GraphUri, Collection<Permission> permissions) { Collection<String> permissionStrings = new ArrayList<String>(); for (Permission permission : permissions) { permissionStrings.add(permission.toString()); } setRequiredReadPermissionStrings(GraphUri, permissionStrings); }
/** * Set the set of permissions required for read access to a triple-collection, if * the set is non-empty the default TCPermisson is no longer required. * * @param GraphUri * @param permissionDescriptions */ public void setRequiredReadPermissions(IRI GraphUri, Collection<Permission> permissions) { Collection<String> permissionStrings = new ArrayList<String>(); for (Permission permission : permissions) { permissionStrings.add(permission.toString()); } setRequiredReadPermissionStrings(GraphUri, permissionStrings); }
/** * Set the set of permissions required for read-write access to a * triple-collection, if * the set is non-empty the default TCPermisson is no longer required. * * @param GraphUri * @param permissionDescriptions */ public void setRequiredReadWritePermissions(IRI GraphUri, Collection<Permission> permissions) { Collection<String> permissionStrings = new ArrayList<String>(); for (Permission permission : permissions) { permissionStrings.add(permission.toString()); } setRequiredReadWritePermissionStrings(GraphUri, permissionStrings); }
/** * Set the set of permissions required for read-write access to a * triple-collection, if * the set is non-empty the default TCPermisson is no longer required. * * @param GraphUri * @param permissionDescriptions */ public void setRequiredReadWritePermissions(IRI GraphUri, Collection<Permission> permissions) { Collection<String> permissionStrings = new ArrayList<String>(); for (Permission permission : permissions) { permissionStrings.add(permission.toString()); } setRequiredReadWritePermissionStrings(GraphUri, permissionStrings); }
/** * Returns a string representation of the contents of this ACL entry. * @return a string representation of the contents. */ public String toString() { StringBuilder sb = new StringBuilder(); Principal p = getPrincipal(); sb.append( "[AclEntry ALLOW " + ( p != null ? p.getName() : "null" ) ); sb.append( " " ); for( Permission pp : m_permissions ) { sb.append( pp.toString() ); sb.append( "," ); } sb.append( "]" ); return sb.toString(); }
/** * Returns a string representation of the contents of this Acl. * @return the string representation */ public String toString() { StringBuilder sb = new StringBuilder(); for( AclEntry entry : m_entries ) { Principal pal = entry.getPrincipal(); if( pal != null ) sb.append( " user = "+pal.getName()+": " ); else sb.append( " user = null: " ); sb.append( "(" ); for( Enumeration<Permission> perms = entry.permissions(); perms.hasMoreElements(); ) { Permission perm = perms.nextElement(); sb.append( perm.toString() ); } sb.append( ")\n" ); } return sb.toString(); }
StringBuffer tmp = new StringBuffer(super.toString()); tmp.append('['); if( methodInterface != null )
StringBuffer tmp = new StringBuffer(super.toString()); tmp.append('['); if( methodInterface != null )
StringBuffer tmp = new StringBuffer(super.toString()); tmp.append('['); if( methodInterface != null )
public static void logPermissions(String classpathName, Set<Permission> permissions, Logger log) { Lang.denyNull("classpath name", classpathName); Lang.denyNull("permissions", permissions); Lang.denyNull("log", log); if (log.isDebugEnabled()) { if (permissions.isEmpty()) { log.info("Granting no permissions to classpath {}.", classpathName); } else { log.info("Granting the following permissions to classpath {}.", classpathName); for (Permission p : permissions) { log.debug("Granting permission {}", p.toString()); } } } }
private void logSecurityException(Permission perm, SecurityException e) throws SecurityException { if (logDeny()) { // schuettec - 06.02.2017 : ISSUE #69 : We have no other chance to reach the plugin's output here than using // System.out because we do not have a reference to the plugin's custom logger. System.out.println("Permission was not granted: " + perm.toString()); if (dumpDenyThreadStack()) { dumpStackTrace(); } } throw e; }
logger.log(Level.FINE, "[Web-Security] Codesource with Web URL: {0}", codesource.getLocation().toString()); logger.log(Level.FINE, "[Web-Security] Checking Web Permission with Principals : {0}", principalSetToString(principalSet)); logger.log(Level.FINE, "[Web-Security] Web Permission = {0}", perm.toString());
private void logRequest(Permission perm) { if (logRequests()) { String request = getRequest(); boolean handleRequest = handleRequest(request); if (handleRequest) { // schuettec - 06.02.2017 : ISSUE #69 : We have no other chance to reach the plugin's output here than using // System.out because we do not have a reference to the plugin's custom logger. System.out.printf("Permission granted %s.", perm.toString()); if (dumpRequestThreadStack()) { dumpStackTrace(); } } } }
public void checkPermission(String key) { try { // Checking a random permission to check if it is server. if(isEmbeddedServer() || habitat == null || isACC() || isNotServerORACC()){ return; } Permission perm = new RuntimePermission("SSLPassword"); AccessController.checkPermission(perm); } catch (AccessControlException e) { String message = e.getMessage(); Permission perm = new PropertyPermission(key, "read"); if (message != null) { message = message.replace(e.getPermission().toString(), perm.toString()); } throw new AccessControlException(message, perm); } }
public static void checkPermission(String key) { try { // Checking a random permission to check if it is server. if(Util.isEmbeddedServer() || Util.getDefaultHabitat() == null || Util.getInstance().isACC() || Util.getInstance().isNotServerORACC()){ return; } Permission perm = new RuntimePermission("SSLPassword"); AccessController.checkPermission(perm); } catch (AccessControlException e) { String message = e.getMessage(); Permission perm = new PropertyPermission(key, "read"); if (message != null) { message = message.replace(e.getPermission().toString(), perm.toString()); } throw new AccessControlException(message, perm); } }
public static void checkPermission(String key) { try { // Checking a random permission to check if it is server. if(Util.isEmbeddedServer() || Util.getDefaultHabitat() == null || Util.getInstance().isACC() || Util.getInstance().isNotServerOrACC()){ return; } Permission perm = new RuntimePermission("SSLPassword"); AccessController.checkPermission(perm); } catch (AccessControlException e) { String message = e.getMessage(); Permission perm = new PropertyPermission(key, "read"); if (message != null) { message = message.replace(e.getPermission().toString(), perm.toString()); } throw new AccessControlException(message, perm); } }