cafe.authentication
Class Authentication

java.lang.Object
  extended by cafe.authentication.Authentication
All Implemented Interfaces:
UserAuthentication

public class Authentication
extends java.lang.Object
implements UserAuthentication

The purpose of this class is to create a https connection to a defined website and identify the user as a part of department of computer science's staff by using http-protocol's basic authentication method. In order to work properly, user must add department's CA certificate to Java runtime environment's cacerts file.

Since:
1.0
Version:
1.1 (Cleaned up ap's code and changed the parsing of URL to use Regex.)
Author:
Antti-Pekka Sarin (edited from Veli-Pekka Kestil�'s code), vpk

Constructor Summary
Authentication(AuthenticationSettings settings)
          The class constructor
 
Method Summary
 boolean authenticateUser(java.lang.String username, java.lang.String password)
          This method creates the actual connection by using socket and returns information on whether the user is identified as a department's staff member.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Authentication

public Authentication(AuthenticationSettings settings)
               throws java.lang.RuntimeException
The class constructor

Parameters:
settings - An AuthenticationSettings object containing the URL which to connect, the path to the keystore file and keystore file's password
Throws:
java.lang.RuntimeException
Method Detail

authenticateUser

public boolean authenticateUser(java.lang.String username,
                                java.lang.String password)
                         throws java.io.IOException
This method creates the actual connection by using socket and returns information on whether the user is identified as a department's staff member.

Specified by:
authenticateUser in interface UserAuthentication
Parameters:
username - username
password - user's password
Returns:
the result on wheter the user has been identified as part deparment's staff
Throws:
java.io.IOException