Skip to content

AuthenticationController Class

Handles authentication-related processes in the context of OpenID Connect and OAuth2 protocols. This controller manages user authorization, provides user information, handles end-session requests, and checks session statuses.

C#
public sealed class AuthenticationController : Microsoft.AspNetCore.Mvc.ControllerBase

Inheritance System.ObjectMicrosoft.AspNetCore.Mvc.ControllerBase → AuthenticationController

Remarks

This controller serves as the core component for managing user authentication and session control in an OpenID Connect compliant manner. It includes endpoints for initiating user authorization, retrieving authenticated user information, managing user logout processes, and checking the status of user sessions for OIDC compliance.

Methods

AuthenticationController.AuthorizeAsync(IAuthorizationHandler, IAuthorizationResponseFormatter, AuthorizationRequest) Method

Handles requests to the authorization endpoint, performing user authentication and getting consent for requested scopes.

C#
public System.Threading.Tasks.Task<Microsoft.AspNetCore.Mvc.ActionResult<Abblix.Oidc.Server.Model.AuthorizationResponse>> AuthorizeAsync(Abblix.Oidc.Server.Endpoints.Authorization.Interfaces.IAuthorizationHandler handler, Abblix.Oidc.Server.Mvc.Formatters.Interfaces.IAuthorizationResponseFormatter formatter, Abblix.Oidc.Server.Mvc.Model.AuthorizationRequest request);

Parameters

handler IAuthorizationHandler

The handler responsible for processing authorization requests.

formatter IAuthorizationResponseFormatter

The formatter used to generate a response for the authorization request.

request AuthorizationRequest

The authorization request details received from the client.

Returns

System.Threading.Tasks.Task<Microsoft.AspNetCore.Mvc.ActionResult<AuthorizationResponse>>
A task that returns an action result containing the authorization response.

Remarks

This endpoint is a key component of the OpenID Connect flow, initiating user authentication and consent for access to their information. OpenID Connect Authorization Endpoint Documentation

AuthenticationController.BackChannelAuthenticationAsync(IBackChannelAuthenticationHandler, IBackChannelAuthenticationResponseFormatter, BackChannelAuthenticationRequest, ClientRequest) Method

Handles the backchannel authentication endpoint, initiating the authentication flow that occurs outside the traditional user-agent interaction as specified by CIBA.

C#
public System.Threading.Tasks.Task<Microsoft.AspNetCore.Mvc.ActionResult> BackChannelAuthenticationAsync(Abblix.Oidc.Server.Endpoints.BackChannelAuthentication.Interfaces.IBackChannelAuthenticationHandler handler, Abblix.Oidc.Server.Mvc.Formatters.Interfaces.IBackChannelAuthenticationResponseFormatter formatter, Abblix.Oidc.Server.Mvc.Model.BackChannelAuthenticationRequest authenticationRequest, Abblix.Oidc.Server.Mvc.Model.ClientRequest clientRequest);

Parameters

handler IBackChannelAuthenticationHandler

Service that processes the authentication request, validating and initiating the backchannel flow.

formatter IBackChannelAuthenticationResponseFormatter

Service that formats the response to the client, based on the result of the backchannel authentication request.

authenticationRequest BackChannelAuthenticationRequest

The backchannel authentication request containing user-related authentication parameters.

clientRequest ClientRequest

The client request providing the client-related information needed for the request.

Returns

System.Threading.Tasks.Task<Microsoft.AspNetCore.Mvc.ActionResult>
An Microsoft.AspNetCore.Mvc.ActionResult representing the HTTP response to the backchannel authentication request. The response may indicate successful initiation of the process or an error if the request fails validation.

Remarks

The method implements the CIBA (Client-Initiated Backchannel Authentication) protocol, enabling the authentication of a user through an out-of-band mechanism. Clients initiate the authentication request, and the user's authentication happens through a separate channel (e.g., mobile device).

For more details, refer to the CIBA documentation: CIBA - Client Initiated Backchannel Authentication Documentation

AuthenticationController.CheckSessionAsync(ICheckSessionHandler, ICheckSessionResponseFormatter) Method

Monitors the user's session state by handling requests to the check session endpoint, typically used within an iframe for session management.

C#
public System.Threading.Tasks.Task<Microsoft.AspNetCore.Mvc.ActionResult> CheckSessionAsync(Abblix.Oidc.Server.Endpoints.CheckSession.Interfaces.ICheckSessionHandler handler, Abblix.Oidc.Server.Mvc.Formatters.Interfaces.ICheckSessionResponseFormatter formatter);

Parameters

handler ICheckSessionHandler

The handler responsible for the check session operation.

formatter ICheckSessionResponseFormatter

The formatter used to generate a response suitable for session checking within an iframe.

Returns

System.Threading.Tasks.Task<Microsoft.AspNetCore.Mvc.ActionResult>
A task that returns an action result for the check session response.

Remarks

This endpoint is part of the OpenID Connect session management specification, enabling clients to monitor the authentication state. OpenID Connect Check Session Documentation

AuthenticationController.DeviceAuthorizationAsync(IDeviceAuthorizationHandler, IDeviceAuthorizationResponseFormatter, DeviceAuthorizationRequest, ClientRequest) Method

