com.ettrema.http.fs
Class SimpleSecurityManager

java.lang.Object
  extended by com.ettrema.http.fs.SimpleSecurityManager
All Implemented Interfaces:
SecurityManager

public class SimpleSecurityManager
extends java.lang.Object
implements SecurityManager

Has a realm and a map where the keys are user names and the values are passwords

Author:
brad

Constructor Summary
SimpleSecurityManager()
           
SimpleSecurityManager(DigestGenerator digestGenerator)
           
SimpleSecurityManager(java.lang.String realm, java.util.Map<java.lang.String,java.lang.String> nameAndPasswords)
           
 
Method Summary
 java.lang.Object authenticate(DigestResponse digestRequest)
          Authenticate a digest request See com.bradmcevoy.http.http11.auth.DigestGenerator
 java.lang.Object authenticate(java.lang.String user, java.lang.String password)
           
 boolean authorise(Request request, Request.Method method, Auth auth, Resource resource)
          Check that the authenticater user can access the given resource for the given method.
 java.lang.String getRealm(java.lang.String host)
           
 java.lang.Object getUserByName(java.lang.String name)
           
 void setNameAndPasswords(java.util.Map<java.lang.String,java.lang.String> nameAndPasswords)
           
 void setRealm(java.lang.String realm)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleSecurityManager

public SimpleSecurityManager()

SimpleSecurityManager

public SimpleSecurityManager(DigestGenerator digestGenerator)

SimpleSecurityManager

public SimpleSecurityManager(java.lang.String realm,
                             java.util.Map<java.lang.String,java.lang.String> nameAndPasswords)
Method Detail

getUserByName

public java.lang.Object getUserByName(java.lang.String name)

authenticate

public java.lang.Object authenticate(java.lang.String user,
                                     java.lang.String password)
Specified by:
authenticate in interface SecurityManager
Returns:
- some object representing the user to associate with the request

authenticate

public java.lang.Object authenticate(DigestResponse digestRequest)
Description copied from interface: SecurityManager
Authenticate a digest request See com.bradmcevoy.http.http11.auth.DigestGenerator

Specified by:
authenticate in interface SecurityManager
Returns:

authorise

public boolean authorise(Request request,
                         Request.Method method,
                         Auth auth,
                         Resource resource)
Description copied from interface: SecurityManager
Check that the authenticater user can access the given resource for the given method.

Specified by:
authorise in interface SecurityManager
Parameters:
request - - the request itself
method - - the request method
auth - - authentication object representing the current user
resource - - the resource being operated on
Returns:
- true to indicate that the user is allowed access

getRealm

public java.lang.String getRealm(java.lang.String host)
Specified by:
getRealm in interface SecurityManager
Returns:
- the name of the security realm this is managing

setRealm

public void setRealm(java.lang.String realm)
Parameters:
realm - the realm to set

setNameAndPasswords

public void setNameAndPasswords(java.util.Map<java.lang.String,java.lang.String> nameAndPasswords)


Copyright © 2011. All Rights Reserved.