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
-
Authenticator(String)
- Create an authentication object tied to a specific server.
-
close()
- Close the connection.
-
cookie()
- Returns the magic cookie string obtained from the server after a
sucessful login().
-
finalize()
-
-
login(String, String)
- Attempt to authenticate with the given identity.
-
logout()
- De-authenticates with the server.
-
motd()
- Returns the motd string obtained from the server after a sucessful
login().
-
setDebug(boolean)
- Set the debugging mode on or off.
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
setDebug
public void setDebug(boolean ToF)
- Set the debugging mode on or off.
- Parameters:
- ToF - A boolean indicating the debugging mode.
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.
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.
finalize
protected void finalize()
- Overrides:
- finalize in class Object
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.
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.
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