AuthenticationService  v0.2.0
Public Member Functions | Public Attributes | List of all members
Joutsen.AuthenticationService.PreActionValidationAttribute Class Reference

An attribute that can be used to validate action input before the action is exectued. More...

Public Member Functions

 PreActionValidationAttribute ()
 Creates an new instance. More...
 
Task< HttpResponseMessage > ExecuteActionFilterAsync (HttpActionContext actionContext, CancellationToken cancellationToken, Func< Task< HttpResponseMessage >> continuation)
 Executes the filter action asynchronously. More...
 
void OnActionExecuting (HttpActionContext actionContext)
 The validation before the action is executed. More...
 

Public Attributes

bool AllowMultiple => false
 Determines if muultiple of this attribute can be used. More...
 

Detailed Description

An attribute that can be used to validate action input before the action is exectued.

Remarks
If the validation fails the action will not be triggered but instead the response will be HTTP 422 Unprocessable entity containing an error message in the body. The Attribute also adds information about the possible response to the OpenAPI documentation.
Since
0.2.0

Constructor & Destructor Documentation

◆ PreActionValidationAttribute()

Joutsen.AuthenticationService.PreActionValidationAttribute.PreActionValidationAttribute ( )

Creates an new instance.

Member Function Documentation

◆ ExecuteActionFilterAsync()

Task<HttpResponseMessage> Joutsen.AuthenticationService.PreActionValidationAttribute.ExecuteActionFilterAsync ( HttpActionContext  actionContext,
CancellationToken  cancellationToken,
Func< Task< HttpResponseMessage >>  continuation 
)

Executes the filter action asynchronously.

Parameters
actionContextthe context of the action this attribute acts as a filter for
cancellationTokenthe cancellation token assigned for this task
continuationthe delegate function to continue after the filter method is invoked. This delegate is only invoked if the validation passed successfully.

◆ OnActionExecuting()

void Joutsen.AuthenticationService.PreActionValidationAttribute.OnActionExecuting ( HttpActionContext  actionContext)

The validation before the action is executed.

Parameters
actionContextthe context of the action this attribute acts as a filter for

Member Data Documentation

◆ AllowMultiple

bool Joutsen.AuthenticationService.PreActionValidationAttribute.AllowMultiple => false

Determines if muultiple of this attribute can be used.

It makes little sense to do so, therefore this property is always false.