Permalink
Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
38 lines (30 sloc) 1.46 KB
Registering into NHibernate
===========================
BEFORE creating the session factory, call the following:
Security.Configure(cfg, SecurityTableStructure.Schema);
Container Configuration
=======================
Rhino Security make use of Common Service Locator (http://www.codeplex.com/CommonServiceLocator), you need to set the ServiceLocator.SetLocatorProvider() to provide the following services:
* IAuthorizationService
* IAuthorizationRepository
* IPermissionsBuilderService
* IPermissionsService
ALL services must be TRANSIENT, and the container needs to provide access to the current ISession.
The following is an example of configuring Rhino Security using Windsor:
WindsorServiceLocator windsorServiceLocator = new WindsorServiceLocator(container);
ServiceLocator.SetLocatorProvider(() => windsorServiceLocator);
container.Register(
Component.For<IAuthorizationService>()
.ImplementedBy<AuthorizationService>()
.Lifestyle.Is(Lifestyle.Transient),
Component.For<IAuthorizationRepository>()
.ImplementedBy<AuthorizationRepository>()
.Lifestyle.Is(Lifestyle.Transient),
Component.For<IPermissionsBuilderService>()
.ImplementedBy<PermissionsBuilderService>()
.Lifestyle.Is(Lifestyle.Transient),
Component.For<IPermissionsService>()
.ImplementedBy<PermissionsService>()
.Lifestyle.Is(Lifestyle.Transient)
);
Alternatively Castle Windsor installer is provided in Rhino.Security.Windsor assembly