Barracuda Application Server C/C++ Reference
Native APIs, integration guides, and platform interfaces
JConstrCont.h File Reference
#include "JUserCont.h"
#include "BaServerLib.h"
#include "HashTable.h"
Include dependency graph for JConstrCont.h:

Go to the source code of this file.

Classes

struct  JConstrCont
 Authorization rules loaded from a parsed JSON object. More...
 

Macros

#define JConstrCont_setCaseInsensitive(o)   (o)->caseSensensitive=FALSE
 Enable case-insensitive prefix matching. More...
 

Typedefs

typedef JConstrCont JConstrCont
 Authorization rules loaded from a parsed JSON object. More...
 

Functions

BA_API void JConstrCont_constructor (JConstrCont *o, JUserCont *userCont, AllocatorIntf *alloc)
 Initialize an empty rule container. More...
 
BA_API void JConstrCont_destructor (JConstrCont *o)
 Release rules after detaching the authorizer from its users. More...
 
BA_API void JConstrCont_setConstraints (JConstrCont *o, JVal *constraintsVal, JErr *err)
 Replace rules without rollback on failure. More...
 

Macro Definition Documentation

◆ JConstrCont_setCaseInsensitive

#define JConstrCont_setCaseInsensitive (   o)    (o)->caseSensensitive=FALSE

Enable case-insensitive prefix matching.

Parameters
[in,out]oInitialized container. Exact-path comparisons are unchanged.

Typedef Documentation

◆ JConstrCont

Authorization rules loaded from a parsed JSON object.

Each object member is a rule object with urls, methods and roles arrays. The rule member name is only a label. For example:

{"admin":{"urls":["/admin/ *"],"methods":["GET"],"roles":["admin"]}}

Exact paths are checked before prefix rules. A final slash-star selects a prefix; this is not a general wildcard matcher. An empty methods array matches all HTTP methods, and an empty roles array matches all roles. A user with no roles has special super-user access as defined by JUserCont. HTTP HEAD is checked as GET. Unmatched requests are denied.

The user database is borrowed and must outlive this object. Rule updates are not transactional: existing rules are removed before replacement is complete. Serialize configuration changes with requests using this object.

Function Documentation

◆ JConstrCont_constructor()

BA_API void JConstrCont_constructor ( JConstrCont o,
JUserCont userCont,
AllocatorIntf alloc 
)

Initialize an empty rule container.

Parameters
[out]oCaller-owned storage.
[in]userContRequired borrowed user database.
[in]allocBorrowed allocator, or NULL for the default.
See also
JConstrCont::JConstrCont

◆ JConstrCont_destructor()

BA_API void JConstrCont_destructor ( JConstrCont o)

Release rules after detaching the authorizer from its users.

Parameters
[in,out]oInitialized container; its user database is not destroyed.

◆ JConstrCont_setConstraints()

BA_API void JConstrCont_setConstraints ( JConstrCont o,
JVal constraintsVal,
JErr err 
)

Replace rules without rollback on failure.

Parameters
[in,out]oInitialized container.
[in]constraintsValParsed JSON object; see JConstrCont::setConstraints.
[in,out]errRequired initialized JErr receiving reported failures.