Skip to content

AutoPostFormatter Class

Output formatter that produces a self-submitting HTML form, used to deliver authorization-response parameters to a client redirect URI as POST body fields. Implements the OAuth 2.0 Form Post Response Mode (see https://openid.net/specs/oauth-v2-form-post-response-mode-1\_0.html\), where the user agent auto-submits the form on load via JavaScript and falls back to a manual submit button when scripting is disabled. Produces text/html (UTF-8); each public field/property of the response object becomes a hidden input.

C#
public class AutoPostFormatter : Microsoft.AspNetCore.Mvc.Formatters.TextOutputFormatter

Inheritance System.ObjectMicrosoft.AspNetCore.Mvc.Formatters.OutputFormatterMicrosoft.AspNetCore.Mvc.Formatters.TextOutputFormatter → AutoPostFormatter

Constructors

AutoPostFormatter(IParametersProvider, Uri) Constructor

Initializes a new instance of the AutoPostFormatter class.

C#
public AutoPostFormatter(Abblix.Oidc.Server.Common.Interfaces.IParametersProvider parametersProvider, System.Uri action);

Parameters

parametersProvider IParametersProvider

Provider to retrieve the parameters for the form.

action System.Uri

The URI where the form will be submitted.

Methods

AutoPostFormatter.WriteResponseBodyAsync(OutputFormatterWriteContext, Encoding) Method

Writes the HTML content to the response body asynchronously. This method overrides the base class implementation to write an HTML form with the specified parameters.

C#
public override System.Threading.Tasks.Task WriteResponseBodyAsync(Microsoft.AspNetCore.Mvc.Formatters.OutputFormatterWriteContext context, System.Text.Encoding selectedEncoding);

Parameters

context Microsoft.AspNetCore.Mvc.Formatters.OutputFormatterWriteContext

The context for the output formatter.

selectedEncoding System.Text.Encoding

The encoding to use for the response.

Returns

System.Threading.Tasks.Task
A task that represents the asynchronous write operation.