FileDocCategorySizeDatePackage
PasswordSecurityManager.javaAPI DocExample1462Tue Dec 12 18:57:44 GMT 2000None

PasswordSecurityManager

public class PasswordSecurityManager extends SecurityManager

Fields Summary
private String
password
private BufferedReader
buffy
Constructors Summary
public PasswordSecurityManager(String p, BufferedReader b)

        super();
        this.password = p;
	this.buffy = b;
    
Methods Summary
private booleanaccessOK()

        int c;
        String response;

        System.out.println("What's the secret password?");
        try {
            response = buffy.readLine();
            if (response.equals(password))
                return true;
            else
                return false;
        } catch (IOException e) {
            return false;
        }
    
public voidcheckPropertiesAccess()

 
public voidcheckPropertyAccess(java.lang.String s)

 
public voidcheckRead(java.io.FileDescriptor filedescriptor)

        if (!accessOK())
            throw new SecurityException("Not a Chance!");
    
public voidcheckRead(java.lang.String filename)

        if (!accessOK())
            throw new SecurityException("No Way!");
    
public voidcheckRead(java.lang.String filename, java.lang.Object executionContext)

        if (!accessOK())
            throw new SecurityException("Forget It!");
    
public voidcheckWrite(java.io.FileDescriptor filedescriptor)

        if (!accessOK())
            throw new SecurityException("Not!");
    
public voidcheckWrite(java.lang.String filename)

        if (!accessOK())
            throw new SecurityException("Not Even!");