Qore HttpServerUtil Module Reference
0.9.11
|
abstract base class for external authentication More...
Public Member Methods | |
authenticate (string user, string pass='') | |
called to authenticate a user for a connection More... | |
authenticateByIP (string ip, reference< string > user) | |
called when the connection requires authentication, but no authentication credentials were supplied, to try to authenticate the connection based on the source IP address More... | |
*hash< HttpResponseInfo > | authenticateRequest (HttpListenerInterface listener, hash< auto > hdr, reference< hash< auto >> cx) |
primary method called to authenticate each request More... | |
hash< HttpResponseInfo > | do401 (string msg='Authentication is required to access this server', *hash< auto > cx) |
returns a 401 repsonse with the given string argument as the message body More... | |
hash< auto > | getAuthHeader () |
returns a hash with one item - WWW-Authenticate header set to correct realm More... | |
hash< auto > | getAuthHeader (hash< auto > cx) |
returns a hash with one item - WWW-Authenticate header set to correct realm More... | |
string | getRealm () |
returns the authentication realm as a string More... | |
bool | requiresAuthentication () |
called to check if the connection requires authentication More... | |
abstract base class for external authentication
This class should be inherited by a class providing real authentication
called to authenticate a user for a connection
This method will only be called if requiresAuthentication() returns True
user | the username to authenticate |
pass | the password for the user |
AUTHENTICATION-ERROR | subclasses should throw this exception if the user cannot be authenticated (must be overridden in child classes; this parent method will never throw any exceptions; all connections are accepted by default) |
called when the connection requires authentication, but no authentication credentials were supplied, to try to authenticate the connection based on the source IP address
This method will only be called if requiresAuthentication() returns True and no authentication credentials are supplied with the request
ip | the IP address of the source connection |
user | a reference to a string that will be populated with the username to use if the request can be authenticated based on the source IP address (this method returns the string "admin" ) |
AUTHENTICATION-ERROR | subclasses should throw this exception if the user cannot be authenticated (however this base class method as implemented here will never throw any exceptions |
*hash<HttpResponseInfo> HttpServer::AbstractAuthenticator::authenticateRequest | ( | HttpListenerInterface | listener, |
hash< auto > | hdr, | ||
reference< hash< auto >> | cx | ||
) |
primary method called to authenticate each request
listener | an HttpListenerInterface object for the listener serving the request for logging purposes |
hdr | a hash of request headers |
cx | a reference to the call context hash; set the "user" key to the user name if a user was identified and authorized; this hash will have the following keys:
|
"code"
: the HTTP response code"body"
: the error message body"hdr"
: an optional hash of headers for the error response hash<HttpResponseInfo> HttpServer::AbstractAuthenticator::do401 | ( | string | msg = 'Authentication is required to access this server' , |
*hash< auto > | cx | ||
) |
returns a 401 repsonse with the given string argument as the message body
msg | message body to return |
cx | the call context |
hash<auto> HttpServer::AbstractAuthenticator::getAuthHeader | ( | ) |
returns a hash with one item - WWW-Authenticate
header set to correct realm
returns a hash with one item - WWW-Authenticate
header set to correct realm
cx | the call context |
string HttpServer::AbstractAuthenticator::getRealm | ( | ) |
returns the authentication realm as a string
"Default Authentication Realm"
)