service

package
v2.21.3 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2024 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadPrivateKey

func LoadPrivateKey(path urischeme.URIScheme) (interface{}, error)

func NewHTTP

func NewHTTP(requestHandler *RequestHandler, logger log.Logger) http.Handler

NewHTTP returns HTTP handler

Types

type APIsConfig

type APIsConfig struct {
	HTTP HTTPConfig `yaml:"http" json:"http"`
}

Config represent application configuration

func (*APIsConfig) Validate

func (c *APIsConfig) Validate() error

type AccessTokenType

type AccessTokenType string
const AccessTokenType_JWT AccessTokenType = "jwt"

type AsymmetricKey

type AsymmetricKey struct {
	PrivateFile string
	PublicFile  string
}

type Client

type Client struct {
	ID                  string                 `yaml:"id"`
	SecretFile          urischeme.URIScheme    `yaml:"secretFile"`
	AccessTokenLifetime time.Duration          `yaml:"accessTokenLifetime"`
	AllowedGrantTypes   []GrantType            `yaml:"allowedGrantTypes"`
	AllowedAudiences    []string               `yaml:"allowedAudiences"`
	AllowedScopes       []string               `yaml:"allowedScopes"`
	JWTPrivateKey       PrivateKeyJWTConfig    `yaml:"jwtPrivateKey"`
	InsertTokenClaims   map[string]interface{} `yaml:"insertTokenClaims"`
	// contains filtered or unexported fields
}

func (*Client) Validate

func (c *Client) Validate() error

type ClientsConfig

type ClientsConfig struct {
	OpenTelemetryCollector http.OpenTelemetryCollectorConfig `yaml:"openTelemetryCollector" json:"openTelemetryCollector"`
}

func (*ClientsConfig) Validate

func (c *ClientsConfig) Validate() error

type Config

type Config struct {
	Log         log.Config        `yaml:"log" json:"log"`
	APIs        APIsConfig        `yaml:"apis" json:"apis"`
	Clients     ClientsConfig     `yaml:"clients" json:"clients"`
	OAuthSigner OAuthSignerConfig `yaml:"oauthSigner" json:"oauthSigner"`
}

Config represents application configuration

func (Config) String

func (c Config) String() string

func (*Config) Validate

func (c *Config) Validate() error

type GrantType

type GrantType string
const (
	GrantTypeClientCredentials GrantType = "client_credentials"
)

type HTTPConfig

type HTTPConfig struct {
	Connection listener.Config `yaml:",inline" json:",inline"`
	Server     server.Config   `yaml:",inline" json:",inline"`
}

func (*HTTPConfig) Validate

func (c *HTTPConfig) Validate() error

type OAuthClientsConfig

type OAuthClientsConfig []*Client

func (OAuthClientsConfig) Find

func (c OAuthClientsConfig) Find(id string) *Client

type OAuthSignerConfig

type OAuthSignerConfig struct {
	PrivateKeyFile urischeme.URIScheme `yaml:"privateKeyFile" json:"privateKeyFile"`
	Domain         string              `yaml:"domain" json:"domain"`
	OwnerClaim     string              `yaml:"ownerClaim" json:"ownerClaim"`
	DeviceIDClaim  string              `yaml:"deviceIDClaim" json:"deviceIDClaim"`
	Clients        OAuthClientsConfig  `yaml:"clients" json:"clients"`
}

func (*OAuthSignerConfig) Validate

func (c *OAuthSignerConfig) Validate() error

type PrivateKeyJWTConfig

type PrivateKeyJWTConfig struct {
	Enabled       bool             `yaml:"enabled"`
	Authorization validator.Config `yaml:"authorization,omitempty"`
}

func (*PrivateKeyJWTConfig) Validate

func (c *PrivateKeyJWTConfig) Validate() error

type RequestHandler

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

RequestHandler for handling incoming request

func NewRequestHandler

func NewRequestHandler(ctx context.Context, config *Config, accessTokenKey interface{}, fileWatcher *fsnotify.Watcher, logger log.Logger, tracerProvider trace.TracerProvider) (*RequestHandler, func(), error)

NewRequestHandler factory for new RequestHandler

type Service

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

Server handle HTTP request

func New

func New(ctx context.Context, config Config, fileWatcher *fsnotify.Watcher, logger log.Logger) (*Service, error)

New parses configuration and creates new Server with provided store and bus

func (*Service) Close

func (s *Service) Close() error

Shutdown ends serving

func (*Service) Serve

func (s *Service) Serve() error

Serve starts the service's HTTP server and blocks

Jump to

Keyboard shortcuts

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