package com.bradmcevoy.http;

import com.bradmcevoy.http.Request.Method;
import com.bradmcevoy.http.http11.auth.DigestResponse;

/**
 *
 * @author brad
 */
public class ReadOnlySecurityManager implements SecurityManager{

    public Object authenticate( String user, String password ) {
        return null;
    }

    public Object authenticate( DigestResponse digestRequest ) {
        return null;
    }



    public boolean authorise( Request request, Method method, Auth auth, Resource resource ) {
        switch(method) {
            case GET: return true;
            case HEAD: return true;
            case OPTIONS: return true;
            case PROPFIND: return true;
        }
        return false;
    }

    public String getRealm() {
        return null;
    }

    public Object getUserByName( String name ) {
        throw new UnsupportedOperationException( "Not supported yet." );
    }

}

@@ -215,16 +215,223 @@
 nager%7B%0A%0A
+    private final String realm;%0A%0A    public ReadOnlySecurityManager( String realm ) %7B%0A        this.realm = realm;%0A    %7D%0A%0A    public ReadOnlySecurityManager() %7B%0A        this.realm = %22ReadOnlyRealm%22;%0A    %7D%0A%0A%0A%0A
     publ
@@ -494,36 +494,36 @@
 %0A        return 
-null
+user
 ;%0A    %7D%0A%0A    pub
@@ -587,36 +587,55 @@
 %0A        return 
-null
+digestRequest.getUser()
 ;%0A    %7D%0A%0A%0A%0A    p
@@ -988,12 +988,13 @@
 urn 
-null
+realm
 ;%0A  

set realm on readonlysecuritymanager