View Source
  Class HttpContextExtensions
  
  
  
  
    Inheritance
      System.Object
      
   
  
  Assembly: Umbraco.Web.Common.dll
  Syntax
  
    public static class HttpContextExtensions
   
  Methods
  
  
    View Source
  
  AuthenticateBackOfficeAsync(HttpContext)
  Runs the authentication process
Declaration
  
    public static async Task<AuthenticateResult> AuthenticateBackOfficeAsync(this HttpContext httpContext)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | Microsoft.AspNetCore.Http.HttpContext | httpContext |  | 
    
  
  Returns
  
    
      
        | Type | Description | 
    
    
      
        | Task<Microsoft.AspNetCore.Authentication.AuthenticateResult> |  | 
    
  
  
    View Source
  
  GetCurrentIdentity(HttpContext)
  This will return the current back office identity.
Declaration
  
    public static ClaimsIdentity GetCurrentIdentity(this HttpContext http)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | Microsoft.AspNetCore.Http.HttpContext | http |  | 
    
  
  Returns
  
    
      
        | Type | Description | 
    
    
      
        | System.Security.Claims.ClaimsIdentity | Returns the current back office identity if an admin is authenticated otherwise null | 
    
  
  
    View Source
  
  GetRequestValue(HttpContext, String)
  Get the value in the request form or query string for the key
Declaration
  
    public static string GetRequestValue(this HttpContext context, string key)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | Microsoft.AspNetCore.Http.HttpContext | context |  | 
      
        | System.String | key |  | 
    
  
  Returns
  
    
      
        | Type | Description | 
    
    
      
        | System.String |  | 
    
  
  
    View Source
  
  SetPrincipalForRequest(HttpContext, ClaimsPrincipal)
  
  
  Declaration
  
    public static void SetPrincipalForRequest(this HttpContext context, ClaimsPrincipal principal)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | Microsoft.AspNetCore.Http.HttpContext | context |  | 
      
        | System.Security.Claims.ClaimsPrincipal | principal |  | 
    
  
  
    View Source
  
  SetReasonPhrase(HttpContext, String)
  
  
  Declaration
  
    public static void SetReasonPhrase(this HttpContext httpContext, string reasonPhrase)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | Microsoft.AspNetCore.Http.HttpContext | httpContext |  | 
      
        | System.String | reasonPhrase |  | 
    
  
  
    View Source
  
  TryGetBasicAuthCredentials(HttpContext, out String, out String)
  Try to get the basic auth username and password from the http context.
Declaration
  
    public static bool TryGetBasicAuthCredentials(this HttpContext httpContext, out string username, out string password)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | Microsoft.AspNetCore.Http.HttpContext | httpContext |  | 
      
        | System.String | username |  | 
      
        | System.String | password |  | 
    
  
  Returns
  
    
      
        | Type | Description | 
    
    
      
        | System.Boolean |  |