mirror of
https://github.com/corda/corda.git
synced 2025-06-16 06:08:13 +00:00
dummy SecurityManager and related classes added
This commit is contained in:
30
classpath/java/lang/SecurityManager.java
Normal file
30
classpath/java/lang/SecurityManager.java
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
/* Copyright (c) 2010, Avian Contributors
|
||||||
|
|
||||||
|
Permission to use, copy, modify, and/or distribute this software
|
||||||
|
for any purpose with or without fee is hereby granted, provided
|
||||||
|
that the above copyright notice and this permission notice appear
|
||||||
|
in all copies.
|
||||||
|
|
||||||
|
There is NO WARRANTY for this software. See license.txt for
|
||||||
|
details. */
|
||||||
|
|
||||||
|
package java.lang;
|
||||||
|
|
||||||
|
import java.security.AccessController;
|
||||||
|
import java.security.Permission;
|
||||||
|
import java.security.SecurityPermission;
|
||||||
|
|
||||||
|
public class SecurityManager {
|
||||||
|
|
||||||
|
public SecurityManager() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public void checkPermission(Permission perm) {
|
||||||
|
AccessController.checkPermission(perm);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void checkSecurityAccess(String target) {
|
||||||
|
checkPermission(new SecurityPermission(target));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -22,6 +22,7 @@ import java.util.Properties;
|
|||||||
public abstract class System {
|
public abstract class System {
|
||||||
private static Property properties;
|
private static Property properties;
|
||||||
|
|
||||||
|
private static SecurityManager securityManager;
|
||||||
// static {
|
// static {
|
||||||
// loadLibrary("natives");
|
// loadLibrary("natives");
|
||||||
// }
|
// }
|
||||||
@ -118,6 +119,14 @@ public abstract class System {
|
|||||||
public static void exit(int code) {
|
public static void exit(int code) {
|
||||||
Runtime.getRuntime().exit(code);
|
Runtime.getRuntime().exit(code);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static SecurityManager getSecurityManager() {
|
||||||
|
return securityManager;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void setSecurityManager(SecurityManager securityManager) {
|
||||||
|
System.securityManager = securityManager;
|
||||||
|
}
|
||||||
|
|
||||||
private static class Property {
|
private static class Property {
|
||||||
public final String name;
|
public final String name;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* Copyright (c) 2008, Avian Contributors
|
/* Copyright (c) 2008, 2010 Avian Contributors
|
||||||
|
|
||||||
Permission to use, copy, modify, and/or distribute this software
|
Permission to use, copy, modify, and/or distribute this software
|
||||||
for any purpose with or without fee is hereby granted, provided
|
for any purpose with or without fee is hereby granted, provided
|
||||||
@ -21,5 +21,9 @@ public class AccessController {
|
|||||||
public static Object doPrivileged (PrivilegedAction action) {
|
public static Object doPrivileged (PrivilegedAction action) {
|
||||||
return action.run();
|
return action.run();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void checkPermission(Permission perm) throws AccessControlException {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -10,4 +10,10 @@
|
|||||||
|
|
||||||
package java.security;
|
package java.security;
|
||||||
|
|
||||||
public class AllPermission extends Permission { }
|
public class AllPermission extends Permission {
|
||||||
|
public AllPermission() {
|
||||||
|
super("<all>");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
19
classpath/java/security/BasicPermission.java
Normal file
19
classpath/java/security/BasicPermission.java
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
/* Copyright (c) 2010, Avian Contributors
|
||||||
|
|
||||||
|
Permission to use, copy, modify, and/or distribute this software
|
||||||
|
for any purpose with or without fee is hereby granted, provided
|
||||||
|
that the above copyright notice and this permission notice appear
|
||||||
|
in all copies.
|
||||||
|
|
||||||
|
There is NO WARRANTY for this software. See license.txt for
|
||||||
|
details. */
|
||||||
|
|
||||||
|
package java.security;
|
||||||
|
|
||||||
|
public class BasicPermission extends Permission {
|
||||||
|
|
||||||
|
public BasicPermission(String name) {
|
||||||
|
super(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -11,6 +11,22 @@
|
|||||||
package java.security;
|
package java.security;
|
||||||
|
|
||||||
public abstract class Permission {
|
public abstract class Permission {
|
||||||
|
|
||||||
|
protected String name;
|
||||||
|
|
||||||
|
public Permission(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return this.getClass().getSimpleName() + '['+name+']';
|
||||||
|
}
|
||||||
|
|
||||||
public PermissionCollection newPermissionCollection() {
|
public PermissionCollection newPermissionCollection() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
19
classpath/java/security/SecurityPermission.java
Normal file
19
classpath/java/security/SecurityPermission.java
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
/* Copyright (c) 2010, Avian Contributors
|
||||||
|
|
||||||
|
Permission to use, copy, modify, and/or distribute this software
|
||||||
|
for any purpose with or without fee is hereby granted, provided
|
||||||
|
that the above copyright notice and this permission notice appear
|
||||||
|
in all copies.
|
||||||
|
|
||||||
|
There is NO WARRANTY for this software. See license.txt for
|
||||||
|
details. */
|
||||||
|
|
||||||
|
package java.security;
|
||||||
|
|
||||||
|
public class SecurityPermission extends BasicPermission {
|
||||||
|
|
||||||
|
public SecurityPermission(String name) {
|
||||||
|
super(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Reference in New Issue
Block a user