home *** CD-ROM | disk | FTP | other *** search
- import java.io.DataInputStream;
- import java.io.FileDescriptor;
- import java.io.IOException;
-
- class PasswordSecurityManager extends SecurityManager {
- private String password;
-
- PasswordSecurityManager(String var1) {
- this.password = var1;
- }
-
- private boolean accessOK() {
- DataInputStream var1 = new DataInputStream(System.in);
- System.out.println("What's the secret password?");
-
- try {
- String var2 = var1.readLine();
- return var2.equals(this.password);
- } catch (IOException var3) {
- return false;
- }
- }
-
- public void checkRead(FileDescriptor var1) {
- if (!this.accessOK()) {
- throw new SecurityException("Not a Chance!");
- }
- }
-
- public void checkRead(String var1) {
- if (!this.accessOK()) {
- throw new SecurityException("No Way!");
- }
- }
-
- public void checkRead(String var1, Object var2) {
- if (!this.accessOK()) {
- throw new SecurityException("Forget It!");
- }
- }
-
- public void checkWrite(FileDescriptor var1) {
- if (!this.accessOK()) {
- throw new SecurityException("Not!");
- }
- }
-
- public void checkWrite(String var1) {
- if (!this.accessOK()) {
- throw new SecurityException("Not Even!");
- }
- }
- }
-