org.blojsom.authorization.database
Class DatabaseAuthorizationProvider

java.lang.Object
  extended byorg.blojsom.authorization.database.DatabaseAuthorizationProvider
All Implemented Interfaces:
AuthorizationProvider
Direct Known Subclasses:
LDAPAuthorizationProvider

public class DatabaseAuthorizationProvider
extends java.lang.Object
implements AuthorizationProvider

Database authorization provider

Since:
blojsom. 3.0
Version:
$Id: DatabaseAuthorizationProvider.java,v 1.7 2007/01/17 02:35:16 czarneckid Exp $
Author:
David Czarnecki

Field Summary
protected  org.hibernate.SessionFactory _sessionFactory
           
 
Constructor Summary
DatabaseAuthorizationProvider()
          Create a new instance of the database authorization provider
 
Method Summary
 void authorize(Blog blog, java.util.Map authorizationContext, java.lang.String userLogin, java.lang.String password)
          Authorize a username and password for the given Blog
 void checkPermission(Blog blog, java.util.Map permissionContext, java.lang.String userLogin, java.lang.String permission)
          Check a permission for the given Blog
 void init()
          Initialization method for the authorization provider
 void setSessionFactory(org.hibernate.SessionFactory sessionFactory)
          Set the SessionFactory
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_sessionFactory

protected org.hibernate.SessionFactory _sessionFactory
Constructor Detail

DatabaseAuthorizationProvider

public DatabaseAuthorizationProvider()
Create a new instance of the database authorization provider

Method Detail

init

public void init()
          throws ConfigurationException
Initialization method for the authorization provider

Specified by:
init in interface AuthorizationProvider
Throws:
ConfigurationException - If there is an error initializing the provider

setSessionFactory

public void setSessionFactory(org.hibernate.SessionFactory sessionFactory)
Set the SessionFactory

Parameters:
sessionFactory - SessionFactory

authorize

public void authorize(Blog blog,
                      java.util.Map authorizationContext,
                      java.lang.String userLogin,
                      java.lang.String password)
               throws AuthorizationException
Authorize a username and password for the given Blog

Specified by:
authorize in interface AuthorizationProvider
Parameters:
blog - Blog
authorizationContext - Map to be used to provide other information for authorization. This will change depending on the authorization provider.
userLogin - Username
password - Password
Throws:
AuthorizationException - If there is an error authorizing the username and password

checkPermission

public void checkPermission(Blog blog,
                            java.util.Map permissionContext,
                            java.lang.String userLogin,
                            java.lang.String permission)
                     throws AuthorizationException
Check a permission for the given Blog

Specified by:
checkPermission in interface AuthorizationProvider
Parameters:
blog - Blog
permissionContext - Map to be used to provide other information for permission check. This will change depending on the authorization provider.
userLogin - Username
permission - Permission
Throws:
AuthorizationException - If there is an error checking the permission for the username and permission