Table of Contents

Class HttpContextExtensions

Namespace
Umbraco.Extensions
Assembly
Umbraco.Web.Common.dll
public static class HttpContextExtensions
Inheritance
HttpContextExtensions
Inherited Members

Methods

AuthenticateBackOfficeAsync(HttpContext?)

Runs the authentication process

public static Task<AuthenticateResult> AuthenticateBackOfficeAsync(this HttpContext? httpContext)

Parameters

httpContext HttpContext

Returns

Task<AuthenticateResult>

GetCurrentIdentity(HttpContext)

This will return the current back office identity.

public static ClaimsIdentity? GetCurrentIdentity(this HttpContext http)

Parameters

http HttpContext

Returns

ClaimsIdentity

Returns the current back office identity if an admin is authenticated otherwise null

GetRequestValue(HttpContext, string)

Get the value in the request form or query string for the key

public static string? GetRequestValue(this HttpContext context, string key)

Parameters

context HttpContext
key string

Returns

string

SetPrincipalForRequest(HttpContext, ClaimsPrincipal?)

public static void SetPrincipalForRequest(this HttpContext context, ClaimsPrincipal? principal)

Parameters

context HttpContext
principal ClaimsPrincipal

SetReasonPhrase(HttpContext, string?)

public static void SetReasonPhrase(this HttpContext httpContext, string? reasonPhrase)

Parameters

httpContext HttpContext
reasonPhrase string

TryGetBasicAuthCredentials(HttpContext, out string?, out string?)

Try to get the basic auth username and password from the http context.

public static bool TryGetBasicAuthCredentials(this HttpContext httpContext, out string? username, out string? password)

Parameters

httpContext HttpContext
username string
password string

Returns

bool