idp

package
v3.1.0-rc.3 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2026 License: GPL-3.0 Imports: 9 Imported by: 0

README

OpenAPI IdP Client

This package contains a narrow generated Go client for public IdP OpenAPI surfaces where generated code adds contract confidence without replacing protocol-specific test clients. The source contract is server/openapi/idp.yaml, and generation is limited by server/openapi/oapi-idp-client.yaml to public OpenAPI export, OIDC discovery, JWKS, and SAML metadata endpoints.

The production-supported boundary for downstream callers is server/openapi/client. Use this generated package for the DTOs and generated response wrappers that boundary exposes.

The generated files are committed so normal builds do not require generator access at compile time.

Generator

This package is generated with:

github.com/oapi-codegen/oapi-codegen/v2/cmd/oapi-codegen v2.7.0

The project keeps the generator as a vendored tool dependency. Token exchange, browser login, SAML SSO/SLO, and WebAuthn flows stay covered by manually crafted clients and focused tests because those flows need protocol-realistic behavior.

Regenerating

From the repository root:

make generate-openapi-bindings

The package-local go:generate directive is equivalent:

go generate ./server/openapi/generated/idp

Check that committed generated files are in sync:

make generate-openapi-bindings-check

After regenerating, run:

GOEXPERIMENT=runtimesecret GOCACHE=/tmp/nauthilus-go-cache go test ./server/openapi ./server/openapi/generated/idp
GOEXPERIMENT=runtimesecret GOCACHE=/tmp/nauthilus-go-cache make guardrails

Documentation

Overview

Package idp provides primitives to interact with the openapi HTTP API.

Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.7.2 DO NOT EDIT.

Package idp contains a narrow generated OpenAPI client for public IDP discovery surfaces.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewGetOIDCDiscoveryRequest

func NewGetOIDCDiscoveryRequest(server string) (*http.Request, error)

NewGetOIDCDiscoveryRequest generates requests for GetOIDCDiscovery

func NewGetOIDCJWKSRequest

func NewGetOIDCJWKSRequest(server string) (*http.Request, error)

NewGetOIDCJWKSRequest generates requests for GetOIDCJWKS

func NewGetPublicIdPOpenAPIJSONRequest

func NewGetPublicIdPOpenAPIJSONRequest(server string) (*http.Request, error)

NewGetPublicIdPOpenAPIJSONRequest generates requests for GetPublicIdPOpenAPIJSON

func NewGetPublicIdPOpenAPIYAMLRequest

func NewGetPublicIdPOpenAPIYAMLRequest(server string) (*http.Request, error)

NewGetPublicIdPOpenAPIYAMLRequest generates requests for GetPublicIdPOpenAPIYAML

func NewGetSAMLMetadataRequest

func NewGetSAMLMetadataRequest(server string) (*http.Request, error)

NewGetSAMLMetadataRequest generates requests for GetSAMLMetadata

Types

type Client

type Client struct {
	// The endpoint of the server conforming to this interface, with scheme,
	// https://api.deepmap.com for example. This can contain a path relative
	// to the server, such as https://api.deepmap.com/dev-test, and all the
	// paths in the swagger spec will be appended to the server.
	Server string

	// Doer for performing requests, typically a *http.Client with any
	// customized settings, such as certificate chains.
	Client HttpRequestDoer

	// A list of callbacks for modifying requests which are generated before sending over
	// the network.
	RequestEditors []RequestEditorFn
}

Client which conforms to the OpenAPI3 specification for this service.

func NewClient

func NewClient(server string, opts ...ClientOption) (*Client, error)

Creates a new Client, with reasonable defaults

func (*Client) GetOIDCDiscovery

func (c *Client) GetOIDCDiscovery(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) GetOIDCJWKS

func (c *Client) GetOIDCJWKS(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) GetPublicIdPOpenAPIJSON

func (c *Client) GetPublicIdPOpenAPIJSON(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) GetPublicIdPOpenAPIYAML

func (c *Client) GetPublicIdPOpenAPIYAML(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) GetSAMLMetadata

func (c *Client) GetSAMLMetadata(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error)

type ClientInterface

type ClientInterface interface {
	// GetPublicIdPOpenAPIJSON request
	GetPublicIdPOpenAPIJSON(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error)

	// GetPublicIdPOpenAPIYAML request
	GetPublicIdPOpenAPIYAML(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error)

	// GetOIDCDiscovery request
	GetOIDCDiscovery(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error)

	// GetOIDCJWKS request
	GetOIDCJWKS(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error)

	// GetSAMLMetadata request
	GetSAMLMetadata(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error)
}

The interface specification for the client above.

type ClientOption

type ClientOption func(*Client) error

ClientOption allows setting custom parameters during construction

func WithBaseURL

func WithBaseURL(baseURL string) ClientOption

WithBaseURL overrides the baseURL.

func WithHTTPClient

func WithHTTPClient(doer HttpRequestDoer) ClientOption

WithHTTPClient allows overriding the default Doer, which is automatically created using http.Client. This is useful for tests.

func WithRequestEditorFn

func WithRequestEditorFn(fn RequestEditorFn) ClientOption

WithRequestEditorFn allows setting up a callback function, which will be called right before sending the request. This can be used to mutate the request.

type ClientWithResponses

type ClientWithResponses struct {
	ClientInterface
}

ClientWithResponses builds on ClientInterface to offer response payloads

func NewClientWithResponses

func NewClientWithResponses(server string, opts ...ClientOption) (*ClientWithResponses, error)

NewClientWithResponses creates a new ClientWithResponses, which wraps Client with return type handling

func (*ClientWithResponses) GetOIDCDiscoveryWithResponse

func (c *ClientWithResponses) GetOIDCDiscoveryWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetOIDCDiscoveryResponse, error)

GetOIDCDiscoveryWithResponse request returning *GetOIDCDiscoveryResponse

func (*ClientWithResponses) GetOIDCJWKSWithResponse

func (c *ClientWithResponses) GetOIDCJWKSWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetOIDCJWKSResponse, error)

GetOIDCJWKSWithResponse request returning *GetOIDCJWKSResponse

func (*ClientWithResponses) GetPublicIdPOpenAPIJSONWithResponse

func (c *ClientWithResponses) GetPublicIdPOpenAPIJSONWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetPublicIdPOpenAPIJSONResponse, error)

GetPublicIdPOpenAPIJSONWithResponse request returning *GetPublicIdPOpenAPIJSONResponse

func (*ClientWithResponses) GetPublicIdPOpenAPIYAMLWithResponse

func (c *ClientWithResponses) GetPublicIdPOpenAPIYAMLWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetPublicIdPOpenAPIYAMLResponse, error)

GetPublicIdPOpenAPIYAMLWithResponse request returning *GetPublicIdPOpenAPIYAMLResponse

func (*ClientWithResponses) GetSAMLMetadataWithResponse

func (c *ClientWithResponses) GetSAMLMetadataWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetSAMLMetadataResponse, error)

GetSAMLMetadataWithResponse request returning *GetSAMLMetadataResponse

type ClientWithResponsesInterface

type ClientWithResponsesInterface interface {
	// GetPublicIdPOpenAPIJSONWithResponse request
	GetPublicIdPOpenAPIJSONWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetPublicIdPOpenAPIJSONResponse, error)

	// GetPublicIdPOpenAPIYAMLWithResponse request
	GetPublicIdPOpenAPIYAMLWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetPublicIdPOpenAPIYAMLResponse, error)

	// GetOIDCDiscoveryWithResponse request
	GetOIDCDiscoveryWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetOIDCDiscoveryResponse, error)

	// GetOIDCJWKSWithResponse request
	GetOIDCJWKSWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetOIDCJWKSResponse, error)

	// GetSAMLMetadataWithResponse request
	GetSAMLMetadataWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetSAMLMetadataResponse, error)
}

ClientWithResponsesInterface is the interface specification for the client with responses above.

type GetOIDCDiscoveryResponse

type GetOIDCDiscoveryResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSON200      *OIDCDiscovery
}

func ParseGetOIDCDiscoveryResponse

func ParseGetOIDCDiscoveryResponse(rsp *http.Response) (*GetOIDCDiscoveryResponse, error)

ParseGetOIDCDiscoveryResponse parses an HTTP response from a GetOIDCDiscoveryWithResponse call

func (GetOIDCDiscoveryResponse) ContentType

func (r GetOIDCDiscoveryResponse) ContentType() string

ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers

func (GetOIDCDiscoveryResponse) Status

func (r GetOIDCDiscoveryResponse) Status() string

Status returns HTTPResponse.Status

func (GetOIDCDiscoveryResponse) StatusCode

func (r GetOIDCDiscoveryResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type GetOIDCJWKSResponse

type GetOIDCJWKSResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSON200      *JWKS
}

func ParseGetOIDCJWKSResponse

func ParseGetOIDCJWKSResponse(rsp *http.Response) (*GetOIDCJWKSResponse, error)

ParseGetOIDCJWKSResponse parses an HTTP response from a GetOIDCJWKSWithResponse call

func (GetOIDCJWKSResponse) ContentType

func (r GetOIDCJWKSResponse) ContentType() string

ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers

func (GetOIDCJWKSResponse) Status

func (r GetOIDCJWKSResponse) Status() string

Status returns HTTPResponse.Status

func (GetOIDCJWKSResponse) StatusCode

