Class FMG.BOL.Auth.Authenticator
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class FMG.BOL.Auth.Authenticator

java.lang.Object
   |
   +----FMG.BOL.Auth.Authenticator

public class Authenticator
extends Object
This class can be used to authenticate with a BOL authentication server from a public access networking port. It can translate simple login and logout method calls to the propriatary authentication protocol.

Authenitcation example:

    Authenticator a = new Authenticator("auth1.ucla.edu");
    a.login("yarvis", "xxxx");
    String motd = a.motd();
    String cookie = a.cookie();
Once authenticated, use the AuthPinger class to maintain authenticated status.

De-authenitcation example:

    Authenticator a = new Authenticator("auth1.ucla.edu");
    a.logout();
See Also:
AuthPinger, AuthenticationException

Constructor Index

 o Authenticator(String)
Create an authentication object tied to a specific server.

Method Index

 o close()
Close the connection.
 o cookie()
Returns the magic cookie string obtained from the server after a sucessful login().
 o finalize()
 o login(String, String)
Attempt to authenticate with the given identity.
 o logout()
De-authenticates with the server.
 o motd()
Returns the motd string obtained from the server after a sucessful login().
 o setDebug(boolean)
Set the debugging mode on or off.

Constructors

 o Authenticator
  public Authenticator(String server) throws IOException, UnknownHostException, AuthenticationException
Create an authentication object tied to a specific server.
Parameters:
server - The server to connect to.
Throws: IOException
Occurs when the socket throws an IOException
Throws: AuthenticationException
Occurs when the server does not respond with status 100.
Throws: UnknownHostException
Occurs if the server hostname is not known

Methods

 o setDebug
  public void setDebug(boolean ToF)
Set the debugging mode on or off.
Parameters:
ToF - A boolean indicating the debugging mode.
 o login
  public boolean login(String username,
                       String password) throws IOException, AuthenticationException
Attempt to authenticate with the given identity. This method can be called repeatedly until it returns true. Once true is returned, login() and logout() should not be called.
Parameters:
username - The username of the authenticating user
password - The password of the authenticating user
Throws: IOException
Occurs when the socket throws an IOException or when the server returns a fatal error. Create a new object if this occurs.
Throws: AuthenticationException
Occurs when the server returns an unexpected non-fatal error.
 o close
  public void close()
Close the connection. Normally this is not needed since login() and logout() both close the connection upon success. This method should be used to close the connection in the event that login() fails and the user wishes to abort. All error conditions are ignored.
 o finalize
  protected void finalize()
Overrides:
finalize in class Object
 o motd
  public String motd()
Returns the motd string obtained from the server after a sucessful login(). Should only be called after login() returns true.
Returns:
The string representing the motd returned from the server.
 o cookie
  public String cookie()
Returns the magic cookie string obtained from the server after a sucessful login(). Should only be called after login() returns true.
Returns:
The string representing the magic cookie.
 o logout
  public void logout() throws IOException
De-authenticates with the server.
Throws: IOException
Occurs when the socket throws an IOException or when the server returns a fatal error. Create a new object if this occurs.

All Packages  Class Hierarchy  This Package  Previous  Next  Index