Back to Devexpress

XafApplication.Security Property

expressappframework-devexpress-dot-expressapp-dot-xafapplication-64dfcd32.md

latest7.5 KB
Original Source

XafApplication.Security Property

Provides access to the Security Strategy used in the application.

Namespace : DevExpress.ExpressApp

Assembly : DevExpress.ExpressApp.v25.2.dll

NuGet Package : DevExpress.ExpressApp

Declaration

csharp
[Browsable(false)]
public ISecurityStrategyBase Security { get; set; }
vb
<Browsable(False)>
Public Property Security As ISecurityStrategyBase

Property Value

TypeDescription
ISecurityStrategyBase

An object that is the ISecurityStrategyBase Security Strategy.

|

Remarks

To create a custom Security Strategy or Authentication Type, set the Security property in code:

csharp
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.

XAF-implement-custom-permission-role-and-user-objects/CS/EFCore/MySolutionEF/MySolutionEF.Module/Security/SecuredExportController.cs#L14

csharp
controller.ExportAction.Executing += ExportAction_Executing;
IRequestSecurity requestSecurity = (IRequestSecurity)Application.Security;
controller.Active.SetItemValue("Security",

XAF_how-to-connect-different-data-models-to-several-databases-within-a-single-application/CS/XPO/.NET/CommonModule/CommonModule.cs#L50

csharp
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

csharp
WebApplication.SetInstance(Session, new XafSolutionAspNetApplication());
SecurityStrategy security = (SecurityStrategy)WebApplication.Instance.Security;
security.RegisterXPOAdapterProviders();

XAF_logon-form-manage-users-register-a-new-user-restore-a-password/CS/EFCore/Security.Extensions/Module.cs#L20

csharp
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

csharp
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

vb
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

vb
Me.Modules.Add(Me.securityModule1)
            Me.Security = Me.securitySimple1
' Me.DatabaseVersionMismatch += New System.EventHandler(Of DevExpress.ExpressApp.DatabaseVersionMismatchEventArgs)(Me.WinWebSolutionAspNetApplication_DatabaseVersionMismatch)

xaf-how-to-use-data-from-security-in-criterion/VB/CustomFunctionCriteriaOperator.Web/WebApplication.vb#L80

vb
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

vb
Me.Modules.Add(Me.validationModule)
            Me.Security = Me.securityStrategyComplex1
'INSTANT VB NOTE: The following InitializeComponent event wireup was converted to a 'Handles' clause:

xaf-how-to-implement-a-custom-security-operation-that-can-be-permitted-at-the-type-level/VB/CustomSecurityOperation.Web/WebApplication.vb#L68

vb
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

XafApplication Class

XafApplication Members

DevExpress.ExpressApp Namespace