oidfed

package module
v0.11.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 29, 2026 License: MIT Imports: 55 Imported by: 9

README

Implementation of OpenID Federations for Golang

License GitHub go.mod Go version Go Report DeepSource DeepSource

This repository holds a work-in-process implementation of OpenID Federation in the go language with the goal to enable go applications to make use of OpenID federation.

The implementation mainly focuses on the Relying Party and Intermediate / Trust Anchor side, but not on the OP side. However, building blocks can also be utilized for OPs or other entity types. We provide a basic library as well as a configurable and flexible federation entity to support higher level functionality.

  • This repository contains:
    • The basic go-oidfed library with the core oidfed functionalities.
    • It can be used to build all kind of oidfed capable entities.
  • The LightHouse repository at https://github.com/go-oidfed/lighthouse contains:
    • Higher level implementation for various federation endpoints
    • The LightHouse federation entity. This is a configurable and flexible federation entity that can be used as a
      • Trust Anchor
      • Intermediate Authority
      • Trust Mark Issuer
      • Resolver
      • Entity Collector
      • Everything at the same time.
  • The whoami-rp repository at https://github.com/go-oidfed/whoami-rp contains:
    • A simple - but not very useful - example RP.
  • The OFFA repository at https://github.com/go-oidfed/offa:
    • OFFA stands for Openid Federation Forward Auth
    • OFFA can be deployed next to existing services to add oidfed authentication to services that do not natively support it.
    • OFFA can be used with Apache, Caddy, NGINX, and Traefik.
Implementation State

The library is not considered stable and some features might be missing. We encourage everybody to give feedback on things that are missing, not working, or weird, also suggestions for improvements – and of course we are open for pull requests.

