Qore HttpServerUtil Module Reference  0.3.12
HttpServer::PermissiveAuthenticator Class Reference

class providing automatic authentication for all requests More...

Inheritance diagram for HttpServer::PermissiveAuthenticator:

Public Member Functions

*hash< HttpResponseInfoauthenticateRequest (HttpListenerInterface listener, hash hdr, reference< hash > cx)
 primary method called to authenticate each request More...
 
- Public Member Functions inherited from HttpServer::AbstractAuthenticator
 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< HttpResponseInfoauthenticateRequest (HttpListenerInterface listener, hash hdr, reference< hash > cx)
 primary method called to authenticate each request More...
 
string getRealm ()
 returns the authentication realm as a string More...
 
bool requiresAuthentication ()
 called to check if the connection requires authentication More...
 

Detailed Description

class providing automatic authentication for all requests

Member Function Documentation

◆ authenticateRequest()

*hash<HttpResponseInfo> HttpServer::PermissiveAuthenticator::authenticateRequest ( HttpListenerInterface  listener,
hash  hdr,
reference< hash cx 
)

primary method called to authenticate each request

Parameters
listeneran HttpListenerInterface object for the listener serving the request for logging purposes
hdra hash of request headers
cxa 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:
  • socket: the bind address used to bind the listener ("socket-info" provides more detailed information)
  • socket-info: a hash of socket information for the listening socket (as returned by Qore::Socket::getSocketInfo())
  • peer-info: a hash of socket information for the remote socket (as returned by Qore::Socket::getPeerInfo())
  • url: a hash of broken-down URL information (as returned from Qore::parse_url())
  • id: the unique HTTP connection ID
  • ssl: True if the request was encrypted with HTTPS, False if not
  • listener-id: the HTTP server listener ID (see HttpServer::getListenerInfo())
  • user: the current RBAC username (if any)
  • root_path: the root URL path matched if the request was matched by a URL prefix
Returns
returns NOTHING indicating that the request is authenticated