service

package
v2.3.3 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2022 License: Apache-2.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TokenScopeKey    = "scope"
	TokenNicknameKey = "nickname"
	TokenNameKey     = "name"
	TokenPictureKey  = "picture"
)
View Source
const DefaultScope = "openid profile email offline_access r:* w:*"
View Source
const DeviceUserID = "1"

Variables

This section is empty.

Functions

func LoadPrivateKey

func LoadPrivateKey(path string) (interface{}, error)

func NewHTTP

func NewHTTP(requestHandler *RequestHandler) *http.Server

NewHTTP returns HTTP server

Types

type APIsConfig

type APIsConfig struct {
	HTTP listener.Config `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 AllowedGrantType

type AllowedGrantType string
const AllowedGrantType_AUTHORIZATION_CODE AllowedGrantType = "authorization_code"
const AllowedGrantType_CLIENT_CREDENTIALS AllowedGrantType = "client_credentials"
const AllowedGrantType_PASSWORD AllowedGrantType = "password"
const AllowedGrantType_REFRESH_TOKEN AllowedGrantType = "refresh_token"

type AsymmetricKey

type AsymmetricKey struct {
	PrivateFile string
	PublicFile  string
}

type Client

type Client struct {
	ID                              string        `yaml:"id"`
	ClientSecret                    string        `yaml:"secret"`
	AuthorizationCodeLifetime       time.Duration `yaml:"authorizationCodeLifetime"`
	AccessTokenLifetime             time.Duration `yaml:"accessTokenLifetime"`
	CodeRestrictionLifetime         time.Duration `yaml:"codeRestrictionLifetime"`
	RefreshTokenRestrictionLifetime time.Duration `yaml:"refreshTokenRestrictionLifetime"`
	ConsentScreenEnabled            bool          `yaml:"consentScreenEnabled"`
	RequireIssuedAuthorizationCode  bool          `yaml:"requireIssuedAuthorizationCode"`
	RequiredScope                   []string      `yaml:"requiredScope"`
	RequiredResponseType            string        `yaml:"requiredResponseType"`
	RequiredRedirectURI             string        `yaml:"requiredRedirectURI"`
}

func (*Client) Validate

func (c *Client) Validate() error

type ClientsConfig

type ClientsConfig []*Client

func (ClientsConfig) Find

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

type Config

type Config struct {
	Log         log.Config        `yaml:"log" json:"log"`
	APIs        APIsConfig        `yaml:"apis" json:"apis"`
	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 OAuthSignerConfig

type OAuthSignerConfig struct {
	IDTokenKeyFile     string        `yaml:"idTokenKeyFile" json:"idTokenKeyFile"`
	AccessTokenKeyFile string        `yaml:"accessTokenKeyFile" json:"accessTokenKeyFile"`
	Domain             string        `yaml:"domain" json:"domain"`
	Clients            ClientsConfig `yaml:"clients" json:"clients"`
}

func (*OAuthSignerConfig) Validate

func (c *OAuthSignerConfig) 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, idTokenKey *rsa.PrivateKey, accessTokenKey interface{}) (*RequestHandler, 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, logger log.Logger) (*Service, error)

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

func (*Service) Serve

func (s *Service) Serve() error

Serve starts the service's HTTP server and blocks

func (*Service) Shutdown

func (s *Service) Shutdown() error

Shutdown ends serving

Jump to

Keyboard shortcuts

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