-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCustomSecurity.java
More file actions
33 lines (29 loc) · 882 Bytes
/
CustomSecurity.java
File metadata and controls
33 lines (29 loc) · 882 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package distsys;
/**
* Created by thb on 07.02.14.
*/
import java.security.*;
import java.util.*;
/**
* This is a SecurityManager that grants all kinds of permissions, but
* logs and outputs any non-standard permissions granted.
*/
public class CustomSecurity extends SecurityManager {
private Hashtable grantedPermissions;
public CustomSecurity() {
grantedPermissions = new Hashtable();
}
/**
* Override checkPermission to grant all kind of permissions:
*/
public void checkPermission(Permission perm) {
try {
super.checkPermission(perm);
} catch(AccessControlException ace) {
if(grantedPermissions.get(perm) == null) {
//System.out.println("LiberalSecurityManager granted permission: "+perm);
grantedPermissions.put(perm, perm);
}
}
}
}