org.sandev.basics.util
Interface AuthUserLookup

All Known Subinterfaces:
UIFormOwner

public interface AuthUserLookup

An interface declaring this object supports finding an AuthUser via their ID. This is typically declared by a standard SAND node which can perform the necessary queries. It is expected that the implementor will make use of caching for fast processing.

One major use of this interface is by the Authorizer to retrieve user information for authorization processing after the decryption/authentication step.


Method Summary
 AuthUser getUserForID(long authID)
          Return the user for this ID.
 AuthUser getUserFromLogin(java.lang.String username, java.lang.String password)
          Given the login info, return the corresponding AuthUser or null if there is no match found.
 

Method Detail

getUserForID

public AuthUser getUserForID(long authID)
                      throws SandException
Return the user for this ID. Return null if the user ID is not valid or cannot be retrieved. Throw if processing fails for any reason.

Because this method is typically used during message authorization (such as a call to another node). Implementing classes must avoid triggering a potentially infinite recursion resulting from a cascaded messaging call.

One way to avoid problems is to retrieve the AuthUser from a cache, already populated in a previous getUserFromLogin call made during login processing. In other situations the cache may need to be populated using a separate call with a known AuthUser. A known user can be retrieved via username/password at startup so that it is available for subsequent user lookup as needed.

Throws:
SandException

getUserFromLogin

public AuthUser getUserFromLogin(java.lang.String username,
                                 java.lang.String password)
                          throws SandException
Given the login info, return the corresponding AuthUser or null if there is no match found. Throw if processing fails for any reason.

Throws:
SandException