ch.epfl.tequila.client.service
Class TequilaService

java.lang.Object
  extended by ch.epfl.tequila.client.service.TequilaService

public class TequilaService
extends java.lang.Object

Service for interacting with the Tequila server.


Method Summary
 java.lang.String createRequest(ClientConfig config, java.lang.String urlacces)
          Creates a request on the Tequila server and returns the corresponding session key.
static TequilaService instance()
          Returns the instance of the TequilaService (singleton).
 TequilaPrincipal validateKey(ClientConfig config, java.lang.String sessionKey)
          Validates the given sesion key with the Tequila server and returns the corresponding TequilaPrincipal, holding the known authenticated user informations.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

instance

public static TequilaService instance()
Returns the instance of the TequilaService (singleton).

Returns:
the instance of the TequilaService (singleton).

createRequest

public java.lang.String createRequest(ClientConfig config,
                                      java.lang.String urlacces)
                               throws java.io.IOException
Creates a request on the Tequila server and returns the corresponding session key.

Parameters:
config - the ClientConfig.
urlacces - the url where the user is redirected after successful authentification.
Returns:
the corresponding Tequila session key.
Throws:
java.io.IOException - if the connection with the Tequila server cannot be made.

validateKey

public TequilaPrincipal validateKey(ClientConfig config,
                                    java.lang.String sessionKey)
                             throws java.io.IOException
Validates the given sesion key with the Tequila server and returns the corresponding TequilaPrincipal, holding the known authenticated user informations.

Parameters:
config - the ClientConfig.
sessionKey - the Tequila session key you get with createRequest.
Returns:
the TequilaPrincipal holding the known authenticated user informations.
Throws:
java.io.IOException - if the connection with the Tequila server cannot be made.
java.lang.SecurityException - if the key is invalid.
See Also:
createRequest(ch.epfl.tequila.client.model.ClientConfig, String)