Here we try to sum up the current implementation state, (but it's very likely that the list is not complete)

Feature Library Entity
OpenID Configuration Yes Yes
Trust Chain Building Yes When needed
Trust Chain Verification Yes Yes
Applying Metadata Policies Yes Yes
Applying Metadata from Superiors Yes Yes
Support for Custom Metadata Policy Operators Yes Yes
except Metadata Policy Operator Yes Yes
Filter Trust Chains Yes Yes
Configure Trust Anchors Yes Yes
Set Authority Hints N/A Yes
Resolve Endpoint Yes
IA Fetch Endpoint Yes
IA Listing Endpoint Yes
Trust Mark Endpoint Yes
Trust Marked Entities Endpoint Yes
Trust Mark Status Endpoint Yes
Trust Mark Owner Delegation Yes Yes
Trust Mark JWT Verification Yes Yes
Trust Mark JWT Verification including Delegation Yes Yes
Trust Mark Verification through Trust Mark Status Endpoint No No
JWT Type Verification Yes Yes
Requests using GET Yes
Requests using POST Yes
Client Authentication Yes Yes
Automatic Client Registration Yes Yes
Authorization Code Flow with Automatic Client Registration using oidc key from jwks Yes
Authorization Code Flow with Automatic Client Registration using oidc key from jwks_uri No
Authorization Code Flow with Automatic Client Registration using oidc key from signed_jwks_uri No
Explicit Client Registration Yes Yes
Constraints Yes Yes
Federation Historical Keys Endpoint Yes Yes
Automatic Key Rollover Yes
Key Rotation Hooks (Cmd / HTTP) Yes Yes
Federation JWKS Update / Trigger Endpoints (POST) Yes
Trust Anchor JWKS Refresher Yes Yes
Subordinate JWKS Refresher Yes Yes
Proactive Resolver Yes Yes
Periodic Entity Collector Yes Yes
Entity Collection Endpoint Yes Yes
Post-Quantum Signing Algorithms Yes Yes
Enrollment of Entities Yes
Configurable Checks for Enrollment Yes
Custom Checks for Enrollment Yes
Request Enrollment Yes
Configurable Checks for Trust Mark Issuance Yes
Custom Checks for Trust Mark Issuance Yes
Request to become entitled for a Trust Mark Yes
Automatically refresh trust marks in Entity Configuration Yes Yes

This work was started in and supported by the Geant Trust & Identity Incubator.

Documentation

Overview

Code generated by go generate; DO NOT EDIT.

Index

Constants

View Source
const (
	MatchModeSubstringCaseInsensitive matchMode = "substring-case-insensitive"
	MatchModeSubstringCaseSensitive   matchMode = "substring-case-sensitive"
	MatchModeExactCaseSensitive       matchMode = "exact-case-sensitive"
	MatchModeExactCaseInsensitive     matchMode = "exact-case-insensitive"
	MatchModeFuzzy                    matchMode = "fuzzy"
)
View Source
const (
	InvalidRequest         = "invalid_request"
	InvalidClient          = "invalid_client"
	InvalidIssuer          = "invalid_issuer"
	InvalidSubject         = "invalid_subject"
	InvalidTrustAnchor     = "invalid_trust_anchor"
	InvalidTrustChain      = "invalid_trust_chain"
	InvalidMetadata        = "invalid_metadata"
	NotFound               = "not_found"
	ServerError            = "server_error"
	TemporarilyUnavailable = "temporarily_unavailable"
	UnsupportedParameter   = "unsupported_parameter"
	EntityIDNotFound       = "entity_id_not_found"
)

Constants for some error

View Source
const (

	// SubMinPollInterval is the floor for poll intervals to avoid busy-looping
	// when an EC has a very short or already-passed expiration.
	SubMinPollInterval = 1 * time.Minute
)

Variables

OperatorOrder defines the order in which the PolicyOperator are applied. If custom PolicyOperator are implemented they must be added to this slice at the correct position

View Source
var ResolverCacheGracePeriod = time.Hour

ResolverCacheGracePeriod is a grace period for the resolver. If a cached statement is not yet expired but will expire within that period, the cached statement will be used but a fresh statement might be requested in the background ( see also ResolverCacheLifetimeElapsedGraceFactor).

View Source
var ResolverCacheLifetimeElapsedGraceFactor = 0.5

ResolverCacheLifetimeElapsedGraceFactor is a factor relevant for the grace period for the resolver. If a cached stmt will expire within the ResolverCacheGracePeriod it might be requested in the background before expiration. A fresh statement will only be requested if a certain time already has elapsed. This factor defines how much time (relative to the total lifetime of that statement) must have elapsed so that the statement is refreshed. E.g. a factor of 0. 75 means that a statement will only be refreshed if the statement expires within the ResolverCacheGracePeriod and 75% of the statement's lifetime already have elapsed. The purpose of this factor is to allow a bigger ResolverCacheGracePeriod and still deal with smaller statement lifetimes.

View Source
var TrustChainsFilterValidMetadata = NewTrustChainsFilterFromCheckerFnc(
	func(chain TrustChain) bool {
		_, err := chain.Metadata()
		return err == nil
	},
)

TrustChainsFilterValidMetadata returns a TrustChainsFilter that filters the TrustChains to the ones with valid Metadata

Functions

func AdjustRPMetadataToOP added in v0.8.0

func AdjustRPMetadataToOP(rp *OpenIDRelyingPartyMetadata, op *OpenIDProviderMetadata)

AdjustRPMetadataToOP adjusts the RP metadata so it complies with the OP capabilities.

  • For RP fields with multiple values, it filters them to those supported by the OP.
  • For RP single-value fields with an OP "..._supported" list, it ensures the RP value is supported; if not, it looks for an Extra entry on the RP with the same name as the OP claim to pick a mutually supported value.

func CmdHook added in v0.11.0

func CmdHook(cfg CmdHookConfig) kms.KeyRotationHook

CmdHook returns a kms.KeyRotationHook that spawns the configured command and writes the new JWKS JSON to its stdin. The hook always returns nil — command failures are logged but not propagated, so they never block or abort key rotation or other hooks.

func DecodedEntityID added in v0.11.0

func DecodedEntityID(encoded string) (string, error)

DecodedEntityID decodes a URL-safe base64 encoded entity ID

func DisableDebugLogging

func DisableDebugLogging()

DisableDebugLogging disables debug logging

func EnableDebugLogging

func EnableDebugLogging()

EnableDebugLogging enables debug logging

func ExtractKIDs added in v0.11.0

func ExtractKIDs(jwks jwx.JWKS) *strset.Set

ExtractKIDs extracts all non-empty KIDs from a JWKS into a strset.Set.

func HTTPHook added in v0.11.0

func HTTPHook(cfg HTTPHookConfig) (kms.KeyRotationHook, error)

HTTPHook returns a kms.KeyRotationHook that sends an HTTP request on key rotation. It validates the configuration at construction time and returns an error if required fields are missing or inconsistent.

func HasJWKSChanged added in v0.11.0

func HasJWKSChanged(oldKIDs, newKIDs *strset.Set) (bool, []string, []string)

HasJWKSChanged compares two KID sets and returns whether they differ. Returns: changed, addedKIDs, removedKIDs.

func JWKSUpdateHook added in v0.11.0

func JWKSUpdateHook(cfg JWKSUpdateHookConfig) (kms.KeyRotationHook, error)

JWKSUpdateHook returns a kms.KeyRotationHook that pushes a signed JWK Set to the target entity's federation_jwks_update_endpoint. It is a convenience wrapper around HTTPHook that reads the endpoint URL from the target's Entity Configuration, so the caller does not need to hardcode it.

func RegisterPolicyOperator

func RegisterPolicyOperator(operator PolicyOperator)

RegisterPolicyOperator registers a new PolicyOperator and therefore makes it available to be used

func RegisterPolicyVerifier

func RegisterPolicyVerifier(v PolicyVerifier)

RegisterPolicyVerifier registers a PolicyVerifier

func SetLogLevel added in v0.8.3

func SetLogLevel(level zerolog.Level)

SetLogLevel sets the log level for the library's logger independently from any application loggers.

func SetLogOutput added in v0.8.3

func SetLogOutput(w io.Writer)

SetLogOutput sets the output writer for the library's logger.

func TriggerUpdateHook added in v0.11.0

func TriggerUpdateHook(cfg TriggerUpdateHookConfig) (kms.KeyRotationHook, error)

TriggerUpdateHook returns a kms.KeyRotationHook that triggers a JWKS update on the target entity. It is a convenience wrapper around HTTPHook that reads the federation_jwks_update_trigger_endpoint, federation_jwks_update_trigger_endpoint_auth_methods and endpoint_auth_signing_alg_values_supported from the target's Entity Configuration, so the caller does not need to hardcode the endpoint URL, auth requirement, or algorithm list.

At each invocation the hook checks whether the target requires private_key_jwt authentication and dispatches to the corresponding pre-built HTTPHook variant (with or without ClientAuth). All EC reads are served from the GetEntityConfiguration cache.

func TrustChainScoringPathLen

func TrustChainScoringPathLen(c TrustChain) int

TrustChainScoringPathLen is a TrustChainScoringFnc that uses the chain's path len

func VerifyEntityHasValidTrustmarkByTrustAnchors added in v0.8.0

func VerifyEntityHasValidTrustmarkByTrustAnchors(entityID, trustMarkType string, trustAnchors TrustAnchors) (
	error, error,
)

VerifyEntityHasValidTrustmarkByTrustAnchors verifies that the entity has a valid trustmark of the given type. Verification is done by verifying the trustmark against a list of trust anchors.

func VerifyEntityHasValidTrustmarkByTrustMarkIssuerJWKS added in v0.8.0

func VerifyEntityHasValidTrustmarkByTrustMarkIssuerJWKS(
	entityID, trustMarkType string,
	trustMarkIssuerJWKS jwx.JWKS, trustMarkOwner TrustMarkOwnerSpec,
) (error, error)

VerifyEntityHasValidTrustmarkByTrustMarkIssuerJWKS verifies that the entity has a valid trustmark of the given type. Verification is done by verifying the trustmark against the trustmark issuer's jwks.

func VerifyEntityHasValidTrustmarks added in v0.8.0

func VerifyEntityHasValidTrustmarks(
	entityID string, trustMarkTypes []string,
	trustAnchors TrustAnchors,
) (bool, error)

VerifyEntityHasValidTrustmarks verifies that the entity has valid trustmarks for all the given types.

Types

type AllowedTrustMarkIssuers

type AllowedTrustMarkIssuers map[string][]string

AllowedTrustMarkIssuers is type for defining which TrustMark can be issued by which entities

type CmdHookConfig added in v0.11.0

type CmdHookConfig struct {
	// Path is the path to the executable to run.
	Path string
	// Args are the command-line arguments passed to the executable.
	Args []string
	// Env is appended to the current process environment for the command.
	Env []string
	// Timeout is the maximum duration the command may run. Default: 30s.
	Timeout time.Duration
}

CmdHookConfig configures a key rotation hook that spawns an external command and writes the new JWKS (as JSON) to the command's stdin. This allows external programs (e.g. reload scripts, HSM sync tools) to react to key rotations.

type CollectedEntity

type CollectedEntity struct {
	EntityID   string         `json:"entity_id"`
	TrustMarks TrustMarkInfos `json:"trust_marks,omitempty"`

	EntityTypes []string          `json:"entity_types,omitempty"`
	UIInfos     map[string]UIInfo `json:"ui_infos,omitempty"`
	Extra       map[string]any    `json:"-"`
	// contains filtered or unexported fields
}

CollectedEntity is a type describing a single collected entity

func FilterAndTrimEntities added in v0.8.0

func FilterAndTrimEntities(cached []*CollectedEntity, req apimodel.EntityCollectionRequest) []*CollectedEntity

FilterAndTrimEntities applies request filters to a list of collected entities and trims the result to the requested claims and languages.

func (CollectedEntity) MarshalJSON

func (e CollectedEntity) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface

func (*CollectedEntity) UnmarshalJSON

func (e *CollectedEntity) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface

type ConstraintSpecification

type ConstraintSpecification struct {
	MaxPathLength      *int               `json:"max_path_length,omitempty"`
	NamingConstraints  *NamingConstraints `json:"naming_constraints,omitempty"`
	AllowedEntityTypes []string           `json:"allowed_entity_types,omitempty"`
}

ConstraintSpecification is type for holding constraints according to the oidc fed spec

type DelegationJWT

type DelegationJWT struct {
	Issuer        string                 `json:"iss"`
	Subject       string                 `json:"sub"`
	TrustMarkType string                 `json:"trust_mark_type"`
	IssuedAt      unixtime.Unixtime      `json:"iat"`
	ExpiresAt     *unixtime.Unixtime     `json:"exp,omitempty"`
	Ref           string                 `json:"ref,omitempty"`
	Extra         map[string]interface{} `json:"-"`
	// contains filtered or unexported fields
}

DelegationJWT is a type for holding information about a delegation jwt

func (DelegationJWT) MarshalJSON

func (djwt DelegationJWT) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface. It also marshals extra fields.

func (*DelegationJWT) UnmarshalJSON

func (djwt *DelegationJWT) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface. It also unmarshalls additional fields into the Extra claim.

func (DelegationJWT) VerifyExternal

func (djwt DelegationJWT) VerifyExternal(jwks jwx.JWKS) error

VerifyExternal verifies the DelegationJWT by using the passed trust mark owner jwks

func (DelegationJWT) VerifyFederation

func (djwt DelegationJWT) VerifyFederation(ta *EntityStatementPayload) error

VerifyFederation verifies the DelegationJWT by using the passed trust anchor

type DynamicFederationEntity added in v0.10.0

type DynamicFederationEntity struct {
	ID                             string
	Metadata                       func() (*Metadata, error)
	AuthorityHints                 func() ([]string, error)
	TrustAnchorHints               func() ([]string, error)
	ConfigurationLifetime          func() (time.Duration, error)
	EntityStatementSigner          func() (*jwx.EntityStatementSigner, error)
	TrustMarks                     func() ([]*EntityConfigurationTrustMarkConfig, error)
	TrustMarkIssuers               func() (AllowedTrustMarkIssuers, error)
	TrustMarkOwners                func() (TrustMarkOwners, error)
	Extra                          func() (map[string]any, []string, error)
	ShouldApplyInformationalClaims func() (bool, error)
}

DynamicFederationEntity mirrors FederationEntity but exposes all properties (except EntityID) as functions of time, enabling time-dependent values.

func (DynamicFederationEntity) EntityConfigurationJWT added in v0.10.0

func (f DynamicFederationEntity) EntityConfigurationJWT() ([]byte, error)

EntityConfigurationJWT creates and returns the signed jwt for the dynamic entity configuration

func (DynamicFederationEntity) EntityConfigurationPayload added in v0.10.0

func (f DynamicFederationEntity) EntityConfigurationPayload() (*EntityStatementPayload, error)

EntityConfigurationPayload returns an EntityStatementPayload for this DynamicFederationEntity resolving all dynamic properties at time.Now().

func (DynamicFederationEntity) EntityID added in v0.10.0

func (f DynamicFederationEntity) EntityID() string

EntityID returns the entity ID of the DynamicFederationEntity

func (DynamicFederationEntity) SignEntityStatement added in v0.10.0

func (f DynamicFederationEntity) SignEntityStatement(payload EntityStatementPayload) ([]byte, error)

SignEntityStatement creates a signed JWT for the given EntityStatementPayload

func (DynamicFederationEntity) SignEntityStatementWithHeaders added in v0.10.0

func (f DynamicFederationEntity) SignEntityStatementWithHeaders(
	payload EntityStatementPayload, headers jws.Headers,
) ([]byte, error)

SignEntityStatementWithHeaders creates a signed JWT for the given EntityStatementPayload and jws.Headers

type ECFetcher added in v0.11.0

type ECFetcher func(entityID string) (*EntityStatement, error)

ECFetcher fetches and returns the parsed Entity Configuration for an entity. GetEntityConfiguration is the standard implementation.

type EntityCollectionFilter

type EntityCollectionFilter interface {
	Filter(*CollectedEntity) bool
}

EntityCollectionFilter is an interface to filter discovered entities

func EntityCollectionFilterOPSupportedGrantTypesIncludes

func EntityCollectionFilterOPSupportedGrantTypesIncludes(
	trustAnchorIDs []string, neededGrantTypes ...string,
) EntityCollectionFilter

EntityCollectionFilterOPSupportedGrantTypesIncludes returns an EntityCollectionFilter that filters to OPs that support the passed grant types

func EntityCollectionFilterOPSupportedScopesIncludes

func EntityCollectionFilterOPSupportedScopesIncludes(
	trustAnchorIDs []string,
	neededScopes ...string,
) EntityCollectionFilter

EntityCollectionFilterOPSupportedScopesIncludes returns an EntityCollectionFilter that filters to OPs that support the passed scopes

func EntityCollectionFilterOPSupportsAutomaticRegistration

func EntityCollectionFilterOPSupportsAutomaticRegistration(
	trustAnchorIDs []string,
) EntityCollectionFilter

EntityCollectionFilterOPSupportsAutomaticRegistration returns an EntityCollectionFilter that filters to OPs that support automatic registration

func EntityCollectionFilterOPSupportsExplicitRegistration

func EntityCollectionFilterOPSupportsExplicitRegistration(
	trustAnchorIDs []string,
) EntityCollectionFilter

EntityCollectionFilterOPSupportsExplicitRegistration returns an EntityCollectionFilter that filters to OPs that support explicit registration

func EntityCollectionFilterOPs

func EntityCollectionFilterOPs() EntityCollectionFilter

EntityCollectionFilterOPs returns an EntityCollectionFilter that filters to OPs

func NewEntityCollectionFilter

func NewEntityCollectionFilter(filter func(entity *CollectedEntity) bool) EntityCollectionFilter

NewEntityCollectionFilter returns an EntityCollectionFilter for a filter func

type EntityCollectionFilterVerifiedChains

type EntityCollectionFilterVerifiedChains struct {
	TrustAnchors TrustAnchors
}

EntityCollectionFilterVerifiedChains is an EntityCollectionFilter that filters the discovered OPs to the one that have a valid TrustChain to one of the specified TrustAnchors

func (EntityCollectionFilterVerifiedChains) Filter

Filter implements the EntityCollectionFilter interface

type EntityCollectionResponse

type EntityCollectionResponse struct {
	Entities    []*CollectedEntity `json:"entities"`
	Next        string             `json:"next,omitempty"`
	LastUpdated *unixtime.Unixtime `json:"last_updated,omitempty"`
	Extra       map[string]any     `json:"-"`
}

EntityCollectionResponse is a type describing the response of an entity collection request

type EntityCollector

type EntityCollector interface {
	CollectEntities(req apimodel.EntityCollectionRequest) (*EntityCollectionResponse, *ErrorResponse)
}

EntityCollector is an interface that discovers / collects Entities in a federation

type EntityConfigurationTrustMarkConfig

type EntityConfigurationTrustMarkConfig struct {
	TrustMarkType      string                   `yaml:"trust_mark_type"`
	TrustMarkIssuer    string                   `yaml:"trust_mark_issuer"`
	SelfIssuanceSpec   *SelfIssuedTrustMarkSpec `yaml:"self_issuance_spec"`
	JWT                string                   `yaml:"trust_mark_jwt"`
	Refresh            bool                     `yaml:"refresh"`
	MinLifetime        duration.DurationOption  `yaml:"min_lifetime"`
	RefreshGracePeriod duration.DurationOption  `yaml:"refresh_grace_period"`
	RefreshRateLimit   duration.DurationOption  `yaml:"refresh_rate_limit"`
	// contains filtered or unexported fields
}

EntityConfigurationTrustMarkConfig is a type for specifying the configuration of a TrustMark that should be included in an EntityConfiguration

func (*EntityConfigurationTrustMarkConfig) Expiration added in v0.10.0

Expiration returns the expiration time of the current trust mark JWT. This is used to potentially shorten the entity configuration lifetime. This method is safe for concurrent use.

func (*EntityConfigurationTrustMarkConfig) TrustMarkInfo added in v0.10.0

TrustMarkInfo returns a TrustMarkInfo for inclusion in the entity configuration. If this is a self-issued trust mark with IncludeExtraClaimsInInfo set, the Extra field will contain the additional claims from the SelfIssuanceSpec. This method is safe for concurrent use.

func (*EntityConfigurationTrustMarkConfig) TrustMarkJWT

func (c *EntityConfigurationTrustMarkConfig) TrustMarkJWT() (string, error)

TrustMarkJWT returns a trust mark jwt for the linked trust mark, if needed the trust mark is refreshed using the trust mark issuer's trust mark endpoint. This method is safe for concurrent use.

func (*EntityConfigurationTrustMarkConfig) Verify

func (c *EntityConfigurationTrustMarkConfig) Verify(
	sub, ownTrustMarkEndpoint string, ownTrustMarkSigner *jwx.TrustMarkSigner,
) error

Verify verifies that the EntityConfigurationTrustMarkConfig is correct and also extracts trust mark id and issuer if a trust mark jwt is given as well as sets default values

type EntityObserver added in v0.8.0

type EntityObserver interface {
	// OnDiscoveredEntities is called with the trust anchor and the full set of
	// entities discovered for it.
	OnDiscoveredEntities(trustAnchor string, entities []*CollectedEntity)
}

EntityObserver is a callback interface that PeriodicEntityCollector can call for each discovered entity, e.g. to trigger proactive resolve generation.

type EntityStatement

type EntityStatement struct {
	EntityStatementPayload
	// contains filtered or unexported fields
}

EntityStatement is a type for holding an entity statement, more precisely an entity statement that was obtained as a jwt and created by us

func FetchEntityStatement

func FetchEntityStatement(fetchEndpoint, subID, issID string) (*EntityStatement, error)

FetchEntityStatement fetches an EntityStatement from a fetch endpoint

func GetEntityConfiguration

func GetEntityConfiguration(entityID string) (*EntityStatement, error)

GetEntityConfiguration obtains the entity configuration for the passed entity id and returns it as an EntityStatement

func ParseEntityStatement

func ParseEntityStatement(statementJWT []byte) (*EntityStatement, error)

ParseEntityStatement parses a jwt into an EntityStatement

func (EntityStatement) MarshalMsgpack

func (e EntityStatement) MarshalMsgpack() ([]byte, error)

MarshalMsgpack implements the msgpack.Marshaler interface for usage with caching

func (*EntityStatement) UnmarshalMsgpack

func (e *EntityStatement) UnmarshalMsgpack(data []byte) error

UnmarshalMsgpack implements the msgpack.Unmarshaler interface for usage with caching

func (EntityStatement) Verify

func (e EntityStatement) Verify(keys jwx.JWKS) bool

Verify verifies that the EntityStatement jwt is valid

type EntityStatementPayload

type EntityStatementPayload struct {
	Issuer             string                   `json:"iss"`
	Subject            string                   `json:"sub"`
	IssuedAt           unixtime.Unixtime        `json:"iat"`
	ExpiresAt          unixtime.Unixtime        `json:"exp"`
	JWKS               jwx.JWKS                 `json:"jwks"`
	Audience           string                   `json:"aud,omitempty"`
	AuthorityHints     []string                 `json:"authority_hints,omitempty"`
	TrustAnchorHints   []string                 `json:"trust_anchor_hints,omitempty"`
	Metadata           *Metadata                `json:"metadata,omitempty"`
	MetadataPolicy     *MetadataPolicies        `json:"metadata_policy,omitempty"`
	Constraints        *ConstraintSpecification `json:"constraints,omitempty"`
	CriticalExtensions []string                 `json:"crit,omitempty"`
	MetadataPolicyCrit []PolicyOperatorName     `json:"metadata_policy_crit,omitempty"`
	TrustMarks         TrustMarkInfos           `json:"trust_marks,omitempty"`
	TrustMarkIssuers   AllowedTrustMarkIssuers  `json:"trust_mark_issuers,omitempty"`
	TrustMarkOwners    TrustMarkOwners          `json:"trust_mark_owners,omitempty"`
	SourceEndpoint     string                   `json:"source_endpoint,omitempty"`
	TrustAnchor        string                   `json:"trust_anchor,omitempty"`
	Extra              map[string]interface{}   `json:"-"`
}

EntityStatementPayload is a type for holding the actual payload of an EntityStatement or EntityConfiguration; additional fields can be set in the Extra claim

func (EntityStatementPayload) MarshalJSON

func (e EntityStatementPayload) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface. It also marshals extra fields.

func (EntityStatementPayload) TimeValid

func (e EntityStatementPayload) TimeValid() bool

TimeValid checks if the EntityStatementPayload is already valid and not yet expired.

func (*EntityStatementPayload) UnmarshalJSON

func (e *EntityStatementPayload) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface. It also unmarshalls additional fields into the Extra claim.

func (*EntityStatementPayload) UnmarshalMsgpack

func (e *EntityStatementPayload) UnmarshalMsgpack(data []byte) error

UnmarshalMsgpack implements the msgpack.Unmarshaler interface.

type Error

type Error struct {
	Error            string `json:"error"`
	ErrorDescription string `json:"error_description"`
}

Error is type for holding an error

func ErrorInvalidClient

func ErrorInvalidClient(description string) *Error

ErrorInvalidClient returns an Error for using InvalidClient

func ErrorInvalidIssuer

func ErrorInvalidIssuer(description string) *Error

ErrorInvalidIssuer returns an Error for using InvalidIssuer

func ErrorInvalidMetadata

func ErrorInvalidMetadata(description string) *Error

ErrorInvalidMetadata returns an Error for using InvalidMetadata

func ErrorInvalidRequest

func ErrorInvalidRequest(description string) *Error

ErrorInvalidRequest returns an Error for using InvalidRequest

func ErrorInvalidSubject

func ErrorInvalidSubject(description string) *Error

ErrorInvalidSubject returns an Error for using InvalidSubject

func ErrorInvalidTrustAnchor

func ErrorInvalidTrustAnchor(description string) *Error

ErrorInvalidTrustAnchor returns an Error for using InvalidTrustAnchor

func ErrorInvalidTrustChain

func ErrorInvalidTrustChain(description string) *Error

ErrorInvalidTrustChain returns an Error for using InvalidTrustChain

func ErrorNotFound

func ErrorNotFound(description string) *Error

ErrorNotFound returns an Error for using NotFound

func ErrorServerError

func ErrorServerError(description string) *Error

ErrorServerError returns an Error for using ServerError

func ErrorTemporarilyUnavailable

func ErrorTemporarilyUnavailable(description string) *Error

ErrorTemporarilyUnavailable returns an Error for using TemporarilyUnavailable

func ErrorUnsupportedParameter

func ErrorUnsupportedParameter(description string) *Error

ErrorUnsupportedParameter returns an Error for using UnsupportedParameter

type ErrorResponse added in v0.8.0

type ErrorResponse struct {
	*Error
	Status int `json:"-"`
}

ErrorResponse is type for holding an Error including the status code

type FederationEntity

type FederationEntity interface {
	EntityID() string
	// EntityConfigurationPayload returns the payload for the entity configuration
	EntityConfigurationPayload() (*EntityStatementPayload, error)
	// EntityConfigurationJWT returns the signed entity configuration as a JWT
	EntityConfigurationJWT() ([]byte, error)
	// SignEntityStatement signs the provided entity configuration payload
	SignEntityStatement(payload EntityStatementPayload) ([]byte, error)
	// SignEntityStatementWithHeaders signs the provided entity configuration payload and adds the passed jws.Headers
	SignEntityStatementWithHeaders(payload EntityStatementPayload, headers jws.Headers) ([]byte, error)
}

FederationEntity defines the common behavior for federation entities, implemented by both StaticFederationEntity and DynamicFederationEntity.

type FederationEntityMetadata

type FederationEntityMetadata struct {
	FederationFetchEndpoint                      string         `json:"federation_fetch_endpoint,omitempty"`
	FederationListEndpoint                       string         `json:"federation_list_endpoint,omitempty"`
	FederationResolveEndpoint                    string         `json:"federation_resolve_endpoint,omitempty"`
	FederationTrustMarkStatusEndpoint            string         `json:"federation_trust_mark_status_endpoint,omitempty"`
	FederationTrustMarkListEndpoint              string         `json:"federation_trust_mark_list_endpoint,omitempty"`
	FederationTrustMarkEndpoint                  string         `json:"federation_trust_mark_endpoint,omitempty"`
	FederationHistoricalLKeysEndpoint            string         `json:"federation_historical_keys_endpoint,omitempty"`
	FederationFetchEndpointAuthMethods           []string       `json:"federation_fetch_endpoint_auth_methods,omitempty"`
	FederationListEndpointAuthMethods            []string       `json:"federation_list_endpoint_auth_methods,omitempty"`
	FederationResolveEndpointAuthMethods         []string       `json:"federation_resolve_endpoint_auth_methods,omitempty"`
	FederationTrustMarkStatusEndpointAuthMethods []string       `json:"federation_trust_mark_status_endpoint_auth_methods,omitempty"`
	FederationTrustMarkListEndpointAuthMethods   []string       `json:"federation_trust_mark_list_endpoint_auth_methods,omitempty"`
	FederationTrustMarkEndpointAuthMethods       []string       `json:"federation_trust_mark_endpoint_auth_methods,omitempty"`
	FederationHistoricalLKeysEndpointAuthMethods []string       `json:"federation_historical_keys_endpoint_auth_methods,omitempty"`
	EndpointAuthSigningAlgValuesSupported        []string       `json:"endpoint_auth_signing_alg_values_supported,omitempty"`
	Extra                                        map[string]any `json:"-"`
	DisplayName                                  string         `json:"display_name,omitempty"`
	Description                                  string         `json:"description,omitempty"`
	Keywords                                     []string       `json:"keywords,omitempty"`
	Contacts                                     []string       `json:"contacts,omitempty"`
	LogoURI                                      string         `json:"logo_uri,omitempty"`
	PolicyURI                                    string         `json:"policy_uri,omitempty"`
	InformationURI                               string         `json:"information_uri,omitempty"`
	OrganizationName                             string         `json:"organization_name,omitempty"`
	OrganizationURI                              string         `json:"organization_uri,omitempty"`
	// contains filtered or unexported fields
}

func (FederationEntityMetadata) ApplyPolicy

func (m FederationEntityMetadata) ApplyPolicy(policy MetadataPolicy) (any, error)

ApplyPolicy applies a MetadataPolicy to the FederationEntityMetadata

func (FederationEntityMetadata) MarshalJSON

func (m FederationEntityMetadata) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface

func (*FederationEntityMetadata) UnmarshalJSON

func (m *FederationEntityMetadata) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface

func (*FederationEntityMetadata) UnmarshalMsgpack

func (m *FederationEntityMetadata) UnmarshalMsgpack(data []byte) error

UnmarshalMsgpack implements the msgpack.Unmarshaler interface

type FederationLeaf

type FederationLeaf struct {
	FederationEntity
	TrustAnchors TrustAnchors

	RequestURIGenerator RequestURIGenerator
	// contains filtered or unexported fields
}

FederationLeaf is a type for a leaf entity and holds all relevant information about it; it can also be used to create an EntityConfiguration about it or to start OIDC flows

func NewFederationLeaf

func NewFederationLeaf(
	entityID string, authorityHints []string, trustAnchors TrustAnchors, metadata *Metadata,
	signer *jwx.EntityStatementSigner, configurationLifetime time.Duration,
	oidcSigner jwx.VersatileSigner, extra map[string]any,
) (*FederationLeaf, error)

NewFederationLeaf creates a new FederationLeaf with the passed properties

func (FederationLeaf) CodeExchange

func (f FederationLeaf) CodeExchange(
	issuer, code, redirectURI string,
	additionalParameter url.Values,
) (*OIDCTokenResponse, *OIDCErrorResponse, error)

CodeExchange performs an oidc code exchange it creates the mytoken and stores it in the database

func (FederationLeaf) DoExplicitClientRegistration added in v0.8.0

func (f FederationLeaf) DoExplicitClientRegistration(op string) (
	*EntityStatementPayload, *http.HttpError, error,
)

DoExplicitClientRegistration performs an explicit client registration with an OP and returns the response as an EntityStatementPayload.

func (FederationLeaf) GetAuthorizationURL

func (f FederationLeaf) GetAuthorizationURL(
	issuer, redirectURI, state, scope string, additionalParams url.Values,
) (string, error)

GetAuthorizationURL creates an authorization url

func (FederationLeaf) GetExplicitRegistration added in v0.8.0

func (f FederationLeaf) GetExplicitRegistration(op string) (
	*OpenIDRelyingPartyMetadata, *http.HttpError, error,
)

GetExplicitRegistration returns an explicit client registration as OpenIDRelyingPartMetadata. It re-uses an explicit client registration from cache or registers a new one.

func (FederationLeaf) GetExplicitRegistrationOIDCRP added in v0.8.0

func (f FederationLeaf) GetExplicitRegistrationOIDCRP(
	ctx context.Context, op string,
) (*OIDCRP, error)

GetExplicitRegistrationOIDCRP returns an OIDCRP by re-using an explicit client registration from cache or registering a new one.

func (FederationLeaf) RequestObjectProducer

func (f FederationLeaf) RequestObjectProducer() *RequestObjectProducer

RequestObjectProducer returns the entity's RequestObjectProducer

func (FederationLeaf) ResolveOPMetadata

func (f FederationLeaf) ResolveOPMetadata(issuer string) (*OpenIDProviderMetadata, error)

ResolveOPMetadata resolves and returns OpenIDProviderMetadata for the passed issuer url

type FileJWKStorage added in v0.11.0

type FileJWKStorage struct {
	Dir string
	// contains filtered or unexported fields
}

FileJWKStorage implements JWKStorage using the filesystem

func NewFileJWKStorage added in v0.11.0

func NewFileJWKStorage(dir string) (*FileJWKStorage, error)

NewFileJWKStorage creates a new FileJWKStorage Creates the directory if it doesn't exist

func (*FileJWKStorage) GetJWKS added in v0.11.0

func (f *FileJWKStorage) GetJWKS(entityID string) (*jwx.JWKS, error)

GetJWKS implements JWKStorage.GetJWKS

func (*FileJWKStorage) RegisterEntityJWKSFile added in v0.11.0

func (f *FileJWKStorage) RegisterEntityJWKSFile(entityID, jwksFile string) error

RegisterEntityJWKSFile registers an explicit JWKS file path for an entity Creates a symlink from the default location to the specified file Validates that jwksFile is an absolute path

func (*FileJWKStorage) UpdateJWKS added in v0.11.0

func (f *FileJWKStorage) UpdateJWKS(entityID string, jwks jwx.JWKS) error

UpdateJWKS implements JWKStorage.UpdateJWKS Stores JWKS as JSON file at the registered jwks_file path if set, otherwise at <Dir>/<base64url(entityID)>.json

type FilterableVerifiedChainsEntityCollector

type FilterableVerifiedChainsEntityCollector struct {
	Collector EntityCollector
	Filters   []EntityCollectionFilter
}

FilterableVerifiedChainsEntityCollector is a type implementing EntityCollector that is able to filter the discovered OPs through a number of EntityCollectionFilter

func (FilterableVerifiedChainsEntityCollector) CollectEntities

CollectEntities implements the EntityCollector interface

type HTTPHookBodyMode added in v0.11.0

type HTTPHookBodyMode string

HTTPHookBodyMode selects what is sent in the body of the HTTP request triggered by an HTTPHook.

const (
	// HTTPBodyNone sends no body.
	HTTPBodyNone HTTPHookBodyMode = "none"
	// HTTPBodyEntityID sends the entity's entity_id as the "sub" form field
	// (content-type application/x-www-form-urlencoded).
	HTTPBodyEntityID HTTPHookBodyMode = "entity_id"
	// HTTPBodyJWKS sends the new JWKS as JSON (content-type
	// application/jwk-set+json).
	HTTPBodyJWKS HTTPHookBodyMode = "jwks"
	// HTTPBodySignedJWKS sends a signed JWK Set JWT (jwk-set+jwt) containing
	// the new JWKS in the "keys" claim. Requires Signer to be configured.
	HTTPBodySignedJWKS HTTPHookBodyMode = "signed_jwks"
)

type HTTPHookClientAuth added in v0.11.0

type HTTPHookClientAuth struct {
	// ROProducer produces the client assertion JWT (private_key_jwt).
	ROProducer *RequestObjectProducer
	// Algs, if non-nil, returns the signature algorithms acceptable to the
	// target endpoint (e.g. read from the target's Entity Configuration
	// endpoint_auth_signing_alg_values_supported). The producer's signer
	// selects the first compatible algorithm from this list; if none match the
	// available signing keys the request is skipped with a logged error. If
	// nil, the producer's DefaultSigner is used.
	Algs func() []string
}

HTTPHookClientAuth configures private_key_jwt client authentication for the HTTP hook. The client assertion JWT is produced by the configured RequestObjectProducer (via ClientAssertion) and sent as the "client_assertion" and "client_assertion_type" form parameters in the request body — no token endpoint exchange is involved. The audience (aud claim) of the assertion is the hook URL.

ClientAuth is incompatible with HTTPBodyJWKS and HTTPBodySignedJWKS (both use a non-form body); HTTPHook returns a construction error if they are combined.

type HTTPHookConfig added in v0.11.0

type HTTPHookConfig struct {
	// URL is the URL to send the request to. Either URL or URLFunc must be
	// set; URLFunc takes precedence when both are provided.
	URL string
	// URLFunc, if non-nil, resolves the request URL dynamically per
	// invocation (e.g. by reading the target's Entity Configuration). It takes
	// precedence over URL. The resolved URL is also used as the audience
	// (aud claim) of any client assertion produced via ClientAuth.
	URLFunc func(ctx context.Context, event kms.KeyRotationEvent) (string, error)
	// Method is the HTTP method. Default: POST.
	Method string
	// BodyMode selects what is sent in the request body. Default: none.
	BodyMode HTTPHookBodyMode
	// Headers are additional headers set on the request.
	Headers map[string]string
	// Timeout is the HTTP client timeout. Default: 20s.
	Timeout time.Duration

	// ClientAuth enables private_key_jwt client authentication. When set, a
	// client assertion JWT is minted on each request and sent as the
	// "client_assertion" and "client_assertion_type" form parameters in the
	// request body. The assertion's audience is the hook URL. Incompatible
	// with HTTPBodyJWKS and HTTPBodySignedJWKS.
	ClientAuth *HTTPHookClientAuth

	// Signer is required when BodyMode is signed_jwks. It is used to mint the
	// jwk-set+jwt.
	Signer jwx.VersatileSigner
	// JWTLifetime is the lifetime (exp - iat) of the signed JWKS JWT.
	// Default: 10 minutes.
	JWTLifetime time.Duration
}

HTTPHookConfig configures an HTTP key rotation hook.

type IssueTrustMarkOptions added in v0.10.0

type IssueTrustMarkOptions struct {
	// Lifetime overrides the spec's lifetime if set (> 0).
	Lifetime time.Duration
	// SubjectClaims are additional claims specific to this subject.
	// These are merged with (and override) the spec's Extra claims.
	SubjectClaims map[string]any
}

IssueTrustMarkOptions contains options for issuing a trust mark.

type JWKSUpdateHookConfig added in v0.11.0

type JWKSUpdateHookConfig struct {
	// TargetEntityID is the entity identifier of the federating entity (e.g.
	// a lighthouse) that exposes the jwks update endpoint.
	TargetEntityID string
	// Signer is the entity's federation signer used to mint the signed JWK Set
	// JWT. Required.
	Signer jwx.VersatileSigner
	// JWTLifetime is the lifetime (exp - iat) of the signed JWKS JWT.
	// Default: 10 minutes.
	JWTLifetime time.Duration
	// Headers are additional headers set on the request.
	Headers map[string]string
	// Timeout is the HTTP client timeout. Default: 20s.
	Timeout time.Duration
}

JWKSUpdateHookConfig configures a key rotation hook that POSTs a signed JWK Set (application/jwk-set+jwt) to the target entity's federation_jwks_update_endpoint, pushing the new federation keys. The endpoint URL is read dynamically from the target's Entity Configuration on each rotation (served from the EC cache). No client auth is used; the authenticity of the update is established by the signed JWK Set signature, which must verify against the entity's currently known federation keys.

type JWKStorage added in v0.11.0

type JWKStorage interface {
	// UpdateJWKS stores the complete JWKS for an entity
	// Replaces any existing JWKS for this entityID
	UpdateJWKS(entityID string, jwks jwx.JWKS) error
	// GetJWKS retrieves stored JWKS
	// Returns nil, nil if no JWKS is stored for the entityID
	GetJWKS(entityID string) (*jwx.JWKS, error)
	// RegisterEntityJWKSFile registers an explicit JWKS file path for an entity
	// The storage may use this path for read/write operations instead of the default location
	RegisterEntityJWKSFile(entityID, jwksFile string) error
}

JWKStorage is an interface for persisting JWKS updates

type JWSMessages

type JWSMessages []*jwx.ParsedJWT

JWSMessages is a slices of jwx.ParseJWT

func (JWSMessages) MarshalJSON

func (m JWSMessages) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface.

func (*JWSMessages) UnmarshalJSON

func (m *JWSMessages) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Marshaler interface.

type LocalMetadataResolver

type LocalMetadataResolver struct{}

LocalMetadataResolver is a MetadataResolver that resolves trust chains and evaluates metadata policies to obtain the final Metadata; it does not use a resolve endpoint

func (LocalMetadataResolver) Resolve

Resolve implements the MetadataResolver interface

func (LocalMetadataResolver) ResolvePossible

func (LocalMetadataResolver) ResolvePossible(req apimodel.ResolveRequest) (bool, bool)

ResolvePossible implements the MetadataResolver interface

func (LocalMetadataResolver) ResolveResponsePayload

func (r LocalMetadataResolver) ResolveResponsePayload(req apimodel.ResolveRequest) (
	res ResolveResponsePayload, err error,
)

ResolveResponsePayload implements the MetadataResolver interface

type MapTrustMarkSpecProvider added in v0.10.0

type MapTrustMarkSpecProvider struct {
	// contains filtered or unexported fields
}

MapTrustMarkSpecProvider is a TrustMarkSpecProvider backed by an in-memory map. It is safe for concurrent use.

func NewMapTrustMarkSpecProvider added in v0.10.0

func NewMapTrustMarkSpecProvider(specs []TrustMarkSpec) *MapTrustMarkSpecProvider

NewMapTrustMarkSpecProvider creates a new MapTrustMarkSpecProvider.

func (*MapTrustMarkSpecProvider) AddTrustMark added in v0.10.0

func (p *MapTrustMarkSpecProvider) AddTrustMark(spec TrustMarkSpec)

AddTrustMark adds or updates a TrustMarkSpec.

func (*MapTrustMarkSpecProvider) GetTrustMarkSpec added in v0.10.0

func (p *MapTrustMarkSpecProvider) GetTrustMarkSpec(trustMarkType string) *TrustMarkSpec

GetTrustMarkSpec returns the TrustMarkSpec for the given trust mark type.

func (*MapTrustMarkSpecProvider) RemoveTrustMark added in v0.10.0

func (p *MapTrustMarkSpecProvider) RemoveTrustMark(trustMarkType string)

RemoveTrustMark removes a TrustMarkSpec by type.

func (*MapTrustMarkSpecProvider) TrustMarkTypes added in v0.10.0

func (p *MapTrustMarkSpecProvider) TrustMarkTypes() []string

TrustMarkTypes returns all available trust mark types.

type Metadata

type Metadata struct {
	OpenIDProvider           *OpenIDProviderMetadata           `json:"openid_provider,omitempty"`
	RelyingParty             *OpenIDRelyingPartyMetadata       `json:"openid_relying_party,omitempty"`
	OAuthAuthorizationServer *OAuthAuthorizationServerMetadata `json:"oauth_authorization_server,omitempty"`
	OAuthClient              *OAuthClientMetadata              `json:"oauth_client,omitempty"`
	OAuthProtectedResource   *OAuthProtectedResourceMetadata   `json:"oauth_resource,omitempty"`
	FederationEntity         *FederationEntityMetadata         `json:"federation_entity,omitempty"`
	// Extra contains additional metadata this entity should advertise.
	Extra map[string]any `json:"-"`
}

Metadata is a type for holding the different metadata types

func (*Metadata) ApplyInformationalClaimsToFederationEntity added in v0.7.0

func (m *Metadata) ApplyInformationalClaimsToFederationEntity()

ApplyInformationalClaimsToFederationEntity copies common informational claims from other entity types to the federation entity metadata if they have consistent values and are not already set on the federation entity metadata. It processes both string claims (like organization_name, policy_uri etc.) and string slice claims (like contacts). The method only copies a claim if: - The value is consistent across all entity types that have it set - The federation entity doesn't already have a value for that claim If the federation entity metadata doesn't exist, it will be created when needed.

func (Metadata) ApplyPolicy

func (m Metadata) ApplyPolicy(p *MetadataPolicies) (*Metadata, error)

ApplyPolicy applies MetadataPolicies to Metadata and returns the final Metadata

func (*Metadata) FindEntityMetadata

func (m *Metadata) FindEntityMetadata(entityType string, metadata any) error

FindEntityMetadata finds metadata for the specified entity type in the metadata and decodes it into the provided metadata object.

func (Metadata) GuessEntityTypes

func (m Metadata) GuessEntityTypes() (entityTypes []string)

GuessEntityTypes returns a slice of entity types for which metadata is set

func (Metadata) GuessMultilingualDisplayNames added in v0.7.0

func (m Metadata) GuessMultilingualDisplayNames() map[string]map[string]string

GuessMultilingualDisplayNames collects display names for all present metadata types with support for multiple languages according to BCP47 (RFC5646). The returned map has entity types as keys and maps of language tags to display names as values. An empty string language tag represents the default/untagged value.

func (Metadata) IterateMultilingualStringClaim added in v0.7.0

func (m Metadata) IterateMultilingualStringClaim(tag string, iterator func(entityType, langTag, value string))

IterateMultilingualStringClaim collects a claim that has a string value for all metadata types and calls the iterator on it with language tag information. This is used for human-readable claims that can be represented in multiple languages according to BCP47 (RFC5646).

The function first processes the default/untagged values using IterateStringClaim, then looks for language-tagged values in the Extra field of each metadata type. Language-tagged values are expected to be stored in a map under a key with the format "<claim>_lang" (e.g., "description_lang").

The iterator function is called with three parameters: - entityType: The type of entity (e.g., "openid_provider") - langTag: The language tag (empty string for default/untagged values) - value: The string value in the specified language

Example language tags: - "" (empty string): Default/untagged value - "en": English - "fr": French - "en-US": American English - "zh-Hans": Simplified Chinese

func (Metadata) IterateStringClaim

func (m Metadata) IterateStringClaim(tag string, iterator func(entityType, value string))

IterateStringClaim collects a claim that has a string value for all metadata types and calls the iterator on it.

func (Metadata) IterateStringSliceClaim

func (m Metadata) IterateStringSliceClaim(tag string, iterator func(entityType string, value []string))

IterateStringSliceClaim collects a claim that has a []string value for all metadata types and calls the iterator on it.

func (Metadata) MarshalJSON

func (m Metadata) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface. It also marshals extra fields.

func (*Metadata) UnmarshalJSON

func (m *Metadata) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface. It also unmarshalls additional fields into the Extra claim.

type MetadataPolicies

type MetadataPolicies struct {
	OpenIDProvider           MetadataPolicy `json:"openid_provider,omitempty"`
	RelyingParty             MetadataPolicy `json:"openid_relying_party,omitempty"`
	OAuthAuthorizationServer MetadataPolicy `json:"oauth_authorization_server,omitempty"`
	OAuthClient              MetadataPolicy `json:"oauth_client,omitempty"`
	OAuthProtectedResource   MetadataPolicy `json:"oauth_resource,omitempty"`
	FederationEntity         MetadataPolicy `json:"federation_entity,omitempty"`
	// Extra contains metadata policies for entity types unknown to this module.
	Extra map[string]MetadataPolicy `json:"-"`
}

MetadataPolicies is a type for holding the different MetadataPolicy

func MergeMetadataPolicies

func MergeMetadataPolicies(policies ...*MetadataPolicies) (*MetadataPolicies, error)

MergeMetadataPolicies combines multiples MetadataPolicies from a chain into a single one

func (MetadataPolicies) MarshalJSON

func (m MetadataPolicies) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface

func (*MetadataPolicies) UnmarshalJSON

func (m *MetadataPolicies) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface. It also unmarshalls additional fields into the Extra claim.

type MetadataPolicy

type MetadataPolicy map[string]MetadataPolicyEntry

MetadataPolicy is a type for holding MetadataPolicyEntry for each relevant attribute

func CombineMetadataPolicy

func CombineMetadataPolicy(pathInfo string, policies ...MetadataPolicy) (MetadataPolicy, error)

CombineMetadataPolicy combines multiples MetadataPolicy into a single MetadataPolicy, at each step verifying that the result is valid

func (MetadataPolicy) Verify

func (p MetadataPolicy) Verify(pathInfo string) error

Verify verifies that the MetadataPolicy is valid

type MetadataPolicyEntry

type MetadataPolicyEntry map[PolicyOperatorName]any

MetadataPolicyEntry is a type for holding the operator value for each operator

func (MetadataPolicyEntry) ApplyTo

func (p MetadataPolicyEntry) ApplyTo(value any, valueSet bool, pathInfo string) (any, error)

ApplyTo applies this MetadataPolicyEntry to the passed value and returns the resulting value

func (MetadataPolicyEntry) Verify

func (p MetadataPolicyEntry) Verify(pathInfo string) error

Verify verifies that the MetadataPolicyEntry is valid

type MetadataResolver

type MetadataResolver interface {
	Resolve(request apimodel.ResolveRequest) (*Metadata, error)
	ResolveResponsePayload(request apimodel.ResolveRequest) (ResolveResponsePayload, error)
	ResolvePossible(request apimodel.ResolveRequest) (validConfirmed, invalidConfirmed bool)
}

MetadataResolver is type for resolving the metadata from a StartingEntity to one or multiple TrustAnchors

var DefaultMetadataResolver MetadataResolver = LocalMetadataResolver{}

DefaultMetadataResolver is the default MetadataResolver used within the library to resolve Metadata

type MultilingualString added in v0.7.0

type MultilingualString map[string]string

MultilingualString represents a string that can be represented in multiple languages.

The map keys are language tags: - Empty string ("") represents the default/untagged value - Other keys are BCP47 language tags (e.g., "en", "fr", "en-US")

The map values are the string representations in each language. This type is used to store human-readable UI claims in multiple languages.

func (MultilingualString) String added in v0.7.0

func (m MultilingualString) String() string

String returns a single string representation of the multilingual string.

The method follows these rules for selecting which value to return: 1. If a default/untagged value (empty string key) exists and is non-empty, return it 2. Otherwise, return the first (random order) non-empty value found 3. If no values exist or all are empty, return an empty string

This ensures that existing code continues to work with the default language value while still supporting multilingual capabilities.

type MultilingualUIInfo added in v0.7.0

type MultilingualUIInfo struct {
	DisplayName    MultilingualString `json:"display_name,omitempty"`
	Description    MultilingualString `json:"description,omitempty"`
	Keywords       []string           `json:"keywords,omitempty"`
	LogoURI        MultilingualString `json:"logo_uri,omitempty"`
	PolicyURI      MultilingualString `json:"policy_uri,omitempty"`
	InformationURI MultilingualString `json:"information_uri,omitempty"`
	Extra          map[string]any     `json:"-"`
}

MultilingualUIInfo is a version of UIInfo that supports multilingual values. This type is used internally for processing UI claims in multiple languages.

It replaces the string fields in UIInfo with MultilingualString fields to support multiple language representations of the same information. The Keywords field remains as a string slice since it's not typically language-specific.

This type is not exposed directly in the API but is used internally to convert between the standard UIInfo type and multilingual representations. It may be used by third-party applications.

type NamingConstraints

type NamingConstraints struct {
	Permitted []string `json:"permitted,omitempty"`
	Excluded  []string `json:"excluded,omitempty"`
}

NamingConstraints is a type for holding constraints about naming

type OAuthAuthorizationServerMetadata

type OAuthAuthorizationServerMetadata OpenIDProviderMetadata

OAuthAuthorizationServerMetadata is a type for holding the metadata about an oauth authorization server

func (OAuthAuthorizationServerMetadata) ApplyPolicy

func (m OAuthAuthorizationServerMetadata) ApplyPolicy(policy MetadataPolicy) (any, error)

ApplyPolicy applies a MetadataPolicy to the OAuthAuthorizationServerMetadata

func (OAuthAuthorizationServerMetadata) MarshalJSON

func (m OAuthAuthorizationServerMetadata) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface

func (*OAuthAuthorizationServerMetadata) UnmarshalJSON

func (m *OAuthAuthorizationServerMetadata) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface

type OAuthClientMetadata

type OAuthClientMetadata OpenIDRelyingPartyMetadata

OAuthClientMetadata is a type for holding the metadata about an oauth client

func (OAuthClientMetadata) ApplyPolicy

func (m OAuthClientMetadata) ApplyPolicy(policy MetadataPolicy) (any, error)

ApplyPolicy applies a MetadataPolicy to the OAuthClientMetadata

func (OAuthClientMetadata) MarshalJSON

func (m OAuthClientMetadata) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface

func (*OAuthClientMetadata) UnmarshalJSON

func (m *OAuthClientMetadata) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface

type OAuthProtectedResourceMetadata

type OAuthProtectedResourceMetadata struct {
	Resource                             string         `json:"resource,omitempty"`
	AuthorizationServers                 []string       `json:"authorization_servers,omitempty"`
	ScopesSupported                      []string       `json:"scopes_supported,omitempty"`
	BearerMethodsSupported               []string       `json:"bearer_methods_supported,omitempty"`
	ResourceSigningAlgValuesSupported    []string       `json:"resource_signing_alg_values_supported,omitempty"`
	ResourceEncryptionAlgValuesSupported []string       `json:"resource_encryption_alg_values_supported"`
	ResourceEncryptionEncValuesSupported []string       `json:"resource_encryption_enc_values_supported"`
	ResourceName                         string         `json:"resource_name,omitempty"`
	ResourceDocumentation                string         `json:"resource_documentation,omitempty"`
	ResourcePolicyURI                    string         `json:"resource_policy_uri,omitempty"`
	ResourceTOSURI                       string         `json:"resource_tos_uri,omitempty"`
	Extra                                map[string]any `json:"-"`
	SignedJWKSURI                        string         `json:"signed_jwks_uri,omitempty"`
	JWKSURI                              string         `json:"jwks_uri,omitempty"`
	JWKS                                 *jwx.JWKS      `json:"jwks,omitempty"`
	DisplayName                          string         `json:"display_name,omitempty"`
	Description                          string         `json:"description,omitempty"`
	Keywords                             []string       `json:"keywords,omitempty"`
	Contacts                             []string       `json:"contacts,omitempty"`
	LogoURI                              string         `json:"logo_uri,omitempty"`
	PolicyURI                            string         `json:"policy_uri,omitempty"`
	InformationURI                       string         `json:"information_uri,omitempty"`
	OrganizationName                     string         `json:"organization_name,omitempty"`
	OrganizationURI                      string         `json:"organization_uri,omitempty"`
	// contains filtered or unexported fields
}

func (OAuthProtectedResourceMetadata) ApplyPolicy

func (m OAuthProtectedResourceMetadata) ApplyPolicy(policy MetadataPolicy) (any, error)

ApplyPolicy applies a MetadataPolicy to the OAuthProtectedResourceMetadata

func (OAuthProtectedResourceMetadata) MarshalJSON

func (m OAuthProtectedResourceMetadata) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface

func (*OAuthProtectedResourceMetadata) UnmarshalJSON

func (m *OAuthProtectedResourceMetadata) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface

func (*OAuthProtectedResourceMetadata) UnmarshalMsgpack

func (m *OAuthProtectedResourceMetadata) UnmarshalMsgpack(data []byte) error

UnmarshalMsgpack implements the msgpack.Unmarshaler interface

type OIDCErrorResponse

type OIDCErrorResponse struct {
	Error            string `json:"error"`
	ErrorDescription string `json:"error_description,omitempty"`
}

OIDCErrorResponse is the error response of an oidc provider

type OIDCRP added in v0.8.0

type OIDCRP struct {
	*oauth2.Config
	*oidc.Provider
	*oidc.IDTokenVerifier
}

OIDCRP is a type for using an OIDC Relying Party with the oauth2 and oidc library. It holds an oauth2.Config, oidc.Provider, and oidc.IDTokenVerifier

type OIDCTokenResponse

type OIDCTokenResponse struct {
	AccessToken  string `json:"access_token"`
	TokenType    string `json:"token_type"`
	ExpiresIn    int64  `json:"expires_in"`
	RefreshToken string `json:"refresh_token"`
	Scopes       string `json:"scope"`
	IDToken      string `json:"id_token"`

	Extra map[string]any `json:"-"`
}

OIDCTokenResponse is the token response of an oidc provider

func (*OIDCTokenResponse) UnmarshalJSON

func (res *OIDCTokenResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface

type OpenIDProviderMetadata

type OpenIDProviderMetadata struct {
	Issuer                                                    string              `json:"issuer"`
	AuthorizationEndpoint                                     string              `json:"authorization_endpoint"`
	TokenEndpoint                                             string              `json:"token_endpoint"`
	UserinfoEndpoint                                          string              `json:"userinfo_endpoint,omitempty"`
	RegistrationEndpoint                                      string              `json:"registration_endpoint,omitempty"`
	ScopesSupported                                           []string            `json:"scopes_supported,omitempty"`
	ResponseTypesSupported                                    []string            `json:"response_types_supported"`
	ResponseModesSupported                                    []string            `json:"response_modes_supported,omitempty"`
	GrantTypesSupported                                       []string            `json:"grant_types_supported,omitempty"`
	ACRValuesSupported                                        []string            `json:"acr_values_supported,omitempty"`
	SubjectTypesSupported                                     []string            `json:"subject_types_supported"`
	IDTokenSigningAlgValuesSupported                          []string            `json:"id_token_signing_alg_values_supported,omitempty"`
	IDTokenEncryptionAlgValuesSupported                       []string            `json:"id_token_encryption_alg_values_supported,omitempty"`
	IDTokenEncryptionEncValuesSupported                       []string            `json:"id_token_encryption_enc_values_supported,omitempty"`
	UserinfoSignedResponseAlgValuesSupported                  []string            `json:"userinfo_signed_response_alg_values_supported,omitempty"`
	UserinfoEncryptedResponseAlgValuesSupported               []string            `json:"userinfo_encrypted_response_alg_values_supported,omitempty"`
	UserinfoEncryptedResponseEncValuesSupported               []string            `json:"userinfo_encrypted_response_enc_values_supported,omitempty"`
	RequestObjectSigningAlgValuesSupported                    []string            `json:"request_object_signing_alg_values_supported,omitempty"`
	RequestObjectEncryptionAlgValuesSupported                 []string            `json:"request_object_encryption_alg_values_supported,omitempty"`
	RequestObjectEncryptionEncValuesSupported                 []string            `json:"request_object_encryption_enc_values_supported,omitempty"`
	TokenEndpointAuthMethodsSupported                         []string            `json:"token_endpoint_auth_methods_supported,omitempty"`
	TokenEndpointAuthSigningAlgValuesSupported                []string            `json:"token_endpoint_auth_signing_alg_values_supported,omitempty"`
	DisplayValuesSupported                                    []string            `json:"display_values_supported,omitempty"`
	ClaimsSupported                                           []string            `json:"claims_supported,omitempty"`
	ServiceDocumentation                                      string              `json:"service_documentation,omitempty"`
	ClaimsLocalesSupported                                    []string            `json:"claims_locales_supported,omitempty"`
	UILocalesSupported                                        []string            `json:"ui_locales_supported,omitempty"`
	ClaimsParameterSupported                                  bool                `json:"claims_parameter_supported,omitempty"`
	RequestParameterSupported                                 bool                `json:"request_parameter_supported,omitempty"`
	RequestURIParameterSupported                              bool                `json:"request_uri_parameter_supported,omitempty"`
	RequireRequestURIRegistration                             bool                `json:"require_request_uri_registration,omitempty"`
	OPPolicyURI                                               string              `json:"op_policy_uri,omitempty"`
	OPTOSURI                                                  string              `json:"op_tos_uri,omitempty"`
	RevocationEndpoint                                        string              `json:"revocation_endpoint,omitempty"`
	RevocationEndpointAuthMethodsSupported                    []string            `json:"revocation_endpoint_auth_methods_supported,omitempty"`
	RevocationEndpointAuthSigningAlgValuesSupported           []string            `json:"revocation_endpoint_auth_signing_alg_values_supported,omitempty"`
	IntrospectionEndpoint                                     string              `json:"introspection_endpoint,omitempty"`
	IntrospectionEndpointAuthMethodsSupported                 []string            `json:"introspection_endpoint_auth_methods_supported,omitempty"`
	IntrospectionEndpointAuthSigningAlgValuesSupported        []string            `json:"introspection_endpoint_auth_signing_alg_values_supported,omitempty"`
	IntrospectionSigningAlgValuesSupported                    []string            `json:"introspection_signing_alg_values_supported,omitempty"`
	IntrospectionEncryptionAlgValuesSupported                 []string            `json:"introspection_encryption_alg_values_supported,omitempty"`
	IntrospectionEncryptionEncValuesSupported                 []string            `json:"introspection_encryption_enc_values_supported,omitempty"`
	CodeChallengeMethodsSupported                             []string            `json:"code_challenge_methods_supported,omitempty"`
	SignedMetadata                                            string              `json:"signed_metadata,omitempty"`
	DeviceAuthorizationEndpoint                               string              `json:"device_authorization_endpoint,omitempty"`
	TLSClientCertificateBoundAccessTokens                     bool                `json:"tls_client_certificate_bound_access_tokens,omitempty"`
	MTLSEndpointAliases                                       map[string]string   `json:"mtls_endpoint_aliases,omitempty"`
	NFVTokenSigningAlgValuesSupported                         []string            `json:"nfv_token_signing_alg_values_supported,omitempty"`
	NFVTokenEncryptionAlgValuesSupported                      []string            `json:"nfv_token_encryption_alg_values_supported,omitempty"`
	NFVTokenEncryptionEncValuesSupported                      []string            `json:"nfv_token_encryption_enc_values_supported,omitempty"`
	RequireSignedRequestObject                                bool                `json:"require_signed_request_object,omitempty"`
	PushedAuthorizationRequestEndpoint                        string              `json:"pushed_authorization_request_endpoint,omitempty"`
	RequirePushedAuthorizationRequests                        bool                `json:"require_pushed_authorization_requests,omitempty"`
	AuthorizationResponseIssParameterSupported                bool                `json:"authorization_response_iss_parameter_supported,omitempty"`
	CheckSessionIFrame                                        string              `json:"check_session_iframe,omitempty"`
	FrontchannelLogoutSupported                               bool                `json:"frontchannel_logout_supported,omitempty"`
	BackchannelLogoutSupported                                bool                `json:"backchannel_logout_supported,omitempty"`
	BackchannelLogoutSessionSupported                         bool                `json:"backchannel_logout_session_supported,omitempty"`
	EndSessionEndpoint                                        string              `json:"end_session_endpoint,omitempty"`
	BackchannelTokenDeliveryModesSupported                    []string            `json:"backchannel_token_delivery_modes_supported,omitempty"`
	BackchannelAuthenticationEndpoint                         string              `json:"backchannel_authentication_endpoint,omitempty"`
	BackchannelAuthenticationRequestSigningAlgValuesSupported []string            `json:"backchannel_authentication_request_signing_alg_values_supported,omitempty"`
	BackchannelUserCodeParameterSupported                     bool                `json:"backchannel_user_code_parameter_supported,omitempty"`
	AuthorizationDetailsTypesSupported                        []string            `json:"authorization_details_types_supported,omitempty"`
	ClientRegistrationTypesSupported                          []string            `json:"client_registration_types_supported"`
	FederationRegistrationEndpoint                            string              `json:"federation_registration_endpoint,omitempty"`
	RequestAuthenticationMethodsSupported                     map[string][]string `json:"request_authentication_methods_supported,omitempty"`
	RequestAuthenticationSigningAlgValuesSupported            []string            `json:"request_authentication_signing_alg_values_supported,omitempty"`
	Extra                                                     map[string]any      `json:"-"`
	SignedJWKSURI                                             string              `json:"signed_jwks_uri,omitempty"`
	JWKSURI                                                   string              `json:"jwks_uri,omitempty"`
	JWKS                                                      *jwx.JWKS           `json:"jwks,omitempty"`
	DisplayName                                               string              `json:"display_name,omitempty"`
	Description                                               string              `json:"description,omitempty"`
	Keywords                                                  []string            `json:"keywords,omitempty"`
	Contacts                                                  []string            `json:"contacts,omitempty"`
	LogoURI                                                   string              `json:"logo_uri,omitempty"`
	PolicyURI                                                 string              `json:"policy_uri,omitempty"`
	InformationURI                                            string              `json:"information_uri,omitempty"`
	OrganizationName                                          string              `json:"organization_name,omitempty"`
	OrganizationURI                                           string              `json:"organization_uri,omitempty"`
	// contains filtered or unexported fields
}

func (OpenIDProviderMetadata) ApplyPolicy

func (m OpenIDProviderMetadata) ApplyPolicy(policy MetadataPolicy) (any, error)

ApplyPolicy applies a MetadataPolicy to the OpenIDProviderMetadata

func (OpenIDProviderMetadata) MarshalJSON

func (m OpenIDProviderMetadata) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface

func (*OpenIDProviderMetadata) UnmarshalJSON

func (m *OpenIDProviderMetadata) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface

func (*OpenIDProviderMetadata) UnmarshalMsgpack

func (m *OpenIDProviderMetadata) UnmarshalMsgpack(data []byte) error

UnmarshalMsgpack implements the msgpack.Unmarshaler interface

type OpenIDRelyingPartyMetadata

type OpenIDRelyingPartyMetadata struct {
	Scope                                      string         `json:"scope,omitempty"`
	RedirectURIS                               []string       `json:"redirect_uris,omitempty"`
	ResponseTypes                              []string       `json:"response_types,omitempty"`
	GrantTypes                                 []string       `json:"grant_types,omitempty"`
	ApplicationType                            string         `json:"application_type,omitempty"`
	Contacts                                   []string       `json:"contacts,omitempty"`
	ClientName                                 string         `json:"client_name,omitempty"`
	LogoURI                                    string         `json:"logo_uri,omitempty"`
	ClientURI                                  string         `json:"client_uri,omitempty"`
	PolicyURI                                  string         `json:"policy_uri,omitempty"`
	TOSURI                                     string         `json:"tos_uri,omitempty"`
	SectorIdentifierURI                        string         `json:"sector_identifier_uri,omitempty"`
	SubjectType                                string         `json:"subject_type,omitempty"`
	SubjectTypesSupported                      []string       `json:"subject_types_supported,omitempty"`
	IDTokenSignedResponseAlg                   string         `json:"id_token_signed_response_alg,omitempty"`
	IDTokenSigningAlgValuesSupported           []string       `json:"id_token_signing_alg_values_supported,omitempty"`
	IDTokenEncryptedResponseAlg                string         `json:"id_token_encrypted_response_alg,omitempty"`
	IDTokenEncryptionAlgValuesSupported        []string       `json:"id_token_encryption_alg_values_supported,omitempty"`
	IDTokenEncryptedResponseEnc                string         `json:"id_token_encrypted_response_enc,omitempty"`
	IDTokenEncryptionEncValuesSupported        []string       `json:"id_token_encryption_enc_values_supported,omitempty"`
	UserinfoSignedResponseAlg                  string         `json:"userinfo_signed_response_alg,omitempty"`
	UserinfoSigningAlgValuesSupported          []string       `json:"userinfo_signing_alg_values_supported,omitempty"`
	UserinfoEncryptedResponseAlg               string         `json:"userinfo_encrypted_response_alg,omitempty"`
	UserinfoEncryptionAlgValuesSupported       []string       `json:"userinfo_encryption_alg_values_supported,omitempty"`
	UserinfoEncryptedResponseEnc               string         `json:"userinfo_encrypted_response_enc,omitempty"`
	UserinfoEncryptionEncValuesSupported       []string       `json:"userinfo_encryption_enc_values_supported,omitempty"`
	RequestObjectSigningAlg                    string         `json:"request_object_signing_alg,omitempty"`
	RequestObjectSigningAlgValuesSupported     []string       `json:"request_object_signing_alg_values_supported,omitempty"`
	RequestObjectEncryptionAlg                 string         `json:"request_object_encryption_alg,omitempty"`
	RequestObjectEncryptionAlgValuesSupported  []string       `json:"request_object_encryption_alg_values_supported,omitempty"`
	RequestObjectEncryptionEnc                 string         `json:"request_object_encryption_enc,omitempty"`
	RequestObjectEncryptionEncValuesSupported  []string       `json:"request_object_encryption_enc_values_supported,omitempty"`
	TokenEndpointAuthMethod                    string         `json:"token_endpoint_auth_method,omitempty"`
	TokenEndpointAuthMethodsSupported          []string       `json:"token_endpoint_auth_methods_supported,omitempty"`
	TokenEndpointAuthSigningAlg                string         `json:"token_endpoint_auth_signing_alg,omitempty"`
	TokenEndpointAuthSigningAlgValuesSupported []string       `json:"token_endpoint_auth_signing_alg_values_supported,omitempty"`
	AuthorizationSignedResponseAlg             string         `json:"authorization_signed_response_alg,omitempty"`
	AuthorizationSigningAlgValuesSupported     []string       `json:"authorization_signing_alg_values_supported,omitempty"`
	AuthorizationEncryptedResponseAlg          string         `json:"authorization_encrypted_response_alg,omitempty"`
	AuthorizationEncryptionAlgValuesSupported  []string       `json:"authorization_encryption_alg_values_supported,omitempty"`
	AuthorizationEncryptedResponseEnc          string         `json:"authorization_encrypted_response_enc,omitempty"`
	AuthorizationEncryptionEncValuesSupported  []string       `json:"authorization_encryption_enc_values_supported,omitempty"`
	DefaultMaxAge                              int64          `json:"default_max_age,omitempty"`
	RequireAuthTime                            bool           `json:"require_auth_time,omitempty"`
	DefaultACRValues                           []string       `json:"default_acr_values,omitempty"`
	InitiateLoginURI                           string         `json:"initiate_login_uri,omitempty"`
	RequestURIs                                []string       `json:"request_uris,omitempty"`
	SoftwareID                                 string         `json:"software_id,omitempty"`
	SoftwareVersion                            string         `json:"software_version,omitempty"`
	ClientID                                   string         `json:"client_id,omitempty"`
	ClientSecret                               string         `json:"client_secret,omitempty"`
	ClientIDIssuedAt                           int64          `json:"client_id_issued_at,omitempty"`
	ClientSecretExpiresAt                      int64          `json:"client_secret_expires_at,omitempty"`
	RegistrationAccessToken                    string         `json:"registration_access_token,omitempty"`
	RegistrationClientURI                      string         `json:"registration_client_uri,omitempty"`
	ClaimsRedirectURIs                         []string       `json:"claims_redirect_uris,omitempty"`
	NFVTokenSignedResponseAlg                  string         `json:"nfv_token_signed_response_alg,omitempty"`
	NFVTokenEncryptedResponseAlg               string         `json:"nfv_token_encrypted_response_alg,omitempty"`
	NFVTokenEncryptedResponseEnc               string         `json:"nfv_token_encrypted_response_enc,omitempty"`
	TLSClientCertificateBoundAccessTokens      bool           `json:"tls_client_certificate_bound_access_tokens,omitempty"`
	TLSClientAuthSubjectDN                     string         `json:"tls_client_auth_subject_dn,omitempty"`
	TLSClientAuthSANDNS                        string         `json:"tls_client_auth_san_dns,omitempty"`
	TLSClientAuthSANURI                        string         `json:"tls_client_auth_san_uri,omitempty"`
	TLSClientAuthSANIP                         string         `json:"tls_client_auth_san_ip,omitempty"`
	TLSClientAuthSANEMAIL                      string         `json:"tls_client_auth_san_email,omitempty"`
	RequireSignedRequestObject                 bool           `json:"require_signed_request_object,omitempty"`
	RequirePushedAuthorizationRequests         bool           `json:"require_pushed_authorization_requests,omitempty"`
	IntrospectionSignedResponseAlg             string         `json:"introspection_signed_response_alg,omitempty"`
	IntrospectionSigningAlgValuesSupported     []string       `json:"introspection_signing_alg_values_supported,omitempty"`
	IntrospectionEncryptedResponseAlg          string         `json:"introspection_encrypted_response_alg,omitempty"`
	IntrospectionEncryptionAlgValuesSupported  []string       `json:"introspection_encryption_alg_values_supported,omitempty"`
	IntrospectionEncryptedResponseEnc          string         `json:"introspection_encrypted_response_enc,omitempty"`
	IntrospectionEncryptionEncValuesSupported  []string       `json:"introspection_encryption_enc_values_supported,omitempty"`
	FrontchannelLogoutURI                      string         `json:"frontchannel_logout_uri,omitempty"`
	FrontchannelLogoutSessionRequired          bool           `json:"frontchannel_logout_session_required,omitempty"`
	BackchannelLogoutURI                       string         `json:"backchannel_logout_uri,omitempty"`
	BackchannelLogoutSessionRequired           bool           `json:"backchannel_logout_session_required,omitempty"`
	PostLogoutRedirectURIs                     []string       `json:"post_logout_redirect_uris,omitempty"`
	AuthorizationDetailsTypes                  []string       `json:"authorization_details_types,omitempty"`
	ClientRegistrationTypes                    []string       `json:"client_registration_types"`
	Extra                                      map[string]any `json:"-"`
	SignedJWKSURI                              string         `json:"signed_jwks_uri,omitempty"`
	JWKSURI                                    string         `json:"jwks_uri,omitempty"`
	JWKS                                       *jwx.JWKS      `json:"jwks,omitempty"`
	DisplayName                                string         `json:"display_name,omitempty"`
	Description                                string         `json:"description,omitempty"`
	Keywords                                   []string       `json:"keywords,omitempty"`
	InformationURI                             string         `json:"information_uri,omitempty"`
	OrganizationName                           string         `json:"organization_name,omitempty"`
	OrganizationURI                            string         `json:"organization_uri,omitempty"`
	// contains filtered or unexported fields
}

func (OpenIDRelyingPartyMetadata) ApplyPolicy

func (m OpenIDRelyingPartyMetadata) ApplyPolicy(policy MetadataPolicy) (any, error)

ApplyPolicy applies a MetadataPolicy to the OpenIDRelyingPartyMetadata

func (OpenIDRelyingPartyMetadata) MarshalJSON

func (m OpenIDRelyingPartyMetadata) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface

func (*OpenIDRelyingPartyMetadata) UnmarshalJSON

func (m *OpenIDRelyingPartyMetadata) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface

func (*OpenIDRelyingPartyMetadata) UnmarshalMsgpack

func (m *OpenIDRelyingPartyMetadata) UnmarshalMsgpack(data []byte) error

UnmarshalMsgpack implements the msgpack.Unmarshaler interface

type OwnedTrustMark

type OwnedTrustMark struct {
	ID                 string
	DelegationLifetime time.Duration
	Ref                string
	Extra              map[string]any
}

OwnedTrustMark is a type describing the trust marks owned by a TrustMarkOwner

type PeriodicEntityCollector added in v0.8.0

type PeriodicEntityCollector struct {
	// Collector used for actual collection (defaults to SimpleEntityCollector).
	Collector EntityCollector

	// TrustAnchors is the full list of trust anchors to iterate over.
	TrustAnchors []string

	// Interval between background collection rounds.
	Interval time.Duration `yaml:"interval"`

	// Concurrency limits simultaneous trust anchor collections per run.
	// If 0 or negative, a sensible default is used.
	Concurrency int `yaml:"concurrency"`

	SortEntitiesComparisonFunc func(a, b *CollectedEntity) int
	PagingLimit                int `yaml:"paging_limit"`

	// Optional handler invoked after each trust anchor collection with the
	// discovered entities; can be used to trigger proactive resolver jobs.
	Handler EntityObserver
	// contains filtered or unexported fields
}

PeriodicEntityCollector runs background entity collection for a set of trust anchors at a configurable interval. It implements EntityCollector by delegating synchronous collection to an inner Collector while warming caches in the background.

func (*PeriodicEntityCollector) CollectEntities added in v0.8.0

CollectEntities serves from the cached periodic results, applying filters and trimming based on the request.

func (*PeriodicEntityCollector) Start added in v0.8.0

func (p *PeriodicEntityCollector) Start()

Start launches the periodic background collection. Calling Start multiple times is safe; only the first call has an effect.

func (*PeriodicEntityCollector) Stop added in v0.8.0

func (p *PeriodicEntityCollector) Stop()

Stop stops the background collection loop. It is safe to call multiple times.

type PolicyOperator

type PolicyOperator interface {
	// Merge merges two policy operator values and returns the result
	Merge(a, b any, pathInfo string) (any, error)
	// Apply applies the policy operator value to the attribute value and returns the result
	Apply(value any, valueSet bool, policyValue any, essential bool, pathInfo string) (any, bool, error)
	// Name returns the PolicyOperatorName
	Name() PolicyOperatorName
	// MayCombineWith gives a list of PolicyOperatorName with which this PolicyOperator may be combined
	MayCombineWith() []PolicyOperatorName
}

PolicyOperator is an interface implemented by policy operators

func NewPolicyOperator

func NewPolicyOperator(
	name PolicyOperatorName,
	merger func(a, b any, pathInfo string) (any, error),
	applier func(value any, valueSet bool, policyValue any, essential bool, pathInfo string) (any, bool, error),
	mayCombineWith []PolicyOperatorName,
) PolicyOperator

NewPolicyOperator creates a new PolicyOperator from the passed functions and PolicyOperatorName

type PolicyOperatorName

type PolicyOperatorName string

PolicyOperatorName is the name of a PolicyOperator

const (
	PolicyOperatorValue      PolicyOperatorName = "value"
	PolicyOperatorDefault    PolicyOperatorName = "default"
	PolicyOperatorAdd        PolicyOperatorName = "add"
	PolicyOperatorOneOf      PolicyOperatorName = "one_of"
	PolicyOperatorSubsetOf   PolicyOperatorName = "subset_of"
	PolicyOperatorSupersetOf PolicyOperatorName = "superset_of"
	PolicyOperatorExcept     PolicyOperatorName = "except"
	PolicyOperatorEssential  PolicyOperatorName = "essential"
)

Constants for PolicyOperatorNames

type PolicyVerifier

type PolicyVerifier func(p MetadataPolicyEntry, pathInfo string) error

PolicyVerifier is a function that verifies a MetadataPolicyEntry

type ProactiveResolver added in v0.8.0

type ProactiveResolver struct {
	// EntityID is the issuer of the resolve response.
	EntityID string
	// Store persists signed responses.
	Store ResolveResponseStorage
	// Signer used to sign resolve responses.
	Signer *jwx.ResolveResponseSigner
	// RefreshLead defines how far ahead of expiration we refresh.
	RefreshLead time.Duration
	// Concurrency limits simultaneous resolve jobs.
	Concurrency int
	// QueueSize configures the job channel buffer; if <= 0, the channel is
	// unbuffered and producers will block until a worker receives.
	QueueSize int
	// contains filtered or unexported fields
}

ProactiveResolver schedules proactive resolve response creation and refresh.

func (*ProactiveResolver) Enqueue added in v0.8.0

func (r *ProactiveResolver) Enqueue(req apimodel.ResolveRequest)

Enqueue adds a resolve job.

func (*ProactiveResolver) OnDiscoveredEntities added in v0.8.0

func (r *ProactiveResolver) OnDiscoveredEntities(trustAnchor string, entities []*CollectedEntity)

OnDiscoveredEntities enqueues resolve jobs for each discovered entity.

func (*ProactiveResolver) Start added in v0.8.0

func (r *ProactiveResolver) Start()

Start launches the internal workers.

func (*ProactiveResolver) Stop added in v0.8.0

func (r *ProactiveResolver) Stop()

Stop stops workers.

type RequestObjectProducer

type RequestObjectProducer struct {
	EntityID string
	// contains filtered or unexported fields
}

RequestObjectProducer is a generator for signed request objects

func NewRequestObjectProducer

func NewRequestObjectProducer(
	entityID string, multiSigner jwx.VersatileSigner, lifetime time.Duration,
) *RequestObjectProducer

NewRequestObjectProducer creates a new RequestObjectProducer with the passed properties

func (RequestObjectProducer) ClientAssertion

func (rop RequestObjectProducer) ClientAssertion(aud string, alg ...string) ([]byte, error)

ClientAssertion creates a new signed client assertion jwt for the passed audience

func (RequestObjectProducer) RequestObject

func (rop RequestObjectProducer) RequestObject(requestValues map[string]any, headers jws.Headers, alg ...string) (
	[]byte, error,
)

RequestObject generates a signed request object jwt from the passed requestValues

type RequestURIGenerator added in v0.9.0

type RequestURIGenerator func([]byte) (string, error)

RequestURIGenerator is a function that takes a request object and returns a request_uri at which the passed request object will be available

type ResolveResponse

type ResolveResponse struct {
	Issuer                 string            `json:"iss"`
	Subject                string            `json:"sub"`
	IssuedAt               unixtime.Unixtime `json:"iat"`
	ExpiresAt              unixtime.Unixtime `json:"exp"`
	Audience               string            `json:"aud,omitempty"`
	ResolveResponsePayload `json:",inline"`
}

ResolveResponse is a type describing the response of a resolve request

func ParseResolveResponse

func ParseResolveResponse(body []byte) (*ResolveResponse, error)

ParseResolveResponse parses a jwt into a ResolveResponse

func (ResolveResponse) MarshalJSON

func (r ResolveResponse) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface. It also marshals extra fields.

type ResolveResponseKey added in v0.8.0

type ResolveResponseKey struct {
	Subject string
	Types   []string
}

ResolveResponseKey identifies a prepared response by subject and entity type subset.

type ResolveResponsePayload

type ResolveResponsePayload struct {
	Metadata    *Metadata              `json:"metadata,omitempty"`
	TrustMarks  TrustMarkInfos         `json:"trust_marks,omitempty"`
	TrustChain  JWSMessages            `json:"trust_chain,omitempty"`
	TrustAnchor string                 `json:"trust_anchor,omitempty"`
	Extra       map[string]interface{} `json:"-"`
}

ResolveResponsePayload holds the actual payload of a resolve response

func (ResolveResponsePayload) MarshalJSON

func (r ResolveResponsePayload) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface. It also marshals extra fields.

func (*ResolveResponsePayload) UnmarshalJSON

func (r *ResolveResponsePayload) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface. It also unmarshalls additional fields into the Extra claim.

type ResolveResponseStorage added in v0.8.0

type ResolveResponseStorage interface {
	// WriteJSON stores the given ResolveResponse as a JSON document for the specified subject, trust anchor, and entity types.
	WriteJSON(subject, trustAnchor string, types []string, payload ResolveResponse) error
	// WriteJWT stores the given ResolveResponse as a JWT document for the specified subject, trust anchor, and entity types.
	WriteJWT(subject, trustAnchor string, types []string, jwt func() ([]byte, error)) error
	// ReadJSON reads and unmarshalls the JSON response for the specified subject, trust anchor, and entity types.
	ReadJSON(subject, trustAnchor string, types []string) (*ResolveResponse, error)
	// ReadJWT reads the JWT response for the specified subject, trust anchor, and entity types.
	ReadJWT(subject, trustAnchor string, types []string) ([]byte, error)
	// Prune removes stored prepared responses for a trust anchor that are not
	// part of the expected set anymore (e.g., entities dropped from collection
	// or their entity type subsets changed).
	Prune(trustAnchor string, expected []ResolveResponseKey) error
}

ResolveResponseStorage is an interface for storing resolve responses.

type ResolveStore added in v0.8.0

type ResolveStore struct {
	// BaseDir where files are written.
	BaseDir string
	// StoreJWT controls whether the signed JWT is persisted.
	StoreJWT bool
	// StoreJSON controls whether the unsigned JSON is persisted.
	StoreJSON bool
}

ResolveStore is a minimal filesystem store to persist signed resolve responses so they can be served as static content implementing ResolveResponseStorage.

func (ResolveStore) Prune added in v0.8.0

func (s ResolveStore) Prune(trustAnchor string, expected []ResolveResponseKey) error

Prune removes files under the trust anchor directory that are not in the expected set.

func (ResolveStore) ReadJSON added in v0.8.0

func (s ResolveStore) ReadJSON(subject, trustAnchor string, types []string) (*ResolveResponse, error)

ReadJSON reads and unmarshalls the JSON response file.

func (ResolveStore) ReadJWT added in v0.8.0

func (s ResolveStore) ReadJWT(subject, trustAnchor string, types []string) ([]byte, error)

ReadJWT reads the JWT response file.

func (ResolveStore) WriteJSON added in v0.8.0

func (s ResolveStore) WriteJSON(subject, trustAnchor string, types []string, res ResolveResponse) error

WriteJSON persists the ResolveResponse as JSON if enabled.

func (ResolveStore) WriteJWT added in v0.8.0

func (s ResolveStore) WriteJWT(subject, trustAnchor string, types []string, jwt func() ([]byte, error)) error

WriteJWT persists the ResolveResponse as jwt if enabled.

type SelfIssuedTrustMarkIssuer added in v0.10.0

type SelfIssuedTrustMarkIssuer struct {
	EntityID string
	*jwx.TrustMarkSigner
	// contains filtered or unexported fields
}

SelfIssuedTrustMarkIssuer is an entity that can issue TrustMarkInfo for itself. Unlike TrustMarkIssuer, it returns a full TrustMarkInfo including metadata.

func NewSelfIssuedTrustMarkIssuer added in v0.10.0

func NewSelfIssuedTrustMarkIssuer(
	entityID string, signer *jwx.TrustMarkSigner, trustMarkSpecs []SelfIssuedTrustMarkSpec,
) *SelfIssuedTrustMarkIssuer

NewSelfIssuedTrustMarkIssuer creates a new SelfIssuedTrustMarkIssuer

func (*SelfIssuedTrustMarkIssuer) AddTrustMark added in v0.10.0

func (tmi *SelfIssuedTrustMarkIssuer) AddTrustMark(spec SelfIssuedTrustMarkSpec)

AddTrustMark adds a SelfIssuedTrustMarkSpec to the SelfIssuedTrustMarkIssuer enabling it to issue the TrustMarkInfo

func (SelfIssuedTrustMarkIssuer) IssueTrustMark added in v0.10.0

func (tmi SelfIssuedTrustMarkIssuer) IssueTrustMark(trustMarkType, sub string, lifetime ...time.Duration) (
	*TrustMarkInfo, error,
)

IssueTrustMark issues a TrustMarkInfo for the passed trust mark type and subject; optionally a custom lifetime can be passed. Returns the full TrustMarkInfo including metadata.

func (*SelfIssuedTrustMarkIssuer) TrustMarkTypes added in v0.10.0

func (tmi *SelfIssuedTrustMarkIssuer) TrustMarkTypes() []string

TrustMarkTypes returns a slice of the trust mark types for which this SelfIssuedTrustMarkIssuer can issue TrustMarks

type SelfIssuedTrustMarkSpec added in v0.10.0

type SelfIssuedTrustMarkSpec struct {
	TrustMarkSpec            `yaml:",inline"`
	IncludeExtraClaimsInInfo bool `json:"include_extra_claims_in_info" yaml:"include_extra_claims_in_info"`
}

SelfIssuedTrustMarkSpec describes a TrustMark for a SelfIssuedTrustMarkIssuer. It extends TrustMarkSpec with self-issuance specific options.

type SignedJWKS added in v0.11.0

type SignedJWKS struct {

	// Keys is the REQUIRED "keys" claim: the array of JWK values.
	Keys jwx.JWKS `json:"keys"`
	// Issuer is the REQUIRED "iss" claim.
	Issuer string `json:"iss"`
	// Subject is the REQUIRED "sub" claim (owner of the keys; SHOULD equal iss).
	Subject string `json:"sub"`
	// IssuedAt is the OPTIONAL "iat" claim.
	IssuedAt *unixtime.Unixtime `json:"iat,omitempty"`
	// ExpiresAt is the OPTIONAL "exp" claim.
	ExpiresAt *unixtime.Unixtime `json:"exp,omitempty"`
	// contains filtered or unexported fields
}

SignedJWKS holds a parsed signed JWK Set JWT (media type application/jwk-set+jwt, typ jwk-set+jwt) as defined in section 5.2.1 of the OpenID Federation 1.0 specification. It is the payload format used by the signed_jwks_uri metadata parameter

func ParseSignedJWKS added in v0.11.0

func ParseSignedJWKS(jwtBytes []byte) (*SignedJWKS, error)

ParseSignedJWKS parses a signed JWK Set JWT (application/jwk-set+jwt) and validates the structural requirements from section 5.2.1:

  • the JWT typ header MUST be "jwk-set+jwt";
  • the kid header MUST be present;
  • the "keys" claim is REQUIRED and MUST be a non-empty array of JWKs with unique, non-empty kids;
  • the "iss" and "sub" claims are REQUIRED.

Signature verification is NOT performed by Parse; call Verify with the expected JWKS afterwards.

func (SignedJWKS) KID added in v0.11.0

func (s SignedJWKS) KID() (string, bool)

KID returns the kid header of the signing key, if present.

func (SignedJWKS) Verify added in v0.11.0

func (s SignedJWKS) Verify(keys jwx.JWKS) bool

Verify verifies the signed JWK Set JWT signature against the provided JWKS.

type SimpleEntityCollector

type SimpleEntityCollector struct {
	// contains filtered or unexported fields
}

SimpleEntityCollector is an EntityCollector that collects entities in a federation

func (*SimpleEntityCollector) CollectEntities

CollectEntities implements the EntityCollector interface

type SimpleOPCollector

type SimpleOPCollector struct{}

SimpleOPCollector is an EntityCollector that uses the SimpleEntityCollector to collect OPs in a federation

func (*SimpleOPCollector) CollectEntities

CollectEntities implements the EntityCollector interface

type SimpleRemoteEntityCollector

type SimpleRemoteEntityCollector struct {
	EntityCollectionEndpoint string
}

SimpleRemoteEntityCollector is an EntityCollector that utilizes a given EntityCollectionEndpoint

func (SimpleRemoteEntityCollector) CollectEntities

CollectEntities queries a remote EntityCollectionEndpoint for the collected entities and implements the EntityCollector interface

type SimpleRemoteMetadataResolver

type SimpleRemoteMetadataResolver struct {
	ResolveEndpoint string
}

SimpleRemoteMetadataResolver is a MetadataResolver that utilizes a given ResolveEndpoint

func (SimpleRemoteMetadataResolver) Resolve

Resolve implements the MetadataResolver interface

func (SimpleRemoteMetadataResolver) ResolvePossible

func (r SimpleRemoteMetadataResolver) ResolvePossible(req apimodel.ResolveRequest) (bool, bool)

ResolvePossible implements the MetadataResolver interface

func (SimpleRemoteMetadataResolver) ResolveResponse

ResolveResponse returns the ResolveResponse from a response endpoint

func (SimpleRemoteMetadataResolver) ResolveResponsePayload

ResolveResponsePayload implements the MetadataResolver interface

type SliceOrSingleValue

type SliceOrSingleValue[T any] []T

SliceOrSingleValue is a type that supports (un-)marshaling (json) of a slice where a single value might not be expressed as a slice

func (SliceOrSingleValue[T]) MarshalJSON

func (v SliceOrSingleValue[T]) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface

func (SliceOrSingleValue[T]) MarshalYAML

func (v SliceOrSingleValue[T]) MarshalYAML() (interface{}, error)

MarshalYAML implements the yaml.Marshaler interface

func (*SliceOrSingleValue[T]) UnmarshalJSON

func (v *SliceOrSingleValue[T]) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface

func (*SliceOrSingleValue[T]) UnmarshalYAML

func (v *SliceOrSingleValue[T]) UnmarshalYAML(value *yaml.Node) error

UnmarshalYAML implements the yaml.Unmarshaler interface

type SmartRemoteEntityCollector

type SmartRemoteEntityCollector struct {
	TrustAnchors []string
}

SmartRemoteEntityCollector is an EntityCollector that uses remote entity collection endpoints. It will iterate through the entity collect endpoints of the given TrustAnchors and stop if one is successful, if no entity collection endpoint is successful, the SimpleEntityCollector is used

func (SmartRemoteEntityCollector) CollectEntities

CollectEntities implements the EntityCollector interface

type SmartRemoteMetadataResolver

type SmartRemoteMetadataResolver struct{}

SmartRemoteMetadataResolver is a MetadataResolver that utilizes remote resolve endpoints. It will iterate through the resolve endpoints of the given TrustAnchors and stop if one is successful, if no resolve endpoint is successful, local resolving is used

func (SmartRemoteMetadataResolver) Resolve

Resolve implements the MetadataResolver interface

func (SmartRemoteMetadataResolver) ResolvePossible

ResolvePossible implements the MetadataResolver interface

func (SmartRemoteMetadataResolver) ResolveResponsePayload

ResolveResponsePayload implements the MetadataResolver interface

type StaticFederationEntity added in v0.10.0

type StaticFederationEntity struct {
	ID                    string
	Metadata              *Metadata
	AuthorityHints        []string
	TrustAnchorHints      []string
	ConfigurationLifetime time.Duration
	*jwx.EntityStatementSigner
	TrustMarks                     []*EntityConfigurationTrustMarkConfig
	TrustMarkIssuers               AllowedTrustMarkIssuers
	TrustMarkOwners                TrustMarkOwners
	Extra                          map[string]any
	CriticalClaims                 []string
	ShouldApplyInformationalClaims bool
}

StaticFederationEntity is a type for an entity participating in federations. It holds all relevant information about the federation entity and can be used to create an EntityConfiguration about it

func NewFederationEntity

func NewFederationEntity(
	entityID string, authorityHints, trustAnchorHints []string, metadata *Metadata,
	signer *jwx.EntityStatementSigner, configurationLifetime time.Duration, extra map[string]any,
) (*StaticFederationEntity, error)

NewFederationEntity creates a new StaticFederationEntity with the passed properties

func (StaticFederationEntity) EntityConfigurationJWT added in v0.10.0

func (f StaticFederationEntity) EntityConfigurationJWT() ([]byte, error)

EntityConfigurationJWT creates and returns the signed jwt as a []byte for the entity's entity configuration

func (StaticFederationEntity) EntityConfigurationPayload added in v0.10.0

func (f StaticFederationEntity) EntityConfigurationPayload() (*EntityStatementPayload, error)

EntityConfigurationPayload returns an EntityStatementPayload for this StaticFederationEntity

func (StaticFederationEntity) EntityID added in v0.10.0

func (f StaticFederationEntity) EntityID() string

EntityID returns the entity ID of the StaticFederationEntity

func (StaticFederationEntity) SignEntityStatement added in v0.10.0

func (f StaticFederationEntity) SignEntityStatement(payload EntityStatementPayload) ([]byte, error)

SignEntityStatement creates a signed JWT for the given EntityStatementPayload; this function is intended to be used on TA/IA

func (StaticFederationEntity) SignEntityStatementWithHeaders added in v0.10.0

func (f StaticFederationEntity) SignEntityStatementWithHeaders(
	payload EntityStatementPayload, headers jws.Headers,
) ([]byte, error)

SignEntityStatementWithHeaders creates a signed JWT for the given EntityStatementPayload; this function is intended to be used on TA/IA

type SubordinateJWKSInfo added in v0.11.0

type SubordinateJWKSInfo struct {
	EntityID         string
	EnableJWKSUpdate bool
	JWKSPollInterval *int64 // seconds; nil or <=0 means derive from EC exp
	JWKS             jwx.JWKS
}

SubordinateJWKSInfo is the subset of subordinate state the refresher needs.

type SubordinateJWKSRefreshStorage added in v0.11.0

type SubordinateJWKSRefreshStorage interface {
	// ListEnabled returns all subordinates with EnableJWKSUpdate=true.
	ListEnabled() ([]SubordinateJWKSInfo, error)
	// Get returns the subordinate with the given entity ID, or
	// (nil, nil) if not found.
	Get(entityID string) (*SubordinateJWKSInfo, error)
	// UpdateJWKS replaces the stored JWKS for the given entity ID.
	UpdateJWKS(entityID string, jwks jwx.JWKS) error
}

SubordinateJWKSRefreshStorage is the storage interface the SubordinateJWKSRefresher relies on. Implementations must be safe for concurrent use.

type SubordinateJWKSRefresher added in v0.11.0

type SubordinateJWKSRefresher struct {
	// contains filtered or unexported fields
}

SubordinateJWKSRefresher periodically polls the Entity Configuration of subordinates with EnableJWKSUpdate=true and updates their stored JWKS when the EC's jwks changes). It is modeled on TAJWKSRefresher but keeps JWKS only in storage (subordinates have no in-memory JWKS copy).

func NewSubordinateJWKSRefresher added in v0.11.0

func NewSubordinateJWKSRefresher(
	storage SubordinateJWKSRefreshStorage,
	fetch ECFetcher,
	configs ...*SubordinateJWKSRefresherConfig,
) (*SubordinateJWKSRefresher, error)

NewSubordinateJWKSRefresher creates a new SubordinateJWKSRefresher. The refresher is not started; call Start.

func (*SubordinateJWKSRefresher) Add added in v0.11.0

func (p *SubordinateJWKSRefresher) Add(entityID string) error

Add registers a subordinate for polling and, if the refresher is running, starts polling it immediately. The initial poll is performed synchronously; an error is returned if it fails. If a subordinate with the same entity_id is already registered, its polling goroutine is stopped first and replaced.

func (*SubordinateJWKSRefresher) IsStarted added in v0.11.0

func (p *SubordinateJWKSRefresher) IsStarted() bool

IsStarted reports whether Start has been called and Stop has not.

func (*SubordinateJWKSRefresher) Remove added in v0.11.0

func (p *SubordinateJWKSRefresher) Remove(entityID string)

Remove stops polling for a subordinate by entity_id. No-op if not registered.

func (*SubordinateJWKSRefresher) Start added in v0.11.0

func (p *SubordinateJWKSRefresher) Start() error

Start launches polling goroutines for all enabled subordinates. The initial poll of each subordinate is performed synchronously; an error from any initial poll aborts Start after stopping already-started goroutines.

func (*SubordinateJWKSRefresher) Stop added in v0.11.0

func (p *SubordinateJWKSRefresher) Stop()

Stop gracefully shuts down all polling goroutines. Safe to call multiple times.

func (*SubordinateJWKSRefresher) Update added in v0.11.0

func (p *SubordinateJWKSRefresher) Update(entityID string) error

Update reloads a subordinate from storage and restarts its polling goroutine if it is enabled. If not enabled, any existing polling is stopped. If the subordinate is unknown it is added via Add.

type SubordinateJWKSRefresherConfig added in v0.11.0

type SubordinateJWKSRefresherConfig struct {
	// LogLevel sets the minimum log level. Default: "info".
	LogLevel string `yaml:"log_level"`
}

SubordinateJWKSRefresherConfig configures the subordinate JWKS refresher.

type TAJWKSRefresher added in v0.11.0

type TAJWKSRefresher struct {
	// contains filtered or unexported fields
}

TAJWKSRefresher monitors trust anchors for JWKS changes and updates them automatically

func NewTAJWKSRefresher added in v0.11.0

func NewTAJWKSRefresher(
	tas *TrustAnchors,
	storage JWKStorage,
	configs ...*TAJWKSRefresherConfig,
) (*TAJWKSRefresher, error)

NewTAJWKSRefresher creates a new TA key poller Accepts 0 or 1 config structs (uses first if multiple passed) Default log level is "info"

func (*TAJWKSRefresher) Add added in v0.11.0

func (p *TAJWKSRefresher) Add(ta *TrustAnchor) error

Add adds a trust anchor to the refresher and, if the refresher is running and the TA has EnableJWKSUpdate=true, starts polling it immediately. If a TA with the same entity_id already exists, it is replaced (its polling goroutine is stopped first). The initial poll is performed synchronously; an error is returned if it fails (unless the TA has no JWKS and storage is available to seed — then the error from a failed initial fetch is returned but the TA is still registered).

This is safe to call after Start(); it is the dynamic per-TA control used by the admin API.

func (*TAJWKSRefresher) IsStarted added in v0.11.0

func (p *TAJWKSRefresher) IsStarted() bool

IsStarted reports whether the refresher has been started (Start called and not yet stopped). Safe to call concurrently with Start/Stop.

func (*TAJWKSRefresher) Remove added in v0.11.0

func (p *TAJWKSRefresher) Remove(entityID string)

Remove stops polling for and removes a trust anchor by entity_id. If the TA does not exist, this is a no-op. Safe to call after Start().

func (*TAJWKSRefresher) Start added in v0.11.0

func (p *TAJWKSRefresher) Start() error

Start launches the polling goroutines for all TAs with EnableJWKSUpdate=true Returns an error if initial validation fails

func (*TAJWKSRefresher) Stop added in v0.11.0

func (p *TAJWKSRefresher) Stop()

Stop gracefully shuts down all polling goroutines

func (*TAJWKSRefresher) Update added in v0.11.0

func (p *TAJWKSRefresher) Update(ta *TrustAnchor) error

Update replaces an existing trust anchor with an updated one, restarting its polling goroutine if poll-relevant fields changed. If the TA does not exist, it is added via Add. Safe to call after Start().

type TAJWKSRefresherConfig added in v0.11.0

type TAJWKSRefresherConfig struct {
	// LogLevel sets minimum log level ("debug", "info", "warn", "error")
	// Default: "info"
	LogLevel string `yaml:"log_level"`
}

TAJWKSRefresherConfig configures the TA key polling behavior

type TriggerUpdateHookConfig added in v0.11.0

type TriggerUpdateHookConfig struct {
	// TargetEntityID is the entity identifier of the federating entity (e.g.
	// a lighthouse) that exposes the trigger endpoint.
	TargetEntityID string
	// ROProducer produces the client assertion JWT (private_key_jwt) used to
	// authenticate to the trigger endpoint. Optional; when nil the hook never
	// authenticates, even if the target requires it.
	ROProducer *RequestObjectProducer
	// Headers are additional headers set on the request.
	Headers map[string]string
	// Timeout is the HTTP client timeout. Default: 20s.
	Timeout time.Duration
}

TriggerUpdateHookConfig configures a key rotation hook that POSTs to the target entity's federation_jwks_update_trigger_endpoint, telling it to re-fetch this entity's JWKS from its Entity Configuration. The endpoint URL and supported signing algorithms are read dynamically from the target's Entity Configuration on each rotation (served from the EC cache).

Whether client authentication is used is decided per invocation from the target's EC: if it advertises private_key_jwt in federation_jwks_update_trigger_endpoint_auth_methods, the hook authenticates with ROProducer; otherwise it sends an unauthenticated request with the entity_id in the "sub" form field. If auth is required but ROProducer is nil, the request is sent without auth and will fail at the target (logged, not propagated).

type TrustAnchor

type TrustAnchor struct {
	EntityID         string                  `json:"entity_id"`
	JWKSFile         string                  `json:"jwks_file"`
	EnableJWKSUpdate bool                    `json:"enable_jwks_update"`
	KeyPollInterval  duration.DurationOption `json:"key_poll_interval"`
	// contains filtered or unexported fields
}

TrustAnchor is a type for specifying trust anchors

func (*TrustAnchor) JWKS

func (t *TrustAnchor) JWKS() jwx.JWKS

JWKS returns the current JWKS in a thread-safe manner

func (TrustAnchor) MarshalYAML added in v0.11.0

func (t TrustAnchor) MarshalYAML() (interface{}, error)

MarshalYAML implements custom YAML marshaling for serialization

func (*TrustAnchor) SetJWKS added in v0.11.0

func (t *TrustAnchor) SetJWKS(jwks jwx.JWKS)

SetJWKS sets the JWKS in a thread-safe manner

func (*TrustAnchor) UnmarshalYAML added in v0.11.0

func (t *TrustAnchor) UnmarshalYAML(node *yaml.Node) error

UnmarshalYAML implements custom YAML unmarshaling to handle both legacy 'jwks' field and new 'jwks_file' field. It loads JWKS from file if jwks_file is specified.

type TrustAnchorHintsMode added in v0.9.0

type TrustAnchorHintsMode string

TrustAnchorHintsMode controls how the resolver uses the starting entity's trust_anchor_hints when selecting trust anchors for resolution.

  • Ignore: use configured trust anchors as-is.
  • Prefer: prefer intersection of configured trust anchors and hints; if intersection is empty, fall back to all configured anchors. Fallback to all configured anchors is handled by callers if intersection does not yield a successful resolve.
  • Require: use only the intersection of configured trust anchors and hints.
const (
	TrustAnchorHintsModeIgnore  TrustAnchorHintsMode = "ignore"
	TrustAnchorHintsModePrefer  TrustAnchorHintsMode = "prefer"
	TrustAnchorHintsModeRequire TrustAnchorHintsMode = "require"
)

type TrustAnchors

type TrustAnchors []*TrustAnchor

TrustAnchors is a slice of TrustAnchor

func NewTrustAnchorsFromEntityIDs

func NewTrustAnchorsFromEntityIDs(anchorIDs ...string) (anchors TrustAnchors)

NewTrustAnchorsFromEntityIDs returns TrustAnchors for the passed entity ids; this does not set jwks.JWKS

func (TrustAnchors) EntityIDs

func (anchors TrustAnchors) EntityIDs() (entityIDs []string)

EntityIDs returns the entity ids as a []string

func (TrustAnchors) GetByEntityID added in v0.11.0

func (anchors TrustAnchors) GetByEntityID(entityID string) *TrustAnchor

GetByEntityID finds and returns a pointer to the TrustAnchor with the given entity ID Returns nil if not found

type TrustChain

type TrustChain []*EntityStatement

TrustChain is a slice of *EntityStatements

func (TrustChain) ExpiresAt

func (c TrustChain) ExpiresAt() unixtime.Unixtime

ExpiresAt returns the expiration time of the TrustChain as a UNIX time stamp

func (TrustChain) Messages

func (c TrustChain) Messages() (msgs JWSMessages)

Messages returns the jwts of the TrustChain

func (TrustChain) Metadata

func (c TrustChain) Metadata() (*Metadata, error)

Metadata returns the final Metadata for this TrustChain, i.e. the Metadata of the leaf entity with MetadataPolicies of authorities applied to it.

func (TrustChain) PathLen

func (c TrustChain) PathLen() int

PathLen returns the path len of a chain as defined by the spec, i.e. the number of intermediates

type TrustChainChecker

type TrustChainChecker interface {
	Check(TrustChain) bool
}

TrustChainChecker can check a single TrustChain to determine if it should be included or not, i.e. in a TrustChainsFilter

type TrustChainScoringFnc

type TrustChainScoringFnc func(c TrustChain) int

TrustChainScoringFnc a function type that takes a TrustChain and calculates a score for the chain. This score then can be used to sort TrustChains

type TrustChains

type TrustChains []TrustChain

TrustChains is a slice of multiple TrustChain

func (TrustChains) Filter

func (c TrustChains) Filter(filter ...TrustChainsFilter) TrustChains

Filter filters multiple TrustChains with the passed TrustChainsFilter to a subset

func (TrustChains) MinExpiresAt added in v0.10.6

func (c TrustChains) MinExpiresAt() (minExpiration unixtime.Unixtime)

MinExpiresAt returns the earliest expiration time of all TrustChains in the TrustChains

func (TrustChains) SortAsc

func (c TrustChains) SortAsc(scorer TrustChainScoringFnc) TrustChains

SortAsc sorts multiple TrustChains ascending by using the passed TrustChainScoringFnc

func (TrustChains) SortDesc

func (c TrustChains) SortDesc(scorer TrustChainScoringFnc) TrustChains

SortDesc sorts multiple TrustChains descending by using the passed TrustChainScoringFnc

type TrustChainsFilter

type TrustChainsFilter interface {
	Filter(TrustChains) TrustChains
}

TrustChainsFilter filters multiple TrustChains to a subset

var TrustChainsFilterMinPathLength TrustChainsFilter = trustChainsFilterPathLength{/* contains filtered or unexported fields */}

TrustChainsFilterMinPathLength is a TrustChainsFilter that filters TrustChains to the chains with the minimal path length

func NewTrustChainsFilterFromCheckerFnc

func NewTrustChainsFilterFromCheckerFnc(checker func(TrustChain) bool) TrustChainsFilter

NewTrustChainsFilterFromCheckerFnc returns a new TrustChainsFilter from the passed checker function

func NewTrustChainsFilterFromTrustChainChecker

func NewTrustChainsFilterFromTrustChainChecker(f TrustChainChecker) TrustChainsFilter

NewTrustChainsFilterFromTrustChainChecker creates a new TrustChainsFilter from a TrustChainChecker

func TrustChainsFilterMaxPathLength

func TrustChainsFilterMaxPathLength(maxPathLen int) TrustChainsFilter

TrustChainsFilterMaxPathLength returns a TrustChainsFilter that filters TrustChains to only the chains that are not longer than the passed maximum path len.

func TrustChainsFilterTrustAnchor

func TrustChainsFilterTrustAnchor(anchor string) TrustChainsFilter

TrustChainsFilterTrustAnchor returns a TrustChainsFilter for the passed trust anchor entity id. The return TrustChainsFilter will filter TrustChains to only chains ending with the passed anchor.

type TrustMark

type TrustMark struct {
	Issuer        string                 `json:"iss"`
	Subject       string                 `json:"sub"`
	TrustMarkType string                 `json:"trust_mark_type"`
	IssuedAt      unixtime.Unixtime      `json:"iat"`
	LogoURI       string                 `json:"logo_uri,omitempty"`
	ExpiresAt     *unixtime.Unixtime     `json:"exp,omitempty"`
	Ref           string                 `json:"ref,omitempty"`
	DelegationJWT string                 `json:"delegation,omitempty"`
	Extra         map[string]interface{} `json:"-"`
	// contains filtered or unexported fields
}

TrustMark is a type for holding a trust mark

func ParseTrustMark

func ParseTrustMark(data []byte) (*TrustMark, error)

ParseTrustMark parses a trust mark jwt into a TrustMark

func (*TrustMark) Delegation

func (tm *TrustMark) Delegation() (*DelegationJWT, error)

Delegation returns the DelegationJWT (if any) for this TrustMark

func (TrustMark) MarshalJSON

func (tm TrustMark) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface. It also marshals extra fields.

func (*TrustMark) UnmarshalJSON

func (tm *TrustMark) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface. It also unmarshalls additional fields into the Extra claim.

func (*TrustMark) VerifyExternal

func (tm *TrustMark) VerifyExternal(jwks jwx.JWKS, tmo ...TrustMarkOwnerSpec) error

VerifyExternal verifies the TrustMark by using the passed trust mark issuer jwks and optionally the passed trust mark owner jwks

func (*TrustMark) VerifyFederation

func (tm *TrustMark) VerifyFederation(ta *EntityStatementPayload) error

VerifyFederation verifies the TrustMark by using the passed trust anchor

type TrustMarkInfo

type TrustMarkInfo struct {
	TrustMarkType string                 `json:"trust_mark_type" yaml:"type"`
	TrustMarkJWT  string                 `json:"trust_mark" yaml:"trust_mark"`
	Extra         map[string]interface{} `json:"-" yaml:"-"`
	// contains filtered or unexported fields
}

TrustMarkInfo is a type for holding a trust mark as represented in an EntityConfiguration

func (TrustMarkInfo) MarshalJSON

func (tm TrustMarkInfo) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface. It also marshals extra fields.

func (*TrustMarkInfo) TrustMark

func (tm *TrustMarkInfo) TrustMark() (*TrustMark, error)

TrustMark returns the TrustMark for this TrustMarkInfo

func (*TrustMarkInfo) UnmarshalJSON

func (tm *TrustMarkInfo) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface. It also unmarshalls additional fields into the Extra claim.

func (*TrustMarkInfo) VerifyExternal

func (tm *TrustMarkInfo) VerifyExternal(
	jwks jwx.JWKS,
	tmo ...TrustMarkOwnerSpec,
) error

VerifyExternal verifies the TrustMarkInfo by using the passed trust mark issuer jwks and optionally the passed trust mark owner jwks

func (*TrustMarkInfo) VerifyFederation

func (tm *TrustMarkInfo) VerifyFederation(ta *EntityStatementPayload) error

VerifyFederation verifies the TrustMarkInfo by using the passed trust anchor

type TrustMarkInfos

type TrustMarkInfos []TrustMarkInfo

TrustMarkInfos is a slice of TrustMarkInfo

func (TrustMarkInfos) Find

func (tms TrustMarkInfos) Find(matcher func(info TrustMarkInfo) bool) *TrustMarkInfo

Find uses the passed function to find the first matching TrustMarkInfo

func (TrustMarkInfos) FindByID

func (tms TrustMarkInfos) FindByID(id string) *TrustMarkInfo

FindByID returns the (first) TrustMarkInfo with the passed id Deprecated: use FindByType instead

func (TrustMarkInfos) FindByType added in v0.8.0

func (tms TrustMarkInfos) FindByType(trustMarkType string) *TrustMarkInfo

FindByType returns the (first) TrustMarkInfo with the passed trust mark type

func (TrustMarkInfos) VerifiedExternal

func (tms TrustMarkInfos) VerifiedExternal(
	jwks jwx.JWKS,
	tmo ...TrustMarkOwnerSpec,
) (verified TrustMarkInfos)

VerifiedExternal verifies all TrustMarkInfos by using the passed trust mark issuer jwks and optionally the passed trust mark owner jwks and returns only the valid TrustMarkInfos

func (TrustMarkInfos) VerifiedFederation

func (tms TrustMarkInfos) VerifiedFederation(ta *EntityStatementPayload) (verified TrustMarkInfos)

VerifiedFederation verifies all TrustMarkInfos by using the passed trust anchor and returns only the valid TrustMarkInfos

type TrustMarkIssuer

type TrustMarkIssuer struct {
	EntityID string
	*jwx.TrustMarkSigner
	// contains filtered or unexported fields
}

TrustMarkIssuer is an entity that can issue TrustMarkInfo

func NewTrustMarkIssuer

func NewTrustMarkIssuer(
	entityID string, signer *jwx.TrustMarkSigner, trustMarkSpecs []TrustMarkSpec,
) *TrustMarkIssuer

NewTrustMarkIssuer creates a new TrustMarkIssuer

func (*TrustMarkIssuer) AddTrustMark

func (tmi *TrustMarkIssuer) AddTrustMark(spec TrustMarkSpec)

AddTrustMark adds a TrustMarkSpec to the in-memory map. Note: If a provider is configured, this has no effect on issuance.

func (*TrustMarkIssuer) HasTrustMarkType added in v0.10.0

func (tmi *TrustMarkIssuer) HasTrustMarkType(trustMarkType string) bool

HasTrustMarkType checks if a trust mark type is available for issuance.

func (*TrustMarkIssuer) IssueTrustMark

func (tmi *TrustMarkIssuer) IssueTrustMark(trustMarkType, sub string, lifetime ...time.Duration) (
	string, *unixtime.Unixtime, error,
)

IssueTrustMark issues a trust mark JWT for the passed trust mark type and subject; optionally a custom lifetime can be passed. Returns the signed JWT string and expiration time.

func (*TrustMarkIssuer) IssueTrustMarkWithOptions added in v0.10.0

func (tmi *TrustMarkIssuer) IssueTrustMarkWithOptions(
	trustMarkType, sub string,
	opts IssueTrustMarkOptions,
) (string, *unixtime.Unixtime, error)

IssueTrustMarkWithOptions issues a trust mark with additional options. If SubjectClaims is non-nil (even if empty), it is used exclusively. If SubjectClaims is nil, the spec's Extra claims are used.

func (*TrustMarkIssuer) RemoveTrustMark added in v0.10.0

func (tmi *TrustMarkIssuer) RemoveTrustMark(trustMarkType string)

RemoveTrustMark removes a TrustMarkSpec from the in-memory map. Note: If a provider is configured, this has no effect on issuance.

func (*TrustMarkIssuer) SetProvider added in v0.10.0

func (tmi *TrustMarkIssuer) SetProvider(provider TrustMarkSpecProvider)

SetProvider sets a custom TrustMarkSpecProvider for dynamic spec lookup. When a provider is set, it takes precedence over the static in-memory map.

func (*TrustMarkIssuer) TrustMarkTypes

func (tmi *TrustMarkIssuer) TrustMarkTypes() []string

TrustMarkTypes returns a slice of the trust mark ids for which this TrustMarkIssuer can issue TrustMarks

type TrustMarkOwner

type TrustMarkOwner struct {
	EntityID string
	*jwx.TrustMarkDelegationSigner
	// contains filtered or unexported fields
}

TrustMarkOwner is a type describing the owning entity of a trust mark; it can be used to issue DelegationJWT

func NewTrustMarkOwner

func NewTrustMarkOwner(
	entityID string, signer *jwx.TrustMarkDelegationSigner, ownedTrustMarks []OwnedTrustMark,
) *TrustMarkOwner

NewTrustMarkOwner creates a new TrustMarkOwner

func (*TrustMarkOwner) AddTrustMark

func (tmo *TrustMarkOwner) AddTrustMark(spec OwnedTrustMark)

AddTrustMark adds a new OwnedTrustMark to the TrustMarkOwner

func (TrustMarkOwner) DelegationJWT

func (tmo TrustMarkOwner) DelegationJWT(trustMarkType, sub string, lifetime ...time.Duration) ([]byte, error)

DelegationJWT issues a DelegationJWT (as []byte) for the passed trust mark id and subject; optionally a custom lifetime can be passed

type TrustMarkOwnerSpec

type TrustMarkOwnerSpec struct {
	ID   string   `json:"sub" yaml:"entity_id"`
	JWKS jwx.JWKS `json:"jwks" yaml:"jwks"`
}

TrustMarkOwnerSpec describes the owner of a trust mark

func (*TrustMarkOwnerSpec) UnmarshalJSON

func (tmo *TrustMarkOwnerSpec) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface.

func (*TrustMarkOwnerSpec) UnmarshalMsgpack

func (tmo *TrustMarkOwnerSpec) UnmarshalMsgpack(data []byte) error

UnmarshalMsgpack implements the msgpack.Unmarshaler interface.

type TrustMarkOwners

type TrustMarkOwners map[string]TrustMarkOwnerSpec

TrustMarkOwners defines owners for TrustMarks

type TrustMarkSpec

type TrustMarkSpec struct {
	TrustMarkType string                  `json:"trust_mark_type" yaml:"trust_mark_type"`
	Lifetime      duration.DurationOption `json:"lifetime" yaml:"lifetime"`
	Ref           string                  `json:"ref" yaml:"ref"`
	LogoURI       string                  `json:"logo_uri" yaml:"logo_uri"`
	Extra         map[string]any          `json:"-" yaml:"-"`
	DelegationJWT string                  `json:"delegation_jwt" yaml:"delegation_jwt"`
}

TrustMarkSpec describes a TrustMark for a TrustMarkIssuer

func (TrustMarkSpec) MarshalJSON

func (tms TrustMarkSpec) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface

func (TrustMarkSpec) MarshalYAML

func (tms TrustMarkSpec) MarshalYAML() (any, error)

MarshalYAML implements the yaml.Marshaler interface

func (*TrustMarkSpec) UnmarshalJSON

func (tms *TrustMarkSpec) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface

func (*TrustMarkSpec) UnmarshalYAML

func (tms *TrustMarkSpec) UnmarshalYAML(data *yaml.Node) error

UnmarshalYAML implements the yaml.Unmarshaler interface

type TrustMarkSpecProvider added in v0.10.0

type TrustMarkSpecProvider interface {
	// GetTrustMarkSpec returns the TrustMarkSpec for the given trust mark type.
	// Returns nil if the trust mark type is not found.
	GetTrustMarkSpec(trustMarkType string) *TrustMarkSpec

	// TrustMarkTypes returns all available trust mark types.
	TrustMarkTypes() []string
}

TrustMarkSpecProvider provides TrustMarkSpecs dynamically. Implementations can fetch specs from config, database, or other sources. Implementations MUST be safe for concurrent use.

type TrustResolver

type TrustResolver struct {
	TrustAnchors   TrustAnchors
	StartingEntity string
	Types          []string

	TrustAnchorHintsMode TrustAnchorHintsMode
	// contains filtered or unexported fields
}

TrustResolver is type for resolving trust chains from a StartingEntity to one or multiple TrustAnchors

func (*TrustResolver) ResolveToValidChains

func (r *TrustResolver) ResolveToValidChains() TrustChains

ResolveToValidChains starts the trust chain resolution process, building an internal trust tree, verifies the signatures, integrity, expirations, and metadata policies and returns all possible valid TrustChains

func (*TrustResolver) ResolveToValidChainsWithoutVerifyingMetadata

func (r *TrustResolver) ResolveToValidChainsWithoutVerifyingMetadata() TrustChains

ResolveToValidChainsWithoutVerifyingMetadata starts the trust chain resolution process, building an internal trust tree, verifies the signatures, integrity, expirations, but not metadata policies and returns all possible valid TrustChains

type UIInfo

type UIInfo struct {
	DisplayName    string         `json:"display_name,omitempty"`
	Description    string         `json:"description,omitempty"`
	Keywords       []string       `json:"keywords,omitempty"`
	LogoURI        string         `json:"logo_uri,omitempty"`
	PolicyURI      string         `json:"policy_uri,omitempty"`
	InformationURI string         `json:"information_uri,omitempty"`
	Extra          map[string]any `json:"-"`
}

func (UIInfo) MarshalJSON

func (i UIInfo) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface

func (*UIInfo) UnmarshalJSON

func (i *UIInfo) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface

type VerifiedChainsEntityCollector

type VerifiedChainsEntityCollector struct{}

VerifiedChainsEntityCollector is an EntityCollector that compared to SimpleEntityCollector additionally verifies that there is a valid TrustChain between the entity and one of the specified trust anchors

func (VerifiedChainsEntityCollector) CollectEntities

CollectEntities implements the EntityCollector interface

Directories

Path Synopsis
examples
ta module
generators command
jwx
jwx

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL