idp

package
v4.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 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.8.0 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 constructs an http.Request for the GetOIDCDiscovery method

func NewGetOIDCJWKSRequest

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

NewGetOIDCJWKSRequest constructs an http.Request for the GetOIDCJWKS method

func NewGetPublicIdPOpenAPIJSONRequest

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

NewGetPublicIdPOpenAPIJSONRequest constructs an http.Request for the GetPublicIdPOpenAPIJSON method

func NewGetPublicIdPOpenAPIYAMLRequest

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

NewGetPublicIdPOpenAPIYAMLRequest constructs an http.Request for the GetPublicIdPOpenAPIYAML method

func NewGetSAMLMetadataRequest

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

NewGetSAMLMetadataRequest constructs an http.Request for the GetSAMLMetadata method

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)

GetOIDCDiscovery Get OIDC discovery metadata.

Corresponds with GET /.well-known/openid-configuration (the `GetOIDCDiscovery` operationId).

func (*Client) GetOIDCJWKS

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

GetOIDCJWKS Get the OIDC JSON Web Key Set.

Corresponds with GET /oidc/jwks (the `GetOIDCJWKS` operationId).

func (*Client) GetPublicIdPOpenAPIJSON

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

GetPublicIdPOpenAPIJSON Get the public IdP OpenAPI document as JSON.

Corresponds with GET /.well-known/openapi.json (the `GetPublicIdPOpenAPIJSON` operationId).

func (*Client) GetPublicIdPOpenAPIYAML

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

GetPublicIdPOpenAPIYAML Get the public IdP OpenAPI document as YAML.

Corresponds with GET /.well-known/openapi.yaml (the `GetPublicIdPOpenAPIYAML` operationId).

func (*Client) GetSAMLMetadata

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

GetSAMLMetadata Get SAML IdP metadata.

Corresponds with GET /saml/metadata (the `GetSAMLMetadata` operationId).

type ClientInterface

type ClientInterface interface {

	// GetPublicIdPOpenAPIJSON Get the public IdP OpenAPI document as JSON.
	//
	// Corresponds with GET /.well-known/openapi.json (the `GetPublicIdPOpenAPIJSON` operationId).
	GetPublicIdPOpenAPIJSON(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error)

	// GetPublicIdPOpenAPIYAML Get the public IdP OpenAPI document as YAML.
	//
	// Corresponds with GET /.well-known/openapi.yaml (the `GetPublicIdPOpenAPIYAML` operationId).
	GetPublicIdPOpenAPIYAML(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error)

	// GetOIDCDiscovery Get OIDC discovery metadata.
	//
	// Corresponds with GET /.well-known/openid-configuration (the `GetOIDCDiscovery` operationId).
	GetOIDCDiscovery(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error)

	// GetOIDCJWKS Get the OIDC JSON Web Key Set.
	//
	// Corresponds with GET /oidc/jwks (the `GetOIDCJWKS` operationId).
	GetOIDCJWKS(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error)

	// GetSAMLMetadata Get SAML IdP metadata.
	//
	// Corresponds with GET /saml/metadata (the `GetSAMLMetadata` operationId).
	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 Get OIDC discovery metadata.

Returns a wrapper object for the known response body format(s).

Corresponds with GET /.well-known/openid-configuration (the `GetOIDCDiscovery` operationId).

func (*ClientWithResponses) GetOIDCJWKSWithResponse

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

GetOIDCJWKSWithResponse Get the OIDC JSON Web Key Set.

Returns a wrapper object for the known response body format(s).

Corresponds with GET /oidc/jwks (the `GetOIDCJWKS` operationId).

func (*ClientWithResponses) GetPublicIdPOpenAPIJSONWithResponse

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

GetPublicIdPOpenAPIJSONWithResponse Get the public IdP OpenAPI document as JSON.

Returns a wrapper object for the known response body format(s).

Corresponds with GET /.well-known/openapi.json (the `GetPublicIdPOpenAPIJSON` operationId).

func (*ClientWithResponses) GetPublicIdPOpenAPIYAMLWithResponse

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

GetPublicIdPOpenAPIYAMLWithResponse Get the public IdP OpenAPI document as YAML.

Returns a wrapper object for the known response body format(s).

Corresponds with GET /.well-known/openapi.yaml (the `GetPublicIdPOpenAPIYAML` operationId).

func (*ClientWithResponses) GetSAMLMetadataWithResponse

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

GetSAMLMetadataWithResponse Get SAML IdP metadata.

Returns a wrapper object for the known response body format(s).

Corresponds with GET /saml/metadata (the `GetSAMLMetadata` operationId).

type ClientWithResponsesInterface

type ClientWithResponsesInterface interface {

	// GetPublicIdPOpenAPIJSONWithResponse Get the public IdP OpenAPI document as JSON.
	//
	// Returns a wrapper object for the known response body format(s).
	//
	// Corresponds with GET /.well-known/openapi.json (the `GetPublicIdPOpenAPIJSON` operationId).
	GetPublicIdPOpenAPIJSONWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetPublicIdPOpenAPIJSONResponse, error)

	// GetPublicIdPOpenAPIYAMLWithResponse Get the public IdP OpenAPI document as YAML.
	//
	// Returns a wrapper object for the known response body format(s).
	//
	// Corresponds with GET /.well-known/openapi.yaml (the `GetPublicIdPOpenAPIYAML` operationId).
	GetPublicIdPOpenAPIYAMLWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetPublicIdPOpenAPIYAMLResponse, error)

	// GetOIDCDiscoveryWithResponse Get OIDC discovery metadata.
	//
	// Returns a wrapper object for the known response body format(s).
	//
	// Corresponds with GET /.well-known/openid-configuration (the `GetOIDCDiscovery` operationId).
	GetOIDCDiscoveryWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetOIDCDiscoveryResponse, error)

	// GetOIDCJWKSWithResponse Get the OIDC JSON Web Key Set.
	//
	// Returns a wrapper object for the known response body format(s).
	//
	// Corresponds with GET /oidc/jwks (the `GetOIDCJWKS` operationId).
	GetOIDCJWKSWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetOIDCJWKSResponse, error)

	// GetSAMLMetadataWithResponse Get SAML IdP metadata.
	//
	// Returns a wrapper object for the known response body format(s).
	//
	// Corresponds with GET /saml/metadata (the `GetSAMLMetadata` operationId).
	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 the response for an HTTP 200 `application/json` 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) GetBody

