expressappframework-devexpress-dot-expressapp-dot-xafapplication-64dfcd32.md
Provides access to the Security Strategy used in the application.
Namespace : DevExpress.ExpressApp
Assembly : DevExpress.ExpressApp.v25.2.dll
NuGet Package : DevExpress.ExpressApp
[Browsable(false)]
public ISecurityStrategyBase Security { get; set; }
<Browsable(False)>
Public Property Security As ISecurityStrategyBase
| Type | Description |
|---|---|
| ISecurityStrategyBase |
An object that is the ISecurityStrategyBase Security Strategy.
|
To create a custom Security Strategy or Authentication Type, set the Security property in code:
static class Program {
// ...
public static void Main() {
// ...
MySolutionWindowsFormsApplication application = new MySolutionWindowsFormsApplication();
application.Security = new MySecurityStrategy<User, Role>(new MyAuthenticationStrategy<User,
AuthenticationStandardLogonParameters>())
// ...
application.Setup();
application.Start();
// ...
}
}
For details on the Security System supplied by XAF, refer to the Security System Overview topic.
The following code snippets (auto-collected from DevExpress Examples) contain references to the Security property.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.
controller.ExportAction.Executing += ExportAction_Executing;
IRequestSecurity requestSecurity = (IRequestSecurity)Application.Security;
controller.Active.SetItemValue("Security",
base.Setup(application);
(application.Security as SecurityStrategy)?.RegisterXPOAdapterProviders(new SecurityPermissionsProviderDefault(application));
}
XAF_How-to-get-role-code-from-the-UI/CS/XafSolution.Web/Global.asax.cs#L31
WebApplication.SetInstance(Session, new XafSolutionAspNetApplication());
SecurityStrategy security = (SecurityStrategy)WebApplication.Instance.Security;
security.RegisterXPOAdapterProviders();
if((Application != null) && (CreateSecuritySystemUser != null)) {
SecurityStrategyComplex securityStrategy = Application.Security as SecurityStrategyComplex;
if(securityStrategy != null) {
xaf-how-to-import-data-in-xaf/CS/WinWebSolution.Web/ApplicationCode/WebApplication.cs#L75
this.Modules.Add(this.securityModule1);
this.Security = this.securitySimple1;
this.DatabaseVersionMismatch += new System.EventHandler<DevExpress.ExpressApp.DatabaseVersionMismatchEventArgs>(this.WinWebSolutionAspNetApplication_DatabaseVersionMismatch);
XAF_How-to-get-role-code-from-the-UI/VB/XafSolution.Web/Global.asax.vb#L33
WebApplication.SetInstance(Session, New XafSolutionAspNetApplication())
Dim security As SecurityStrategy = CType(WebApplication.Instance.Security, SecurityStrategy)
security.RegisterXPOAdapterProviders()
xaf-how-to-import-data-in-xaf/VB/WinWebSolution.Web/ApplicationCode/WebApplication.vb#L77
Me.Modules.Add(Me.securityModule1)
Me.Security = Me.securitySimple1
' Me.DatabaseVersionMismatch += New System.EventHandler(Of DevExpress.ExpressApp.DatabaseVersionMismatchEventArgs)(Me.WinWebSolutionAspNetApplication_DatabaseVersionMismatch)
Me.Modules.Add(Me.module5)
Me.Security = Me.securityStrategyComplex1
DirectCast(Me, System.ComponentModel.ISupportInitialize).EndInit()
XAF_how-to-show-filter-dialog-before-listview/VB/E1554.Web/WebApplication.vb#L87
Me.Modules.Add(Me.validationModule)
Me.Security = Me.securityStrategyComplex1
'INSTANT VB NOTE: The following InitializeComponent event wireup was converted to a 'Handles' clause:
Me.Modules.Add(Me.securityModule1)
Me.Security = Me.securityStrategyComplex1
'INSTANT VB NOTE: The following InitializeComponent event wireup was converted to a 'Handles' clause:
See Also