AuthenticationProvider
Members
Namespace: ASPSecurityKit.AuthProviders
Assembly: ASPSecurityKit.dll
Summary
Inherit from parent.
Summary
Implements IAuthenticationProvider and performs authentication step of the security pipeline using one or more IAuthenticationSchemeHandler. To learn more, visit https://ASPSecurityKit.net/docs/the-security-pipeline/#authentication
Constructors
#ctor(authSchemeHandlers,settings,sessionProvider,userService,failureHandler,securityContext,errorResource)
Summary
Initializes a new instance of the AuthenticationProvider class.
Parameters
Name | Type | Description |
---|---|---|
authSchemeHandlers | ASPSecurityKit.AuthProviders.IAuthenticationSchemeHandler[] | The list containing handlers for all the supported authentication schemes. |
settings | ASPSecurityKit.ISecuritySettings | The security settings. |
sessionProvider | ASPSecurityKit.IAuthSessionProvider | The session provider. |
userService | ASPSecurityKit.IUserService | The user service. |
failureHandler | ASPSecurityKit.ISecurityFailureResponseHandler | The failure handler. |
securityContext | ASPSecurityKit.ISecurityContext | The security context. |
errorResource | ASPSecurityKit.IErrorMessageResourceProvider | The error resource. |
Remarks
When Authenticate is called, the request will be evaluated through the auth schemes in order the authSchemeHandlers
were provided.
Methods
Authenticate(requestService)
Summary
Authenticates the specified request. To learn more about the flow of the default implementation, visit https://ASPSecurityKit.net/docs/the-security-pipeline/#authentication
Returns
AuthResult instance with Code as Success if authentication was successful; otherwise, a possible reason of failure.
Parameters
Name | Type | Description |
---|---|---|
requestService | ASPSecurityKit.IRequestService | The request service. |
Exceptions
Type | Description |
---|---|
System.ArgumentNullException | When requestService is null. |
Remarks
The method doesn’t just authenticate but also loads a session for the authenticated identity including user, permits and anything else needed by the subsequent steps.
HandleUnauthenticatedRequest(requestService,result)
Summary
Handles response when request couldn’t be authenticated.
Parameters
Name | Type | Description |
---|---|---|
requestService | ASPSecurityKit.IRequestService | The request service. |
result | ASPSecurityKit.AuthProviders.AuthResult | The result instance with failure details. |
Exceptions
Type | Description |
---|---|
System.ArgumentNullException | When requestService/result is null. |
System.ArgumentException | When result is not a failed one. |
LoadSession(auth,letSuspendedAuthenticate)
Summary
Loads the session (user/permits/etc.) for the authenticated identity.
Returns
AuthResult instance with Code as Success if load was successful; otherwise, a possible reason of failure.
Parameters
Name | Type | Description |
---|---|---|
auth | ASPSecurityKit.IAuthDetails | The authenticated identity details. |
letSuspendedAuthenticate | System.Boolean | If set to false and the associated user is found suspended, forbids loading and returns Suspended; otherwise, loads the session. |
Exceptions
Type | Description |
---|---|
System.ArgumentNullException | When auth is null. |
AuthenticateAsync(requestService)
Summary
Authenticates the specified request. To learn more about the flow of the default implementation, visit https://ASPSecurityKit.net/docs/the-security-pipeline/#authentication
Returns
AuthResult instance with Code as Success if authentication was successful; otherwise, a possible reason of failure.
Parameters
Name | Type | Description |
---|---|---|
requestService | ASPSecurityKit.IRequestService | The request service. |
Exceptions
Type | Description |
---|---|
System.ArgumentNullException | When requestService is null. |
Remarks
The method doesn’t just authenticate but also loads a session for the authenticated identity including user, permits and anything else needed by the subsequent steps.
AuthenticateAsync(requestService,cancellationToken)
Summary
Authenticates the specified request. To learn more about the flow of the default implementation, visit https://ASPSecurityKit.net/docs/the-security-pipeline/#authentication
Returns
AuthResult instance with Code as Success if authentication was successful; otherwise, a possible reason of failure.
Parameters
Name | Type | Description |
---|---|---|
requestService | ASPSecurityKit.IRequestService | The request service. |
cancellationToken | System.Threading.CancellationToken | The cancellation token. |
Exceptions
Type | Description |
---|---|
System.ArgumentNullException | When requestService is null. |
Remarks
The method doesn’t just authenticate but also loads a session for the authenticated identity including user, permits and anything else needed by the subsequent steps.
HandleUnauthenticatedRequestAsync(requestService,result)
Summary
Handles response when request couldn’t be authenticated.
Parameters
Name | Type | Description |
---|---|---|
requestService | ASPSecurityKit.IRequestService | The request service. |
result | ASPSecurityKit.AuthProviders.AuthResult | The result instance with failure details. |
Exceptions
Type | Description |
---|---|
System.ArgumentNullException | When requestService/result is null. |
System.ArgumentException | When result is not a failed one. |
HandleUnauthenticatedRequestAsync(requestService,result,cancellationToken)
Summary
Handles response when request couldn’t be authenticated.
Parameters
Name | Type | Description |
---|---|---|
requestService | ASPSecurityKit.IRequestService | The request service. |
result | ASPSecurityKit.AuthProviders.AuthResult | The result instance with failure details. |
cancellationToken | System.Threading.CancellationToken | The cancellation token. |
Exceptions
Type | Description |
---|---|
System.ArgumentNullException | When requestService/result is null. |
System.ArgumentException | When result is not a failed one. |