{"modulePath":"github.com/GoCodeAlone/workflow","version":"v0.87.0","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package iam\n\n## Types\n\n```go\ntype ExternalIdentity struct {\n\tProvider   string            `json:\"provider\"`\n\tIdentifier string            `json:\"identifier\"`\n\tAttributes map[string]string `json:\"attributes,omitempty\"`\n}\n```\nExternalIdentity represents an identity from an external IAM system.\n\n```go\ntype IAMProvider interface {\n\t// Type returns the provider type identifier.\n\tType() store.IAMProviderType\n\t// ValidateConfig checks that the provider configuration is valid.\n\tValidateConfig(config json.RawMessage) error\n\t// ResolveIdentities extracts external identities from the given credentials/token.\n\tResolveIdentities(ctx context.Context, config json.RawMessage, credentials map[string]string) ([]ExternalIdentity, error)\n\t// TestConnection tests that the provider configuration can connect.\n\tTestConnection(ctx context.Context, config json.RawMessage) error\n}\n```\nIAMProvider defines the interface for an external IAM provider.\n\n```go\ntype IAMResolver struct {\n\t// contains filtered or unexported fields\n}\n```\nIAMResolver combines IAM providers with the store to resolve external identities to roles.\n\n```go\nfunc NewIAMResolver(iamStore store.IAMStore) *IAMResolver\n```\nNewIAMResolver creates a new IAMResolver.\n\n```go\nfunc (r *IAMResolver) GetProvider(providerType store.IAMProviderType) (IAMProvider, bool)\n```\nGetProvider returns the registered provider for the given type, if any.\n\n```go\nfunc (r *IAMResolver) RegisterProvider(p IAMProvider)\n```\nRegisterProvider registers an IAM provider implementation.\n\n```go\nfunc (r *IAMResolver) ResolveRole(ctx context.Context, companyID uuid.UUID, identity ExternalIdentity, resourceType string, resourceID uuid.UUID) (store.Role, error)\n```\nResolveRole resolves the highest role for an external identity across all enabled providers in a company for a specific resource.\n\n```go\ntype KubernetesConfig struct {\n\t// ClusterName is a human-readable identifier for the cluster (required).\n\tClusterName string `json:\"cluster_name\"`\n\t// Namespace to look up ServiceAccounts in (default: \"default\").\n\tNamespace string `json:\"namespace\"`\n\t// Server is the Kubernetes API server URL (e.g. https://kubernetes.default.svc).\n\t// If empty, uses the in-cluster service account token.\n\tServer string `json:\"server,omitempty\"`\n\t// Token is the Bearer token for authenticating with the API server.\n\t// If empty, reads from /var/run/secrets/kubernetes.io/serviceaccount/token.\n\tToken string `json:\"token,omitempty\"`\n\t// CAData is the base64-encoded PEM certificate authority bundle.\n\t// If empty, uses the in-cluster CA at /var/run/secrets/kubernetes.io/serviceaccount/ca.crt.\n\tCAData string `json:\"ca_data,omitempty\"`\n\t// InsecureSkipVerify disables TLS certificate verification (not recommended for production).\n\tInsecureSkipVerify bool `json:\"insecure_skip_verify,omitempty\"`\n}\n```\nKubernetesConfig holds configuration for the Kubernetes RBAC provider.\n\n```go\ntype KubernetesProvider struct{}\n```\nKubernetesProvider maps Kubernetes ServiceAccounts and Groups to roles by performing real Kubernetes API calls.\n\n```go\nfunc (p *KubernetesProvider) ResolveIdentities(ctx context.Context, config json.RawMessage, credentials map[string]string) ([]ExternalIdentity, error)\n```\nResolveIdentities looks up the ServiceAccount or Group in the configured namespace and returns external identities for any that exist.\n\n```go\nfunc (p *KubernetesProvider) TestConnection(ctx context.Context, config json.RawMessage) error\n```\nTestConnection attempts to connect to the Kubernetes API server and list namespaces.\n\n```go\nfunc (p *KubernetesProvider) Type() store.IAMProviderType\n```\n\n```go\nfunc (p *KubernetesProvider) ValidateConfig(config json.RawMessage) error\n```\n\n```go\ntype OIDCConfig struct {\n\tIssuer       string `json:\"issuer\"`\n\tClientID     string `json:\"client_id\"`\n\tClaimKey     string `json:\"claim_key,omitempty\"` // Which claim to use as the external identifier (e.g. \"sub\", \"email\")\n\tJWKSURL      string `json:\"jwks_url,omitempty\"`\n\tDiscoveryURL string `json:\"discovery_url,omitempty\"`\n}\n```\nOIDCConfig holds configuration for the OIDC provider.\n\n```go\ntype OIDCProvider struct {\n\t// HTTPClient is the HTTP client used for OIDC discovery and JWKS requests.\n\t// If nil, http.DefaultClient is used.\n\tHTTPClient *http.Client\n\t// contains filtered or unexported fields\n}\n```\nOIDCProvider maps OIDC claims to roles using OIDC discovery and JWT validation.\n\n```go\nfunc (p *OIDCProvider) ResolveIdentities(ctx context.Context, config json.RawMessage, credentials map[string]string) ([]ExternalIdentity, error)\n```\n\n```go\nfunc (p *OIDCProvider) TestConnection(ctx context.Context, config json.RawMessage) error\n```\n\n```go\nfunc (p *OIDCProvider) Type() store.IAMProviderType\n```\n\n```go\nfunc (p *OIDCProvider) ValidateConfig(config json.RawMessage) error\n```\n\n","path":"github.com/GoCodeAlone/workflow/iam","name":"iam","synopsis":"","isRedistributable":true}
