config

package
v0.0.0-...-f2ba1b1 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const SERVICES_PATH = "service"
View Source
const SERVICE_DEFAULT_SCOPE = ""

Variables

View Source
var ErrorCcsEmptyResponse = errors.New("empty_response_from_ccs")
View Source
var ErrorCcsErrorResponse = errors.New("error_response_from_ccs")
View Source
var ErrorCcsNoResponse = errors.New("no_response_from_ccs")

Functions

This section is empty.

Types

type ConfigClient

type ConfigClient interface {
	GetServices() (services []ConfiguredService, err error)
}

func NewCCSHttpClient

func NewCCSHttpClient(configEndpoint string) (client ConfigClient, err error)

type ConfigRepo

type ConfigRepo struct {
	// url of the configuration service to be used
	ConfigEndpoint string `mapstructure:"configEndpoint"`
	// statically configured services with their trust anchors and scopes.
	Services       []ConfiguredService `mapstructure:"services"`
	UpdateInterval int64               `mapstructure:"updateInterval" default:"30"`
}

type Configuration

type Configuration struct {
	Server     Server     `mapstructure:"server"`
	Verifier   Verifier   `mapstructure:"verifier"`
	Logging    Logging    `mapstructure:"logging"`
	ConfigRepo ConfigRepo `mapstructure:"configRepo"`
	M2M        M2M        `mapstructure:"m2m"`
}

general structure of the configuration file

func ReadConfig

func ReadConfig(configFile string) (configuration Configuration, err error)

read the config from the config file

type ConfiguredService

type ConfiguredService struct {
	// Default OIDC scope to be used if none is specified
	DefaultOidcScope string                  `json:"defaultOidcScope" mapstructure:"defaultOidcScope"`
	ServiceScopes    map[string][]Credential `json:"oidcScopes" mapstructure:"oidcScopes"`
	Id               string                  `json:"id" mapstructure:"id"`
}

func (ConfiguredService) GetCredential

func (cs ConfiguredService) GetCredential(scope, credentialType string) (Credential, bool)

func (ConfiguredService) GetCredentials

func (cs ConfiguredService) GetCredentials(scope string) []Credential

func (ConfiguredService) GetRequiredCredentialTypes

func (cs ConfiguredService) GetRequiredCredentialTypes(scope string) []string

type Credential

type Credential struct {
	// Type of the credential
	Type string `json:"type" mapstructure:"type"`
	// A list of (EBSI Trusted Issuers Registry compatible) endpoints to  retrieve the trusted participants from.
	TrustedParticipantsLists []string `json:"trustedParticipantsLists,omitempty" mapstructure:"trustedParticipantsLists,omitempty"`
	// A list of (EBSI Trusted Issuers Registry compatible) endpoints to  retrieve the trusted issuers from. The attributes need to be formated to comply with the verifiers requirements.
	TrustedIssuersLists []string `json:"trustedIssuersLists,omitempty" mapstructure:"trustedIssuersLists,omitempty"`
}

type HttpClient

type HttpClient interface {
	Get(url string) (resp *http.Response, err error)
}

type HttpConfigClient

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

func (HttpConfigClient) GetServices

func (hcc HttpConfigClient) GetServices() (services []ConfiguredService, err error)

type Logging

type Logging struct {
	// loglevel to be used - can be DEBUG, INFO, WARN or ERROR
	Level string `mapstructure:"level" default:"INFO"`
	// should the logging in a structured json format
	JsonLogging bool `mapstructure:"jsonLogging" default:"true"`
	// should requests be logged
	LogRequests bool `mapstructure:"logRequests" default:"true"`
	// list of paths to be ignored on request logging(could be often called operational endpoints like f.e. metrics)
	PathsToSkip []string `mapstructure:"pathsToSkip"`
}

logging config

type M2M

type M2M struct {
	// auth enabled for M2M interactions
	AuthEnabled bool `mapstructure:"authEnabled"`
	// path to the signing key(in pem format)
	KeyPath string `mapstructure:"keyPath"`
	// path to the credential to be used for auth
	CredentialPath string `mapstructure:"credentialPath"`
	// id of the verifier when retrieving tokens
	ClientId string `mapstructure:"clientId"`
	// verification method to be provided for the ld-proof
	VerificationMethod string `mapstructure:"verificationMethod" default:"JsonWebKey2020"`
	// signature type to be provided for the ld-proof
	SignatureType string `mapstructure:"signatureType" default:"JsonWebSignature2020"`
	// type of the provided key
	KeyType string `mapstructure:"keyType" default:"RSAPS256"`
}

configuration for M2M interaction

type Policies

type Policies struct {
	// policies that all credentials are checked against
	DefaultPolicies PolicyMap `mapstructure:"default"`
	// policies that used to check specific credential types. Key maps to the "credentialSubject.type" of the credential
	CredentialTypeSpecificPolicies map[string]PolicyMap `mapstructure:"credentialTypeSpecific"`
}

type PolicyConfigParameters

type PolicyConfigParameters map[string]interface{}

type PolicyMap

type PolicyMap map[string]PolicyConfigParameters

type Server

type Server struct {
	// host name of the verifier
	Host string `mapstructure:"host"`
	// port to bind the server
	Port int `mapstructure:"port" default:"8080"`
	// directory to read the template(s) from
	TemplateDir string `mapstructure:"templateDir" default:"views/"`
	// directory of static files to be provided, f.e. to be used inside the templates
	StaticDir string `mapstructure:"staticDir" default:"views/static/"`
}

general configuration to run the application

type ServicesResponse

type ServicesResponse struct {
	Total      int                 `json:"total"`
	PageNumber int                 `json:"pageNumber"`
	PageSize   int                 `json:"pageSize"`
	Services   []ConfiguredService `json:"services"`
}

type Verifier

type Verifier struct {
	// did to be used by the verifier
	Did string `mapstructure:"did"`
	// address of the (ebsi-compatible) trusted-issuers-registry for verifying the issuer
	TirAddress string `mapstructure:"tirAddress"`
	// expiry of auth sessions
	SessionExpiry int `mapstructure:"sessionExpiry" default:"30"`
	// policies that shall be checked
	PolicyConfig Policies `mapstructure:"policies"`
	// Validation mode for validating the vcs. Does not touch verification, just content validation.
	// applicable modes:
	// * `none`: No validation, just swallow everything
	// * `combined`: ld and schema validation
	// * `jsonLd`: uses JSON-LD parser for validation
	// * `baseContext`: validates that only the fields and values (when applicable)are present in the document. No extra fields are allowed (outside of credentialSubject).
	// Default is set to `none` to ensure backwards compatibility
	ValidationMode string `mapstructure:"validationMode" default:"none"`
}

configuration specific to the functionality of the verifier

Jump to

Keyboard shortcuts

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