Skip to main content

pdk_contracts_lib/api/
mod.rs

1// Copyright (c) 2026, Salesforce, Inc.,
2// All rights reserved.
3// For full license text, see the LICENSE.txt file
4
5//! Contracts API surface
6//!
7//! Public API for validating client credentials against API contracts pulled
8//! from Anypoint Platform. This module exposes:
9//!
10//! - [`validator`]: the [`ContractValidator`] type used to fetch/update contracts and
11//!   perform `authorize` and `authenticate` operations.
12//! - [`basic_auth`]: helpers to parse HTTP Basic `Authorization` headers.
13//! - [`credentials`]: typed newtypes for client credentials.
14//! - [`error`]: error types for authentication/authorization/update flows.
15//!
16//! Internal submodules `authentication` and `authorization` implement the
17//! underlying logic and are not exported.
18
19pub mod basic_auth;
20pub mod credentials;
21pub mod error;
22pub mod validator;
23
24mod authentication;
25mod authorization;
26
27/// The information regarding the client that was authenticated or authorized.
28#[derive(Clone, Debug)]
29pub struct ClientData {
30    /// The client id validated, it is the same as the one provided in the validation.
31    pub client_id: String,
32    /// The client name associated with validated client.
33    pub client_name: String,
34    /// The SLA associated to the client id.
35    pub sla_id: Option<String>,
36}