forked from hibernating-rhinos/rhino-security
-
Notifications
You must be signed in to change notification settings - Fork 0
/
How to Use.txt
32 lines (27 loc) · 1.21 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
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:
Kernel.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)
);