org.qtunes.auth
Interface Auth

All Superinterfaces:
Service
All Known Implementing Classes:
AuthImpl

public interface Auth
extends Service

The Auth class handles creation of Sessions and determining what rights those Sessions have. Each QTunes object has only one Auth Service. Different Services may register an Authorizer with this object: when a Session is created by a call to login(java.util.Map), each Authorizer for the matching Service is queried to see what "allowances" it gives it.


Method Summary
 void addAuthorizer(Authorizer auth)
          Add an Authorizer to the Auth object.
 java.util.Collection<java.lang.String> getAllowances(Session session)
          Return the set of allowances for the specified Session
 Session getSession(int id)
          Get the Session with the specified ID, or null if it doesn't exist
 Session login(java.util.Map properties)
          Create a new Session
 void logout(Session session)
          Expire the specified Session
 void logoutSessions(Service service)
          Expire all Sessions created by the specified Service
 void removeAuthorizer(Authorizer auth)
          Remove the previously added Authorizer from the Auth object
 
Methods inherited from interface org.qtunes.core.Service
getContext, reportState, startService, stopService
 

Method Detail

getSession

Session getSession(int id)
Get the Session with the specified ID, or null if it doesn't exist


login

Session login(java.util.Map properties)
Create a new Session

Parameters:
properties - a Map of properties which are part of the session - the exact content depends on the service (for example, a web service might include the Remote IP address of the connection). These properties are tested by the various Authorizers registered with the system to determine the set of allowances. At a minimum the Map must contain a "session" key with the value as either the name of the Service or the Service itself.

logout

void logout(Session session)
Expire the specified Session

Parameters:
session - the session to expire

addAuthorizer

void addAuthorizer(Authorizer auth)
Add an Authorizer to the Auth object. Any session creation requests will check with all the authorizers to see what rights that Session has.


removeAuthorizer

void removeAuthorizer(Authorizer auth)
Remove the previously added Authorizer from the Auth object


logoutSessions

void logoutSessions(Service service)
Expire all Sessions created by the specified Service


getAllowances

java.util.Collection<java.lang.String> getAllowances(Session session)
Return the set of allowances for the specified Session