Documentation
¶
Overview ¶
Package identity is the broker contract the REST and OIDC layers program against; backends (dex/) implement it and callers never import one directly.
Index ¶
- Variables
- func ConnectorType(c ConnectorConfig) string
- type Broker
- type Client
- type ClientStore
- type ConfigSealer
- type Connector
- type ConnectorConfig
- type ConnectorStore
- type GitHubConnectorConfig
- type GitHubOrg
- type GoogleConnectorConfig
- type LDAPConnectorConfig
- type LDAPGroupSearch
- type LDAPUserMatcher
- type LDAPUserSearch
- type MicrosoftConnectorConfig
- type OIDCConnectorConfig
- type OpaqueConnectorConfig
- type SAMLConnectorConfig
- type SecretRef
- type SeedFunc
- type StartupSeeder
Constants ¶
This section is empty.
Variables ¶
var ( ErrClientNotFound = errors.New("identity: client not found") ErrClientExists = errors.New("identity: client already exists") )
var ( ErrConnectorNotFound = errors.New("identity: connector not found") ErrConnectorExists = errors.New("identity: connector already exists") )
Functions ¶
func ConnectorType ¶
func ConnectorType(c ConnectorConfig) string
ConnectorType is the kind label for logs and validation; type-switch for the value.
Types ¶
type Broker ¶
type Broker interface {
// Handler serves discovery, /auth, /token, /keys and /callback; it must not
// rewrite the prefix it is mounted under.
Handler() http.Handler
Connectors() ConnectorStore
Clients() ClientStore
}
Broker issues OIDC tokens, federates upstream IdPs and serves connector and client CRUD. Safe for concurrent use.
type Client ¶
type Client struct {
ID string
Name string
// RedirectURIs is an allowlist: any other redirect_uri is rejected.
RedirectURIs []string
// TrustedPeers are client IDs whose ID tokens this client accepts.
TrustedPeers []string
// Public clients (native apps, SPAs) use PKCE and have no secret.
Public bool
LogoURL string
}
type ClientStore ¶
type ClientStore interface {
// Create returns the generated secret once and never again (Dex stores it
// hashed). A Public client gets "": PKCE needs no secret to leak.
Create(ctx context.Context, c Client) (secret string, err error)
// List and Get always leave Secret empty.
List(ctx context.Context) ([]Client, error)
Get(ctx context.Context, id string) (Client, error)
// Update replaces Name, RedirectURIs, TrustedPeers and LogoURL, never the secret.
Update(ctx context.Context, c Client) error
Delete(ctx context.Context, id string) error
// RotateSecret returns the new secret once. The old one dies immediately, with
// no overlap, so rotate a live client only if you can deliver the new one.
RotateSecret(ctx context.Context, id string) (secret string, err error)
}
ClientStore is CRUD for the broker's OAuth2 clients. Unknown IDs return ErrClientNotFound; a duplicate Create returns ErrClientExists.
type ConfigSealer ¶
type ConfigSealer interface {
// Seal's output carries whatever nonce and version framing Open needs.
Seal(plaintext []byte) ([]byte, error)
// Open passes through rows written before sealing was on, until re-sealed.
Open(sealed []byte) ([]byte, error)
}
ConfigSealer encrypts state that must be recoverable at rest (connector credentials replayed on every login, decisions, device codes). The host supplies the cipher so this module holds no key; nil means cleartext.
type Connector ¶
type Connector struct {
// ID is the seeding idempotency key and the login URL segment.
ID string
Name string
// Config's concrete type is the connector kind.
Config ConnectorConfig
}
type ConnectorConfig ¶
type ConnectorConfig interface {
// contains filtered or unexported methods
}
ConnectorConfig is sealed: the unexported method keeps the set of kinds here.
type ConnectorStore ¶
type ConnectorStore interface {
Create(ctx context.Context, c Connector) error
List(ctx context.Context) ([]Connector, error)
Get(ctx context.Context, id string) (Connector, error)
Update(ctx context.Context, c Connector) error
Delete(ctx context.Context, id string) error
}
ConnectorStore is CRUD for upstream IdP connectors. Unknown IDs return ErrConnectorNotFound; a duplicate Create returns ErrConnectorExists.
type GitHubConnectorConfig ¶
type GitHubConnectorConfig struct {
ClientID string
ClientSecret SecretRef
// RedirectURI must be issuerURL + "/callback".
RedirectURI string
// Orgs, when set, restricts login to their members.
Orgs []GitHubOrg
// HostName points the connector at a GitHub Enterprise host instead of
// github.com; Dex always dials it over https.
HostName string
// RootCA is a PEM, or a path to one, trusted for HostName only.
RootCA string
}
type GoogleConnectorConfig ¶
type LDAPConnectorConfig ¶
type LDAPConnectorConfig struct {
// Host is "host:port".
Host string
BindDN string
BindSecret SecretRef
// StartTLS is ignored on 636 (LDAPS).
StartTLS bool
// InsecureSkipVerify: never in production.
InsecureSkipVerify bool
UserSearch LDAPUserSearch
GroupSearch LDAPGroupSearch
}
LDAPConnectorConfig is LDAP or Active Directory.
type LDAPGroupSearch ¶
type LDAPGroupSearch struct {
BaseDN string
Filter string
UserMatchers []LDAPUserMatcher
NameAttr string
}
type LDAPUserMatcher ¶
LDAPUserMatcher joins a group entry attribute to a user entry attribute.
type LDAPUserSearch ¶
type MicrosoftConnectorConfig ¶
type MicrosoftConnectorConfig struct {
ClientID string
ClientSecret SecretRef
// Tenant is required and must be single-tenant; "common", "organizations"
// and "consumers" are refused (see axa/dex marshalMicrosoft).
Tenant string
// OnlySecurityGroups keeps tokens small for users in many groups.
OnlySecurityGroups bool
// Groups, when set, is an allowlist of group object IDs.
Groups []string
}
MicrosoftConnectorConfig is Azure AD / Entra.
type OIDCConnectorConfig ¶
type OIDCConnectorConfig struct {
// IssuerURL keeps its trailing slash ("https://example.us.auth0.com/").
IssuerURL string
ClientID string
ClientSecret SecretRef
// Scopes are requested on top of "openid".
Scopes []string
// RedirectURI must be issuerURL + "/callback"; Dex refuses the callback otherwise.
RedirectURI string
// InsecureSkipVerify: never in production.
InsecureSkipVerify bool
}
OIDCConnectorConfig is any upstream OIDC provider (Auth0, Okta, Google…).
type OpaqueConnectorConfig ¶
type OpaqueConnectorConfig struct {
Type string
RawConfig json.RawMessage
}
OpaqueConnectorConfig is what Get and List return: the kind and the stored config. Credentials appear only as Secret refs; they are never round-tripped.
type SAMLConnectorConfig ¶
type SAMLConnectorConfig struct {
SSOURL string
// CARef holds the PEM cert(s) the IdP signs responses with.
CARef SecretRef
// EntityIssuer is the SP entity ID sent in AuthnRequests.
EntityIssuer string
// SSOIssuer, when set, must equal every response's Issuer.
SSOIssuer string
// Dex will not open the connector without UsernameAttr and EmailAttr.
UsernameAttr string
EmailAttr string
GroupsAttr string
// GroupsDelim splits a single-valued groups attribute.
GroupsDelim string
// NameIDPolicyFormat becomes the Dex subject; defaults to persistent.
NameIDPolicyFormat string
// RedirectURI is the ACS URL: issuerURL + "/callback".
RedirectURI string
}
SAMLConnectorConfig makes Armornet the SP. Dex never signs AuthnRequests, so there is no SP key.
type SecretRef ¶
SecretRef names a key in a Kubernetes Secret. Configs take no raw credentials, so none reach Dex storage or an API response.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package access decides who reaches a destination and signs a short-lived assertion it verifies; the only package composing authn and authz.
|
Package access decides who reaches a destination and signs a short-lived assertion it verifies; the only package composing authn and authz. |
|
authn
module
|
|
|
authz
module
|
|
|
Package dex is axa.Broker on an embedded Dex (the fork in pkg/dex).
|
Package dex is axa.Broker on an embedded Dex (the fork in pkg/dex). |
|
Package fga embeds OpenFGA in process; Client() calls it with no network hop.
|
Package fga embeds OpenFGA in process; Client() calls it with no network hop. |
|
ginauthz
module
|
|
|
internal
|
|
|
dex/connector
Package connector defines interfaces for federated identity strategies.
|
Package connector defines interfaces for federated identity strategies. |
|
dex/connector/atlassiancrowd
Package atlassiancrowd provides authentication strategies using Atlassian Crowd.
|
Package atlassiancrowd provides authentication strategies using Atlassian Crowd. |
|
dex/connector/authproxy
Package authproxy implements a connector which relies on external authentication (e.g.
|
Package authproxy implements a connector which relies on external authentication (e.g. |
|
dex/connector/bitbucketcloud
Package bitbucketcloud provides authentication strategies using Bitbucket Cloud.
|
Package bitbucketcloud provides authentication strategies using Bitbucket Cloud. |
|
dex/connector/gitea
Package gitea provides authentication strategies using Gitea.
|
Package gitea provides authentication strategies using Gitea. |
|
dex/connector/github
Package github provides authentication strategies using GitHub.
|
Package github provides authentication strategies using GitHub. |
|
dex/connector/gitlab
Package gitlab provides authentication strategies using GitLab.
|
Package gitlab provides authentication strategies using GitLab. |
|
dex/connector/google
Package google implements logging in through Google's OpenID Connect provider.
|
Package google implements logging in through Google's OpenID Connect provider. |
|
dex/connector/keystone
Package keystone provides authentication strategy using Keystone.
|
Package keystone provides authentication strategy using Keystone. |
|
dex/connector/ldap
Package ldap implements strategies for authenticating using the LDAP protocol.
|
Package ldap implements strategies for authenticating using the LDAP protocol. |
|
dex/connector/linkedin
Package linkedin provides authentication strategies using LinkedIn
|
Package linkedin provides authentication strategies using LinkedIn |
|
dex/connector/microsoft
Package microsoft provides authentication strategies using Microsoft.
|
Package microsoft provides authentication strategies using Microsoft. |
|
dex/connector/mock
Package mock implements connectors which help test various server components.
|
Package mock implements connectors which help test various server components. |
|
dex/connector/oidc
Package oidc implements logging in through OpenID Connect providers.
|
Package oidc implements logging in through OpenID Connect providers. |
|
dex/connector/saml
Package saml contains login methods for SAML.
|
Package saml contains login methods for SAML. |
|
dex/pkg/groups
Package groups contains helper functions related to groups
|
Package groups contains helper functions related to groups |
|
dex/server
Package server implements an OpenID Connect server with federated logins.
|
Package server implements an OpenID Connect server with federated logins. |
|
dex/storage
Package storage defines the storage interface and types used by the server.
|
Package storage defines the storage interface and types used by the server. |
|
dex/storage/memory
Package memory provides an in memory implementation of the storage interface.
|
Package memory provides an in memory implementation of the storage interface. |
|
Package pgstore is Postgres for the tables identity owns: the host injects a *sql.DB (and the driver), identity owns the SQL, authn stays database-free.
|
Package pgstore is Postgres for the tables identity owns: the host injects a *sql.DB (and the driver), identity owns the SQL, authn stays database-free. |
|
Package service is Dex + OpenFGA + health as one Start/Stop Server, so a host (own pod, goroutine, or inside armornet) wires one object instead of four.
|
Package service is Dex + OpenFGA + health as one Start/Stop Server, so a host (own pod, goroutine, or inside armornet) wires one object instead of four. |
|
Package web is browser sign-in on net/http: /api/auth/* from issuer bounce to session cookie, plus MFA.
|
Package web is browser sign-in on net/http: /api/auth/* from issuer bounce to session cookie, plus MFA. |