Qorus Integration Engine® Enterprise Edition 6.0.15_prod
Loading...
Searching...
No Matches
OMQ::QorusCookieAuthenticator Class Reference

class for authenticating with standard Qorus RBAC authentication based on a cookie More...

Inheritance diagram for OMQ::QorusCookieAuthenticator:
[legend]
Collaboration diagram for OMQ::QorusCookieAuthenticator:
[legend]

Public Member Methods

 constructor (string cookie=DefaultCookie, *string redirect_url)
 Creates the object with the argument giving the cookie name to use for authentication. More...
 
*hash< HttpResponseInfo > authenticateRequest (HttpListenerInterface listener, hash< auto > hdr, reference< hash > cx)
 primary method called to authenticate each request More...
 

Public Attributes

const DefaultCookie = "qorus_auth_token"
 The default cookie name.
 

Private Attributes

string cookie
 The cookie name to use for authentication.
 
*string redirect_url
 The URL to redirect unauthenticated requests to.
 

Additional Inherited Members

- Private:Internal Member Methods inherited from OMQ::DefaultQorusRBACAuthenticator
bool requiresAuthentication ()
 called to check if the connection requires authentication More...
 
string getRealm ()
 returns the authentication realm as a string More...
 
*hash< HttpResponseInfo > authenticateRequest (HttpListenerInterface listener, hash< auto > hdr, reference< hash > cx)
 primary method called to authenticate each request More...
 
 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< auto > getAuthHeader (*hash< auto > cx)
 can be overridden to return a header with 401 Unauthorized responses More...
 

Detailed Description

class for authenticating with standard Qorus RBAC authentication based on a cookie

The cookie must contain a valid authentication token

If the cookie is not present or does not hold a valid token, standard authentication is attempted.

If standard authentication also fails, and a redirect URL is set in the constructor, then requests are redirected to the given URL.

See also

Member Function Documentation

◆ authenticateRequest()

*hash< HttpResponseInfo > OMQ::QorusCookieAuthenticator::authenticateRequest ( HttpListenerInterface  listener,
hash< auto >  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:
  • header-info: a hash of information about the request header with the following keys:
    • request-uri: gives the request URI in an HTTP request
    • body-content-type: this is the "Content-Type" header without any charset declaration
    • charset: if there is a charset declaration in the "Content-Type" header, the value is returned in this key
    • close: set to True if the connection should be closed after responding, False if not (as derived from the request header)
    • accept-charset: this key will be set to an appropriate value from any "Accept-Charset" header; if any of "*", "utf8", or "utf-8" are present, then this will be set to "utf8", otherwise it will be set to the first requested character encoding in the list
    • accept-encoding: a hash where keys are values from any "Accept-Encoding" header and the values are True
  • 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 if there were no errors, otherwise returns a hash with the following keys to indicate an authentication or authorization error:
  • "code": the HTTP response code
  • "body": the error message body
  • "hdr": an optional hash of headers for the error response

Authentication is first attempted with the given cookie, if present in the header. If not, then DefaultQorusRBACAuthenticator::authenticateRequest() is called.

See also

◆ constructor()

OMQ::QorusCookieAuthenticator::constructor ( string  cookie = DefaultCookie,
*string  redirect_url 
)

Creates the object with the argument giving the cookie name to use for authentication.

Parameters
cookiethe cookie to check for an authentication token
redirect_urlthe URL to redirect unauthenticated requests to

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