AuthorizeRequestDefinitionRegistrar
Members
Namespace: ASPSecurityKit.Net
Assembly: ASPSecurityKit.Net.dll
Summary
Default implementation for IAuthorizeRequestDefinitionRegistrar.
Methods
AuthorizerFor(action,definitionContainer,authorizer,overrideIfAlreadyRegistered)
Summary
Registers an async instance authorizer for the given action that will decide whether or not current request is authorized. Use this when you have a complex logic of authorizing a particular request (such as when you have multiple Ids in the request to verify.)
Parameters
Name | Type | Description |
---|---|---|
action | System.Reflection.MethodInfo | The action. |
definitionContainer | System.Type | The type containing the authorizer. |
authorizer | System.Func{System.Object,System.Object[],System.Threading.Tasks.Task{ASPSecurityKit.AuthProviders.AuthResult}} | The authorizer method. |
overrideIfAlreadyRegistered | System.Boolean | Indicates whether to override existing registration for the given action. |
Exceptions
Type | Description |
---|---|
System.ArgumentNullException | When action/definitionContainer/authorizer is null. |
System.InvalidOperationException | When an authorizer is already registered and overrideIfAlreadyRegistered is false. |
AuthorizerFor(action,definitionContainer,authorizer,overrideIfAlreadyRegistered)
Summary
Registers an async instance authorizer for the given action that will decide whether or not current request is authorized. Use this when you have a complex logic of authorizing a particular request (such as when you have multiple Ids in the request to verify.)
Parameters
Name | Type | Description |
---|---|---|
action | System.Reflection.MethodInfo | The action. |
definitionContainer | System.Type | The type containing the authorizer. |
authorizer | System.Func{System.Object,System.Object[],ASPSecurityKit.AuthProviders.AuthResult} | The authorizer method. |
overrideIfAlreadyRegistered | System.Boolean | Indicates whether to override existing registration for the given action. |
Exceptions
Type | Description |
---|---|
System.ArgumentNullException | When action/definitionContainer/authorizer is null. |
System.InvalidOperationException | When an authorizer is already registered and overrideIfAlreadyRegistered is false. |
CanAuthorize(action)
Summary
Determines whether or not a custom authorizer has been defined for the given action.
Returns
true
if a custom authorizer has been defined for the given action; otherwise, false
.
Parameters
Name | Type | Description |
---|---|---|
action | System.Reflection.MethodInfo | The action. |
Exceptions
Type | Description |
---|---|
System.ArgumentNullException | When action is null. |
TryResolve(container,action)
Summary
Gets the auth definition with its holding type instance (if any) resolved using the given DI container if applicable for the specified action. If no definition is registered for the given action, returns null.
Returns
The auth definition with its holding type instance (if any) resolved using the given DI container for the specified action. If no definition is registered for the given action, returns null.
Parameters
Name | Type | Description |
---|---|---|
container | ASPSecurityKit.IContainer | The container. |
action | System.Reflection.MethodInfo | The action. |
Exceptions
Type | Description |
---|---|
System.ArgumentNullException | When container/action is null. |