package org.bodington.server.realm;

import java.util.Properties;
import org.bodington.database.PrimaryKey;

public interface Authenticator
{
    // the user presents their credentials here
    public void setAuthenticationCredentials( Properties credentials ) throws AuthenticationException;
    
    // were the credentials accepted and validated?
    public boolean isAuthenticated() throws AuthenticationException;
    
    // is the user a known person?
    public boolean isAnonymous() throws AuthenticationException;
    
    // get text of last error
    public String getAuthenticationError() throws AuthenticationException;
    
    // get the id of the user who authenticated
    public PrimaryKey getAuthenticatedUserId() throws AuthenticationException;
    
    // provide credentials to record and use in future authentication attempts
    // e.g. change the user's password.   Should fail if user isn't currently
    // authenticated.
    public void changeCredentials( Properties credentials ) throws AuthenticationException;
    
}