func (r GetOIDCDiscoveryResponse) GetBody() []byte

GetBody returns the raw response body bytes

func (GetOIDCDiscoveryResponse) GetJSON200

func (r GetOIDCDiscoveryResponse) GetJSON200() *OIDCDiscovery

GetJSON200 returns the response for an HTTP 200 `application/json` response

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 the response for an HTTP 200 `application/json` 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) GetBody

func (r GetOIDCJWKSResponse) GetBody() []byte

GetBody returns the raw response body bytes

func (GetOIDCJWKSResponse) GetJSON200

func (r GetOIDCJWKSResponse) GetJSON200() *JWKS

GetJSON200 returns the response for an HTTP 200 `application/json` response

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 the response for an HTTP 200 `application/json` 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) GetBody

func (r GetPublicIdPOpenAPIJSONResponse) GetBody() []byte

GetBody returns the raw response body bytes

func (GetPublicIdPOpenAPIJSONResponse) GetJSON200

func (r GetPublicIdPOpenAPIJSONResponse) GetJSON200() *map[string]interface{}

GetJSON200 returns the response for an HTTP 200 `application/json` response

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 the response for an HTTP 200 `application/yaml` 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) GetBody

func (r GetPublicIdPOpenAPIYAMLResponse) GetBody() []byte

GetBody returns the raw response body bytes

func (GetPublicIdPOpenAPIYAMLResponse) GetYAML200

func (r GetPublicIdPOpenAPIYAMLResponse) GetYAML200() *string

GetYAML200 returns the response for an HTTP 200 `application/yaml` response

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 the response for an HTTP 200 `application/xml` 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) GetBody

func (r GetSAMLMetadataResponse) GetBody() []byte

GetBody returns the raw response body bytes

func (GetSAMLMetadataResponse) GetXML200

func (r GetSAMLMetadataResponse) GetXML200() *string

GetXML200 returns the response for an HTTP 200 `application/xml` response

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"`
	RegistrationEndpoint                               *string                `json:"registration_endpoint,omitempty"`
	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