forked from ayende/rhino-security
-
Notifications
You must be signed in to change notification settings - Fork 22
/
How to Use.txt
38 lines (30 loc) · 1.46 KB
/
How to Use.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
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