Versions in this module Expand all Collapse all v0 v0.1.1 Jun 21, 2026 Changes in this version + const ErrCodeInvalidClient + const ErrCodeInvalidGrant + const ErrCodeInvalidRequest + const ErrCodeInvalidScope + const ErrCodeInvalidTarget + const ErrCodeUnauthorizedClient + const ErrCodeUnsupportedGrantType + const FieldAccessToken + const FieldExpiresIn + const FieldIssuedTokenType + const FieldRefreshToken + const FieldScope + const FieldTokenType + const GrantTypeTokenExchange + const ParamActorToken + const ParamActorTokenType + const ParamAudience + const ParamGrantType + const ParamRequestedTokenType + const ParamResource + const ParamScope + const ParamSubjectToken + const ParamSubjectTokenType + const SpecVersion + const TokenTypeAccessToken + const TokenTypeIDToken + const TokenTypeJWT + const TokenTypeRefreshToken + const TokenTypeSAML1 + const TokenTypeSAML2 + var ErrInvalidGrantType = errors.New("tokenexchange: grant_type is not the token-exchange grant") + var ErrTokenTypeReserved = errors.New("tokenexchange: token-type URI is reserved by RFC 8693") + var ErrUnknownTokenType = errors.New("tokenexchange: token-type URI is not registered") + func BuiltinTokenTypes() []string + func IsRegisteredTokenType(uri string) bool + func RegisterTokenType(uri string) error + func WriteTokenExchangeError(w http.ResponseWriter, e *TokenExchangeError) error + func WriteTokenExchangeResponse(w http.ResponseWriter, resp *TokenExchangeResponse) error + type Client interface + Exchange func(ctx context.Context, req *TokenExchangeRequest) (*TokenExchangeResponse, error) + func NewClient(tokenEndpoint string, opts ...Option) Client + type Option func(*httpClient) + func WithHTTPClient(hc *http.Client) Option + type TokenExchangeError struct + Code string + Description string + URI string + func (e *TokenExchangeError) Error() string + func (e *TokenExchangeError) Is(target error) bool + func (e *TokenExchangeError) Unwrap() error + func (e *TokenExchangeError) WithCause(cause error) *TokenExchangeError + type TokenExchangeRequest struct + ActorToken string + ActorTokenType string + Audience []string + Extra url.Values + GrantType string + RequestedTokenType string + Resource []string + Scope []string + SubjectToken string + SubjectTokenType string + func ParseTokenExchangeRequest(r *http.Request) (*TokenExchangeRequest, error) + func (r *TokenExchangeRequest) Encode() url.Values + func (r *TokenExchangeRequest) RequestedOrSubjectTokenType() string + func (r *TokenExchangeRequest) Validate() error + type TokenExchangeResponse struct + AccessToken string + ExpiresIn int + Extra map[string]json.RawMessage + IssuedTokenType string + RefreshToken string + Scope string + TokenType string + func (r *TokenExchangeResponse) UnmarshalJSON(data []byte) error + func (r *TokenExchangeResponse) Validate() error + func (r TokenExchangeResponse) MarshalJSON() ([]byte, error) + type UnknownTokenType struct + URI string + func (u UnknownTokenType) String() string + type ValidationError struct + Parameter string + Reason string + Rule string + func (e *ValidationError) Error() string + func (e *ValidationError) Is(target error) bool v0.1.0 May 26, 2026