Documentation
¶
Overview ¶
Package iam is the canonical import path for Hanzo IAM client types and helpers. Downstream services should import:
import "github.com/hanzoai/base/iam"
and use iam.Client / iam.User / iam.NewClient. The implementation lives in plugins/platform; this package is the stable, brand-neutral surface.
One way to talk to IAM. Type aliases — not copies — so plugins/platform and iam are interchangeable at the type level: a *platform.IAMClient IS an *iam.Client.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ExchangeOAuth2 = platform.ExchangeOAuth2Token
ExchangeOAuth2 exchanges an authorization code for access + refresh tokens via the IAM OAuth2 token endpoint.
var NewClient = platform.NewIAMClient
NewClient constructs a Client pointed at the given IAM base URL. Empty baseURL defaults to https://hanzo.id. Trailing slashes are trimmed.
var NewClientWithCache = platform.NewIAMClientWithCache
NewClientWithCache constructs a Client with a custom cache capacity. Use this when the default 10,000-entry cache is the wrong size — large gateways or low-memory edge nodes.
var ValidateToken = platform.ValidateIAMToken
ValidateToken validates a bearer token against IAM userinfo without caching. Prefer Client.ValidateToken for production use.
Functions ¶
func IsAnalytics ¶
IsAnalytics reports whether token is an insights (hi-) or analytics (ha-) key.
func IsPublishable ¶
IsPublishable reports whether token has the publishable key prefix (pk-).
Types ¶
type AdminCreds ¶
type AdminCreds = platform.AdminCreds
AdminCreds are the service-level IAM application credentials used by server-to-server methods (LookupByAttribute, EnsureUser).
type Config ¶
type Config = platform.PlatformConfig
Config is the platform configuration required by ValidateToken / ExchangeOAuth2.
type EnsureUserSpec ¶
type EnsureUserSpec = platform.EnsureUserSpec
EnsureUserSpec describes a user to provision idempotently via EnsureUser.