AXIAM C++ SDK 1.0.0-alpha8
Authentication, authorization, JWKS & route guards (REST + mTLS)
Loading...
Searching...
No Matches
Classes | Namespaces | Macros | Functions
guard.hpp File Reference
#include <functional>
#include <initializer_list>
#include <optional>
#include <string>
#include <vector>
#include "axiam/client.hpp"
#include "axiam/errors.hpp"

Go to the source code of this file.

Classes

struct  axiam::AxiamUser
 Authenticated identity injected by the §10 guard into the request context. More...
 
class  axiam::AxiamGuard< Request >
 §10 guard functor: a callable that turns a request into an AxiamUser using a caller-supplied authenticator (the §10 verification adapter). More...
 

Namespaces

namespace  axiam
 

Macros

#define AXIAM_REQUIRE_ACCESS(client, user, action, resource)    ::axiam::require_access((client), (user), (action), (resource))
 §11 C++ analog of the per-language require_access macro.
 
#define AXIAM_REQUIRE_AUTH(user)   ::axiam::require_auth((user))
 

Functions

const AxiamUseraxiam::require_auth (const std::optional< AxiamUser > &user)
 §11 require_auth — endpoint requires an authenticated identity.
 
void axiam::require_role (const std::optional< AxiamUser > &user, std::initializer_list< std::string > any_of)
 §11 require_role — local check against the verified token's roles.
 
void axiam::require_access (Client &client, const std::optional< AxiamUser > &user, const std::string &action, const std::string &resource_id, std::optional< std::string > scope=std::nullopt)
 §11 require_access — authorize the REQUEST's user (subject propagation: subject_id = user.user_id) for action on resource_id.
 
template<typename Request >
void axiam::require_access (Client &client, const std::optional< AxiamUser > &user, const std::string &action, const std::function< std::string(const Request &)> &resolver, const Request &request, std::optional< std::string > scope=std::nullopt)
 Resolver-based overload (§11.3c): resolve the resource id from an arbitrary request object via a callback, then delegate to the guard above.
 

Macro Definition Documentation

◆ AXIAM_REQUIRE_ACCESS

#define AXIAM_REQUIRE_ACCESS (   client,
  user,
  action,
  resource 
)     ::axiam::require_access((client), (user), (action), (resource))

§11 C++ analog of the per-language require_access macro.

Evaluates the guard for client/user and throws on failure (AuthError/AuthzError), so it reads as a one-line precondition at the top of a handler.

◆ AXIAM_REQUIRE_AUTH

#define AXIAM_REQUIRE_AUTH (   user)    ::axiam::require_auth((user))