C# Class GoatTrip.RestApi.Authentication.BasicAuthenticationModule

This module performs basic authentication. For details on basic authentication see RFC 2617. Based on the work by Mike Volodarsky (www.iis.net/learn/develop/runtime-extensibility/developing-a-module-using-net) The basic operational flow is: On AuthenticateRequest: extract the basic authentication credentials verify the credentials if succesfull, create and send authentication cookie On SendResponseHeaders: if there is no authentication cookie in request, clear response, add unauthorized status code (401) and add the basic authentication challenge to trigger basic authentication.
Inheritance: IHttpModule
Show file Open project: NHSChoices/location-service

Public Methods

Method Description
Dispose ( ) : void
Init ( System.Web.HttpApplication context ) : void

Protected Methods

Method Description
ExtractBasicCredentials ( string authorizationHeader, string &username, string &password ) : bool
ValidateCredentials ( string userName, string password ) : bool

Private Methods

Method Description
AuthenticateUser ( Object source, EventArgs e ) : void
InitCredentials ( string username, string password ) : void
InitExcludes ( Devbridge.BasicAuthentication.Configuration basicAuth ) : void
IsRedirect ( int httpStatusCode ) : bool
IsStatusOK ( int httpStatusCode ) : bool
IssueAuthenticationChallenge ( Object source, EventArgs e ) : void
ShouldChallenge ( HttpContext context ) : bool

Returns true if authentication challenge should be sent to client based on configured exclude rules

Method Details

Dispose() public method

public Dispose ( ) : void
return void

ExtractBasicCredentials() protected method

protected ExtractBasicCredentials ( string authorizationHeader, string &username, string &password ) : bool
authorizationHeader string
username string
password string
return bool

Init() public method

public Init ( System.Web.HttpApplication context ) : void
context System.Web.HttpApplication
return void

ValidateCredentials() protected method

protected ValidateCredentials ( string userName, string password ) : bool
userName string
password string
return bool