38class access_control_manager;
53namespace dicomweb_scopes {
54constexpr std::string_view
read =
"dicomweb.read";
55constexpr std::string_view
search =
"dicomweb.search";
56constexpr std::string_view
write =
"dicomweb.write";
130 std::shared_ptr<security::access_control_manager> manager);
145 const crow::request& req, crow::response& res)
const;
161 std::string_view required_scope)
const;
174 const std::vector<std::string>& required_scopes)
const;
179 [[nodiscard]]
bool enabled()
const noexcept;
194 const crow::request& req)
const;
201 std::string_view message);
205 std::string_view message);
Represents the security context for a user session.
bool enabled() const noexcept
Check if OAuth 2.0 is enabled.
std::optional< auth_result > authenticate(const crow::request &req, crow::response &res) const
Authenticate a request using OAuth 2.0 Bearer token.
std::shared_ptr< jwks_provider > jwks_provider_
bool require_any_scope(const jwt_claims &claims, crow::response &res, const std::vector< std::string > &required_scopes) const
Check if the request has any of the required scopes.
static void set_unauthorized(crow::response &res, std::string_view message)
Set 401 Unauthorized response.
bool require_scope(const jwt_claims &claims, crow::response &res, std::string_view required_scope) const
Check if the authenticated request has a required scope.
std::optional< std::string_view > extract_bearer_token(const crow::request &req) const
Extract Bearer token from Authorization header.
void set_jwks_provider(std::shared_ptr< jwks_provider > provider)
Set the JWKS provider for signature verification.
bool verify_signature(const jwt_token &token) const
Verify token signature using JWKS keys.
void set_access_control_manager(std::shared_ptr< security::access_control_manager > manager)
Set the access control manager for RBAC integration.
oauth2_middleware(const oauth2_config &config)
Construct middleware with OAuth 2.0 configuration.
static void set_forbidden(crow::response &res, std::string_view message)
Set 403 Forbidden response.
const jwt_validator & validator() const noexcept
Get the underlying JWT validator.
std::shared_ptr< security::access_control_manager > security_manager_
JSON Web Key Set (JWKS) provider with key caching.
JWT (JSON Web Token) validation for OAuth 2.0.
constexpr std::string_view write
constexpr std::string_view delete_resource
constexpr std::string_view read
constexpr std::string_view search
OAuth 2.0 configuration for DICOMweb endpoints.
Result of a successful OAuth 2.0 authentication.
security::user_context context
Decoded JWT claims (payload)
Decoded JWT token with raw segments for signature verification.
OAuth 2.0 configuration for DICOMweb authorization.
User context for session-based access control.