How paloaltonetworks/a3s works
Project type and purpose
• A3S (“Auth As A Service”) is a backend‐focused full-stack authentication and ABAC authorization server written in Go.
• It provides:
• A RESTful HTTP API (cmd/a3s)
• A CLI client “a3sctl” (cmd/a3sctl)
• A small web-based login UI (internal/ui/js/login)
• Support for multiple external authentication sources (MTLS, LDAP, HTTP, OIDC, AWS, GCP, Azure, remote A3S)
• Policy and namespace management, backed by MongoDB and a NATS push channel
High-level components
• Client tier
• a3sctl CLI (Go binary)
• Web UI (static JS/TS served by the server)
• Example apps (Python “testapp”, “httpsource”, “claimmod”)
• API server (cmd/a3s)
• HTTP(S) API endpoints
• Bootstrap & runtime initialization (pkgs/bootstrap)
• Request routing and handlers (pkgs/api)
• Core processors (internal/processors) implementing authentication, authorization, import, etc.
• Issuer implementations (internal/issuer/*) for each source type
• Identity modifiers (internal/identitymodifier)
• JWT/token management (pkgs/token)
• Persistence via MongoDB (pkgs/crud, pkgs/indexes)
• Pub/Sub via NATS for cache invalidation and push notifications (pkgs/notification, pkgs/push)
• Data stores
• MongoDB for all metadata (namespaces, sources, authorizations, import labels)
• In-memory or file-based caches for OIDC state (internal/oidcceremony) and namespace trees (pkgs/nscache)
• External services
• LDAP servers
• OIDC providers
• Your own HTTP authentication endpoint
• Remote A3S instances
• Cloud metadata services (AWS, GCP, Azure)
Relationships and data flows
• Authentication flow
1. Client (a3sctl / UI) calls “/auth/{source}” on A3S over HTTPS
2. API handler dispatches to the appropriate issuer in internal/issuer
3. If configured, calls identity modifier (HTTP callback)
4. Assembles claims and signs a JWT (pkgs/token)
5. Returns identity token to client
• Authorization check
1. Client presents JWT to A3S “/authz” endpoint or validates locally
2. Server retrieves policies (internal/processors/authorizations.go) and computes effective permissions using authorizer (pkgs/authorizer)
3. Optionally pushes cache invalidation messages to NATS for connected apps
• Management API and CLI
• a3sctl uses the same REST API to create namespaces, sources, authorizations and perform imports
• Pub/Sub and caching
• Server publishes change events (pkgs/push) on NATS so that clients or dashboards can invalidate or update permission caches
Architectural patterns and principles
• Layered architecture: bootstrap → API routing → processors → business-logic packages → datastore
• Plugin-style issuers: each auth source is a separate module implementing a common interface (internal/issuer)
• Declarative import & reconciliation (pkgs/api/import.go)
Final checklist
• Clear separation of client, server core, storage, external systems
• Groupings or containers to convey modular layering
• Notes on key design patterns: plugin issuers, layered processing, declarative import