org.openanzo.model.embedded
Class EmbeddedAuthenticationService

java.lang.Object
  extended by org.openanzo.model.embedded.EmbeddedAuthenticationService
All Implemented Interfaces:
IAuthenticationService, IService

public class EmbeddedAuthenticationService
extends java.lang.Object
implements IAuthenticationService

An Embedded version of the IAuthenticationService which has a direct connection to the Anzo server.

Author:
Matthew Roy ( mroy@cambridgesemantics.com )

Constructor Summary
EmbeddedAuthenticationService(EmbeddedServiceBase baseService)
          Get an instance of the EmbeddedAuthenticationService
 
Method Summary
 org.openrdf.model.URI authenticateUser(java.lang.String userName, java.lang.String password)
          Authenticates the user with a given userId and password against the Anzo Server's authentication service, and returns the user's URI in Anzo.
static IAuthenticationService getInstance(java.lang.Object parent, java.util.Properties props)
          Get an instance of the EmbeddedAuthenticationService
 java.util.Set<org.openrdf.model.URI> getRolesForGraph(org.openrdf.model.URI graphId)
          Get the roles that can read a given NamedGraph
 java.util.Set<org.openrdf.model.URI> getRolesForUser(org.openrdf.model.URI userId)
          Get roles that given user is a member
 java.lang.String getServicePassword()
          Get the Password for the current thread
 java.lang.String getServiceUser()
          Get the UserId for the current thread
 java.util.Set<org.openrdf.model.URI> getUsersForGraph(org.openrdf.model.URI graphId)
          Get the users that can read a given NamedGraph
 org.openrdf.model.URI getUserUri(java.lang.String userName)
          Get the User's URI based on userId
 void setServicePassword(java.lang.String password)
          Set the password for the current thread's operations
 void setServiceUser(java.lang.String userId)
          Set the UserID for the current thread's operations
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EmbeddedAuthenticationService

public EmbeddedAuthenticationService(EmbeddedServiceBase baseService)
Get an instance of the EmbeddedAuthenticationService

Parameters:
baseService - the base embedded service which this service is built upon
Method Detail

getInstance

public static IAuthenticationService getInstance(java.lang.Object parent,
                                                 java.util.Properties props)
Get an instance of the EmbeddedAuthenticationService

Parameters:
parent - The object creating this service
props - The configuration properties for this service
Returns:
A newly created EmbeddedAuthenticationService

authenticateUser

public org.openrdf.model.URI authenticateUser(java.lang.String userName,
                                              java.lang.String password)
                                       throws AnzoException
Description copied from interface: IAuthenticationService
Authenticates the user with a given userId and password against the Anzo Server's authentication service, and returns the user's URI in Anzo.

Specified by:
authenticateUser in interface IAuthenticationService
Parameters:
userName - The id the user is authenticating against
password - The password for the id the user is authenticating against
Returns:
The uri for the user in Anzo.
Throws:
AnzoException - is raised if authentication fails.

getUserUri

public org.openrdf.model.URI getUserUri(java.lang.String userName)
                                 throws AnzoException
Description copied from interface: IAuthenticationService
Get the User's URI based on userId

Specified by:
getUserUri in interface IAuthenticationService
Parameters:
userName - The id the user is authenticating against
Returns:
The uri for the user in Anzo.
Throws:
AnzoException - if getting URI of id fails

getRolesForUser

public java.util.Set<org.openrdf.model.URI> getRolesForUser(org.openrdf.model.URI userId)
                                                     throws AnzoException
Description copied from interface: IAuthenticationService
Get roles that given user is a member

Specified by:
getRolesForUser in interface IAuthenticationService
Parameters:
userId - The URI of the user to get roles
Returns:
Set of roles that user is a member
Throws:
AnzoException - if getting roles for user fails

getRolesForGraph

public java.util.Set<org.openrdf.model.URI> getRolesForGraph(org.openrdf.model.URI graphId)
                                                      throws AnzoException
Description copied from interface: IAuthenticationService
Get the roles that can read a given NamedGraph

Specified by:
getRolesForGraph in interface IAuthenticationService
Parameters:
graphId - URI of NamedGraph
Returns:
Set of roles's URIS that can read the NamedGraph
Throws:
AnzoException - if getting roles for graph fails

getUsersForGraph

public java.util.Set<org.openrdf.model.URI> getUsersForGraph(org.openrdf.model.URI graphId)
                                                      throws AnzoException
Description copied from interface: IAuthenticationService
Get the users that can read a given NamedGraph

Specified by:
getUsersForGraph in interface IAuthenticationService
Parameters:
graphId - URI of NamedGraph
Returns:
Set of user's URIS that can read the NamedGraph
Throws:
AnzoException - if getting users for graph fails

getServicePassword

public java.lang.String getServicePassword()
Description copied from interface: IService
Get the Password for the current thread

Specified by:
getServicePassword in interface IService
Returns:
the Password for the current thread

getServiceUser

public java.lang.String getServiceUser()
Description copied from interface: IService
Get the UserId for the current thread

Specified by:
getServiceUser in interface IService
Returns:
the UserId for the current thread

setServicePassword

public void setServicePassword(java.lang.String password)
Description copied from interface: IService
Set the password for the current thread's operations

Specified by:
setServicePassword in interface IService
Parameters:
password - Password to use in current thread's operations

setServiceUser

public void setServiceUser(java.lang.String userId)
Description copied from interface: IService
Set the UserID for the current thread's operations

Specified by:
setServiceUser in interface IService
Parameters:
userId - UserId to use in current thread's operations


Copyright © 2007 Cambridge Semantics Inc.. All Rights Reserved.