func (r GetOIDCJWKSResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type GetPublicIdPOpenAPIJSONResponse

type GetPublicIdPOpenAPIJSONResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSON200      *map[string]interface{}
}

func ParseGetPublicIdPOpenAPIJSONResponse

func ParseGetPublicIdPOpenAPIJSONResponse(rsp *http.Response) (*GetPublicIdPOpenAPIJSONResponse, error)

ParseGetPublicIdPOpenAPIJSONResponse parses an HTTP response from a GetPublicIdPOpenAPIJSONWithResponse call

func (GetPublicIdPOpenAPIJSONResponse) ContentType

func (r GetPublicIdPOpenAPIJSONResponse) ContentType() string

ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers

func (GetPublicIdPOpenAPIJSONResponse) Status

Status returns HTTPResponse.Status

func (GetPublicIdPOpenAPIJSONResponse) StatusCode

func (r GetPublicIdPOpenAPIJSONResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type GetPublicIdPOpenAPIYAMLResponse

type GetPublicIdPOpenAPIYAMLResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	YAML200      *string
}

func ParseGetPublicIdPOpenAPIYAMLResponse

func ParseGetPublicIdPOpenAPIYAMLResponse(rsp *http.Response) (*GetPublicIdPOpenAPIYAMLResponse, error)

ParseGetPublicIdPOpenAPIYAMLResponse parses an HTTP response from a GetPublicIdPOpenAPIYAMLWithResponse call

func (GetPublicIdPOpenAPIYAMLResponse) ContentType

func (r GetPublicIdPOpenAPIYAMLResponse) ContentType() string

ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers

func (GetPublicIdPOpenAPIYAMLResponse) Status

Status returns HTTPResponse.Status

func (GetPublicIdPOpenAPIYAMLResponse) StatusCode

func (r GetPublicIdPOpenAPIYAMLResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type GetSAMLMetadataResponse

type GetSAMLMetadataResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	XML200       *string
}

func ParseGetSAMLMetadataResponse

func ParseGetSAMLMetadataResponse(rsp *http.Response) (*GetSAMLMetadataResponse, error)

ParseGetSAMLMetadataResponse parses an HTTP response from a GetSAMLMetadataWithResponse call

func (GetSAMLMetadataResponse) ContentType

func (r GetSAMLMetadataResponse) ContentType() string

ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers

func (GetSAMLMetadataResponse) Status

func (r GetSAMLMetadataResponse) Status() string

Status returns HTTPResponse.Status

func (GetSAMLMetadataResponse) StatusCode

func (r GetSAMLMetadataResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type HttpRequestDoer

type HttpRequestDoer interface {
	Do(req *http.Request) (*http.Response, error)
}

Doer performs HTTP requests.

The standard http.Client implements this interface.

type JWKS

type JWKS struct {
	Keys []map[string]interface{} `json:"keys"`
}

JWKS defines model for JWKS.

type OIDCDiscovery

type OIDCDiscovery struct {
	AuthorizationEndpoint                              string                 `json:"authorization_endpoint"`
	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"`
	Issuer                                             string                 `json:"issuer"`
	JwksUri                                            string                 `json:"jwks_uri"`
	TokenEndpoint                                      string                 `json:"token_endpoint"`
	TokenEndpointAuthMethodsSupported                  *[]string              `json:"token_endpoint_auth_methods_supported,omitempty"`
	TokenEndpointAuthSigningAlgValuesSupported         *[]string              `json:"token_endpoint_auth_signing_alg_values_supported,omitempty"`
	UserinfoEndpoint                                   *string                `json:"userinfo_endpoint,omitempty"`
	AdditionalProperties                               map[string]interface{} `json:"-"`
}

OIDCDiscovery defines model for OIDCDiscovery.

func (OIDCDiscovery) Get

func (a OIDCDiscovery) Get(fieldName string) (value interface{}, found bool)

Getter for additional properties for OIDCDiscovery. Returns the specified element and whether it was found

func (OIDCDiscovery) MarshalJSON

func (a OIDCDiscovery) MarshalJSON() ([]byte, error)

Override default JSON handling for OIDCDiscovery to handle AdditionalProperties

func (*OIDCDiscovery) Set

func (a *OIDCDiscovery) Set(fieldName string, value interface{})

Setter for additional properties for OIDCDiscovery

func (*OIDCDiscovery) UnmarshalJSON

func (a *OIDCDiscovery) UnmarshalJSON(b []byte) error

Override default JSON handling for OIDCDiscovery to handle AdditionalProperties

type RequestEditorFn

type RequestEditorFn func(ctx context.Context, req *http.Request) error

RequestEditorFn is the function signature for the RequestEditor callback function

Jump to

Keyboard shortcuts

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