Constable Authorization Engine 2.0 BETA

AuthorizationPolicyLoader.LoadFromFile Method 

[This is preliminary documentation and subject to change.]

Loads an authorization policy from a XML file.

[Visual Basic]
Public Shared Function LoadFromFile( _
   ByVal xmlFileName As String _
) As AuthorizationPolicy
[C#]
public static AuthorizationPolicy LoadFromFile(
   string xmlFileName
);

Parameters

xmlFileName
The path to a XML file containing the authorization policy.

Return Value

A reference to an AuthorizationPolicy class populated from the data in the xmlFileName.

Remarks

The CurrentState is preserved while loading / saving authorizaton models. However, the CurrentPrincipal is not saved.

CAUTION Because the XML file doesn't store the current principal, before using the AuthorizationPolicy instance be sure to specify feasible CurrentPrincipal reference to be used to resolve role membership.

Example

The following example loads an authorization policy from a file and prepares the authorization context by setting the CurrentPrincipal property to an instance of the ExtendedPrincipal class.

[Visual Basic]
Dim policy As AuthorizationPolicy = AuthorizationPolicyLoader.LoadFromFile("c:\model.xml")
policy.CurrentPrincipal = New ExtendedPrincipal

[C#]
AuthorizationPolicy policy = AuthorizationPolicyLoader.LoadFromFile(@"c:\model.xml");;
policy.CurrentPrincipal = new ExtendedPrincipal();

See Also

AuthorizationPolicyLoader Class | LaMarvin.Constable Namespace