#include <SchemeConfig.h>

Collaboration diagram for Auth::SchemeConfig:

Public Member Functions

 SchemeConfig ()
 
virtual ~SchemeConfig ()
 
virtual bool active () const =0
 
virtual UserRequest::Pointer decode (char const *proxy_auth, const HttpRequest *request, const char *requestRealm)=0
 
virtual void done ()
 
virtual bool configured () const =0
 
virtual void rotateHelpers (void)=0
 
virtual bool dump (StoreEntry *, const char *, SchemeConfig *) const
 
virtual void fixHeader (UserRequest::Pointer, HttpReply *, Http::HdrType, HttpRequest *)=0
 
virtual void init (SchemeConfig *)=0
 
virtual void registerWithCacheManager (void)
 
virtual void parse (SchemeConfig *, int, char *)
 
virtual const char * type () const =0
 

Static Public Member Functions

static UserRequest::Pointer CreateAuthUser (const char *proxy_auth, AccessLogEntry::Pointer &al)
 
static SchemeConfigFind (const char *proxy_auth)
 
static SchemeConfigGetParsed (const char *proxy_auth)
 

Public Attributes

Helper::ChildConfig authenticateChildren
 
wordlistauthenticateProgram = nullptr
 Helper program to run, includes all parameters. More...
 
String keyExtrasLine
 The format of the request to the auth helper. More...
 
Format::FormatkeyExtras = nullptr
 The compiled request format. More...
 
int keep_alive = 1
 whether to close the connection on auth challenges. default: on More...
 
int utf8 = 0
 whether to accept UTF-8 characterset instead of ASCII. default: off More...
 

Protected Member Functions

bool isCP1251EncodingAllowed (const HttpRequest *request)
 

Protected Attributes

SBuf realm
 RFC 7235 section 2.2 - Protection Space (Realm) More...
 

Detailed Description

I am the configuration for an auth scheme. Currently each scheme has only one instance of me, but this may change.
This class is treated like a ref counted class. If the children ever stop being singletons, implement the ref counting...

Definition at line 46 of file SchemeConfig.h.

Constructor & Destructor Documentation

◆ SchemeConfig()

Auth::SchemeConfig::SchemeConfig ( )
inline

Definition at line 56 of file SchemeConfig.h.

◆ ~SchemeConfig()

virtual Auth::SchemeConfig::~SchemeConfig ( )
inlinevirtual

Definition at line 58 of file SchemeConfig.h.

Member Function Documentation

◆ active()

virtual bool Auth::SchemeConfig::active ( ) const
pure virtual

Used by squid to determine whether the auth module has successfully initialised itself with the current configuration.

Return values
trueAuthentication Module loaded and running.
falseNo Authentication Module loaded.

Referenced by configDoConfigure(), and CreateAuthUser().

◆ configured()

virtual bool Auth::SchemeConfig::configured ( ) const
pure virtual

The configured function is used to see if the auth module has been given valid parameters and is able to handle authentication requests.

Return values
trueAuthentication Module configured ready for use.
falseNot configured or Configuration Error. No other module functions except Shutdown/Dump/Parse/FreeConfig will be called by Squid.

◆ CreateAuthUser()

Auth::UserRequest::Pointer Auth::SchemeConfig::CreateAuthUser ( const char *  proxy_auth,
AccessLogEntry::Pointer al 
)
static

Get an User credentials object filled out for the given Proxy- or WWW-Authenticate header. Any decoding which needs to be done will be done.

It may be a cached AuthUser or a new Unauthenticated object. It may also be NULL reflecting that no user could be created.

Definition at line 33 of file SchemeConfig.cc.

References active(), Format::Format::assemble(), assert, MemBuf::content(), DBG_IMPORTANT, debugs, decode(), Find(), MemBuf::hasContent(), keyExtras, AccessLogEntry::request, MemBuf::reset(), and shutting_down.

Referenced by Auth::UserRequest::authenticate().

◆ decode()

virtual UserRequest::Pointer Auth::SchemeConfig::decode ( char const *  proxy_auth,
const HttpRequest request,
const char *  requestRealm 
)
pure virtual

new decode API: virtual factory pattern

