Skip to main content

Crate pdk_contracts_lib

Crate pdk_contracts_lib 

Source
Expand description

PDK Contracts Library

Library for validating client credentials against Anypoint Platform API contracts in Flex Gateway custom policies. It periodically fetches contracts from the platform and keeps a local cache to enable fast authentication and authorization decisions within the policy request path.

§Highlights

  • Local contracts cache with concurrency-safe updates
  • Periodic polling and incremental updates from the platform
  • Authorization via client_id and authentication via client_id/client_secret
  • Helpers to parse HTTP Basic Auth credentials

§Primary types

§Readiness and polling cadence

Structs§

ClientData
The information regarding the client that was authenticated or authorized.
ClientId
Represents a client ID credential.
ClientSecret
Represents a client secret credential. This type ensures secure memory management by zeroing memory on drop. Debug printing is safe since the internal representation is hidden.
ContractValidator
The object that will collect the contracts and provide the functionality to validate incoming requests.

Enums§

AuthenticationError
Error returned when ContractValidator::authenticate() fails.
AuthorizationError
Error returned when ContractValidator::authorize() fails.
BasicAuthError
Error returned when basic_auth_credentials() fails.
UpdateError
Error returned when ContractValidator::update_contracts() fails.

Functions§

basic_auth_credentials
Extracts a pair of credentials from a Basic-Auth header.