Handles the device authorization endpoint for getting user authorization on limited-input devices.

C#
public System.Threading.Tasks.Task<Microsoft.AspNetCore.Mvc.ActionResult> DeviceAuthorizationAsync(Abblix.Oidc.Server.Endpoints.DeviceAuthorization.Interfaces.IDeviceAuthorizationHandler handler, Abblix.Oidc.Server.Mvc.Formatters.Interfaces.IDeviceAuthorizationResponseFormatter formatter, Abblix.Oidc.Server.Mvc.Model.DeviceAuthorizationRequest deviceAuthorizationRequest, Abblix.Oidc.Server.Mvc.Model.ClientRequest clientRequest);

Parameters

handler IDeviceAuthorizationHandler
formatter IDeviceAuthorizationResponseFormatter
deviceAuthorizationRequest DeviceAuthorizationRequest
clientRequest ClientRequest

Returns

System.Threading.Tasks.Task<Microsoft.AspNetCore.Mvc.ActionResult>

Remarks

OAuth 2.0 Device Authorization Grant Documentation

AuthenticationController.EndSessionAsync(IEndSessionHandler, IEndSessionResponseFormatter, EndSessionRequest) Method

Facilitates the logout process by handling requests to the end session endpoint, allowing clients to terminate the user's session.

C#
public System.Threading.Tasks.Task<Microsoft.AspNetCore.Mvc.ActionResult> EndSessionAsync(Abblix.Oidc.Server.Endpoints.EndSession.IEndSessionHandler handler, Abblix.Oidc.Server.Mvc.Formatters.Interfaces.IEndSessionResponseFormatter formatter, Abblix.Oidc.Server.Mvc.Model.EndSessionRequest request);

Parameters

handler IEndSessionHandler

The handler responsible for processing end session requests.

formatter IEndSessionResponseFormatter

The formatter used to generate a response for the end session request.

request EndSessionRequest

The end session request details received from the client.

Returns

System.Threading.Tasks.Task<Microsoft.AspNetCore.Mvc.ActionResult>
A task that returns an action result for the end session process.

Remarks

This endpoint supports the RP-Initiated Logout functionality, enabling clients to initiate logout procedures compliant with OpenID Connect. OpenID Connect EndSession Endpoint Documentation

AuthenticationController.PushAuthorizeAsync(IPushedAuthorizationHandler, IPushedAuthorizationResponseFormatter, AuthorizationRequest, ClientRequest) Method

Handles the pushed authorization endpoint. This endpoint is used for receiving and processing pushed authorization requests from clients, validating the request, and generating a response that either contains a URI for the stored authorization request or an error message.

C#
public System.Threading.Tasks.Task<Microsoft.AspNetCore.Mvc.ActionResult<Abblix.Oidc.Server.Model.AuthorizationResponse>> PushAuthorizeAsync(Abblix.Oidc.Server.Endpoints.PushedAuthorization.Interfaces.IPushedAuthorizationHandler handler, Abblix.Oidc.Server.Mvc.Formatters.Interfaces.IPushedAuthorizationResponseFormatter formatter, Abblix.Oidc.Server.Mvc.Model.AuthorizationRequest authorizationRequest, Abblix.Oidc.Server.Mvc.Model.ClientRequest clientRequest);

Parameters

handler IPushedAuthorizationHandler

The handler responsible for processing pushed authorization requests.

formatter IPushedAuthorizationResponseFormatter

The service for formatting the authorization response.

authorizationRequest AuthorizationRequest

The authorization request received from the client.

clientRequest ClientRequest

Additional client request information for contextual validation.

Returns

System.Threading.Tasks.Task<Microsoft.AspNetCore.Mvc.ActionResult<AuthorizationResponse>>
An action result containing the formatted authorization response, which can be a success or an error response.

Remarks

This method first validates the incoming authorization request. If the request is valid, it is processed and stored, and a response containing the request URI is returned. If the request is invalid, an error response is generated.

AuthenticationController.UserInfoAsync(IUserInfoHandler, IUserInfoResponseFormatter, UserInfoRequest, ClientRequest) Method

Processes requests to the userinfo endpoint, returning claims about the authenticated user based on the provided access token.

C#
public System.Threading.Tasks.Task<Microsoft.AspNetCore.Mvc.ActionResult> UserInfoAsync(Abblix.Oidc.Server.Endpoints.UserInfo.Interfaces.IUserInfoHandler handler, Abblix.Oidc.Server.Mvc.Formatters.Interfaces.IUserInfoResponseFormatter formatter, Abblix.Oidc.Server.Mvc.Model.UserInfoRequest userInfoRequest, Abblix.Oidc.Server.Mvc.Model.ClientRequest clientRequest);

Parameters

handler IUserInfoHandler

The handler responsible for processing userinfo requests.

formatter IUserInfoResponseFormatter

The formatter used to generate a response with user claims.

userInfoRequest UserInfoRequest

The userinfo request containing the access token.

clientRequest ClientRequest

Additional request information provided by the client.

Returns

System.Threading.Tasks.Task<Microsoft.AspNetCore.Mvc.ActionResult>
A task that returns an action result containing the userinfo response.

Remarks

This endpoint provides claims about the authenticated user, conforming to the OpenID Connect UserInfo Endpoint Documentation