Responsible for decoding the passed authentication header, creating or linking to a AuthUser object and for storing any needed details to complete authentication in Auth::UserRequest::authenticate().
Parameters
proxy_authLogin Pattern to parse.
Return values
*Details needed to authenticate.

Referenced by CreateAuthUser().

◆ done()

void Auth::SchemeConfig::done ( )
virtual

squid is finished with this config, release any unneeded resources. If a singleton, delete will not occur. if not a singleton (future), delete will occur when no references are held.

TODO: need a 'done for reconfigure' and a 'done permanently' concept.

Definition at line 175 of file SchemeConfig.cc.

◆ dump()

bool Auth::SchemeConfig::dump ( StoreEntry entry,
const char *  name,
Auth::SchemeConfig scheme 
) const
virtual

Responsible for writing to the StoreEntry the configuration parameters that a user would put in a config file to recreate the running configuration. Returns whether the scheme is configured.

Definition at line 140 of file SchemeConfig.cc.

References wordlist::key, wordlist::next, SQUIDSBUFPH, SQUIDSBUFPRINT, storeAppendPrintf(), and type().

◆ Find()

◆ fixHeader()

virtual void Auth::SchemeConfig::fixHeader ( UserRequest::Pointer  ,
HttpReply ,
Http::HdrType  ,
HttpRequest  
)
pure virtual

add headers as needed when challenging for auth

Referenced by Auth::UserRequest::AddReplyAuthHeader().

◆ GetParsed()

Auth::SchemeConfig * Auth::SchemeConfig::GetParsed ( const char *  proxy_auth)
static

Call this method if you need a guarantee that all auth schemes has been already configured.

Definition at line 70 of file SchemeConfig.cc.

References fatalf().

Referenced by Auth::SchemesConfig::expand().

◆ init()

virtual void Auth::SchemeConfig::init ( SchemeConfig )
pure virtual

prepare to handle requests

◆ isCP1251EncodingAllowed()

bool Auth::SchemeConfig::isCP1251EncodingAllowed ( const HttpRequest request)
protected

Parse Accept-Language header and return whether a CP1251 encoding allowed or not.

CP1251 (aka Windows-1251) is an 8-bit character encoding, designed to cover languages that use the Cyrillic script.

Definition at line 183 of file SchemeConfig.cc.

References Http::ACCEPT_LANGUAGE, HttpHeader::getList(), Http::Message::header, strHdrAcptLangGetItem(), and xisalpha.

◆ parse()

void Auth::SchemeConfig::parse ( Auth::SchemeConfig scheme,
int  ,
char *  param_str 
)
virtual

◆ registerWithCacheManager()

void Auth::SchemeConfig::registerWithCacheManager ( void  )
virtual

expose any/all statistics to a CacheManager

Default behaviour is to expose nothing

Definition at line 80 of file SchemeConfig.cc.

◆ rotateHelpers()

virtual void Auth::SchemeConfig::rotateHelpers ( void  )
pure virtual

Shutdown just the auth helpers. For use by log rotate etc. where auth needs to stay running, with the helpers restarted.

◆ type()

virtual const char * Auth::SchemeConfig::type ( ) const
pure virtual

the http string id

Referenced by dump(), and parse().

Member Data Documentation

◆ authenticateChildren

Helper::ChildConfig Auth::SchemeConfig::authenticateChildren

Definition at line 128 of file SchemeConfig.h.

◆ authenticateProgram

wordlist* Auth::SchemeConfig::authenticateProgram = nullptr

Definition at line 129 of file SchemeConfig.h.

◆ keep_alive

int Auth::SchemeConfig::keep_alive = 1

Definition at line 132 of file SchemeConfig.h.

◆ keyExtras

Format::Format* Auth::SchemeConfig::keyExtras = nullptr

Definition at line 131 of file SchemeConfig.h.

Referenced by CreateAuthUser().

◆ keyExtrasLine

String Auth::SchemeConfig::keyExtrasLine

Definition at line 130 of file SchemeConfig.h.

◆ realm

SBuf Auth::SchemeConfig::realm
protected

Definition at line 146 of file SchemeConfig.h.

◆ utf8

int Auth::SchemeConfig::utf8 = 0

Definition at line 133 of file SchemeConfig.h.


The documentation for this class was generated from the following files:

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors