Provider Interface
The Provider interface is the most important architectural abstraction in jitsudo. It defines the contract every cloud provider adapter must satisfy, enabling new providers to be added without modifying core logic.
Interface Definition
Section titled “Interface Definition”// Provider is the interface all cloud provider adapters must implement.type Provider interface { // Name returns the canonical provider identifier (e.g., "aws", "azure"). Name() string
// ValidateRequest checks whether the requested role and scope are valid // before the request enters the approval workflow. Must not modify state. ValidateRequest(ctx context.Context, req ElevationRequest) error
// Grant issues temporary elevated credentials after approval. // Must be idempotent — calling Grant twice with the same RequestID // must not create duplicate bindings. Grant(ctx context.Context, req ElevationRequest) (*ElevationGrant, error)
// Revoke terminates an active grant before its natural expiry. Revoke(ctx context.Context, grant ElevationGrant) error
// IsActive checks whether a grant is still valid and active. // Used by the expiry sweeper and status checks. IsActive(ctx context.Context, grant ElevationGrant) (bool, error)}Built-in Providers
Section titled “Built-in Providers”| Provider | Mechanism | Resource Scope |
|---|---|---|
| AWS | STS AssumeRole + IAM Identity Center permission set assignment | AWS Account ID |
| Azure | Azure RBAC role assignment via Microsoft Graph API | Subscription / Resource Group |
| GCP | IAM conditional role binding with expiry condition | GCP Project ID |
| Kubernetes | ClusterRoleBinding or RoleBinding with TTL | Cluster / Namespace |
Contract Tests
Section titled “Contract Tests”A shared test suite (internal/providers/contract_test.go) defines behavioral expectations all providers must satisfy:
ValidateRequestrejects empty RequestID, UserIdentity, or zero DurationGrantreturns a validElevationGrantwith a futureExpiresAtGrantis idempotent (calling twice with the same RequestID is safe)IsActivereturnstruefor a just-granted elevationRevokesucceeds for an active grantRevokeis idempotent (calling twice doesn’t error)IsActivereturnsfalseafterRevoke
Any new provider implementation must pass all contract tests before merging.
Adding a New Provider
Section titled “Adding a New Provider”- Create a new package under
internal/providers/<name>/ - Implement the
Providerinterface - Add a factory function to
providerFactoriesincontract_test.go - Pass all contract tests:
go test ./internal/providers/... -short - Add integration tests tagged
//go:build integration - Add documentation under
docs/providers/<name>.md