nuts

package
v0.1.7 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2024 License: GPL-3.0 Imports: 13 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNutsNodeUnreachable = errors.New("nuts node unreachable")

Functions

func ParseResponse added in v0.1.3

func ParseResponse[T any](err error, httpResponse *http.Response, fn func(rsp *http.Response) (*T, error)) (*T, error)

func UnwrapAPIError added in v0.1.3

func UnwrapAPIError(err error) error

func WithAdditionalCredentials

func WithAdditionalCredentials(ctx context.Context, credentials []vc.VerifiableCredential) context.Context

WithAdditionalCredentials returns a new context with the additional credentials set. They will be provided to the Nuts node when requesting the service access token.

Types

type CredentialProvider

type CredentialProvider interface {
	Credentials() []vc.VerifiableCredential
}

type EmployeeDetails

type EmployeeDetails struct {
	Id   string
	Name string
	Role string
}

func (EmployeeDetails) Credentials

func (e EmployeeDetails) Credentials() []vc.VerifiableCredential

type OAuth2TokenSource

type OAuth2TokenSource struct {
	NutsSubject string
	// NutsAPIURL is the base URL of the Nuts node API.
	NutsAPIURL string
	// NutsHttpClient is the HTTP client used to communicate with the Nuts node.
	// If not set, http.DefaultClient is used.
	NutsHttpClient *http.Client
}

func TokenSource

func TokenSource(nutsAPIURL string, ownDID string) *OAuth2TokenSource

TokenSource returns an oauth2.TokenSource that authenticates to the OAuth2 remote Resource Server with Nuts OAuth2 access tokens. It only supports service access tokens (client credentials flow, no OpenID4VP) at the moment. It will use the API of a local Nuts node to request the access token.

func (OAuth2TokenSource) Token

func (o OAuth2TokenSource) Token(httpRequest *http.Request, authzServerURL *url.URL, scope string) (*oauth2.Token, error)

Directories

Path Synopsis
Package common provides primitives to interact with the openapi HTTP API.
Package common provides primitives to interact with the openapi HTTP API.
Package discovery provides primitives to interact with the openapi HTTP API.
Package discovery provides primitives to interact with the openapi HTTP API.
Package iam provides primitives to interact with the openapi HTTP API.
Package iam provides primitives to interact with the openapi HTTP API.
Package vcr provides primitives to interact with the openapi HTTP API.
Package vcr provides primitives to interact with the openapi HTTP API.
Package vdr provides primitives to interact with the openapi HTTP API.
Package vdr provides primitives to interact with the openapi HTTP API.

Jump to

Keyboard shortcuts

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