config

package
v0.0.0-...-0fc1b25 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2021 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAuthStackCfg

GetAuthStackCfg read config file at then return clients to interact Kratos public, Hydra public, Hydra admin.

Types

type Config

type Config struct {
	Env     string       `json:"env"`
	BaseURL string       `json:"baseUrl"`
	Kratos  KratosConfig `json:"kratos"`
	Hydra   HydraConfig  `json:"hydra"`
	Log     LogConfig    `json:"log"`
}
var Cfg Config

func (Config) GetBrowserAuthCodeURL

func (h Config) GetBrowserAuthCodeURL() (url, state string)

GetBrowserAuthCodeURL generate authentication URL from Hydra client config This URL is used to init AuthZ code login flow. Docs: https://www.ory.sh/hydra/docs/concepts/login/ In case we have a list of callback URLs, this function will use the first URL in the array.

func (*Config) GetHydraOauth2Config

func (h *Config) GetHydraOauth2Config() *hydraModels.OAuth2Client

GetHydraOauth2Config take config from file then return *hydraModels.OAuth2Client Currently, we use this result to register an Oauth2 client in Hydra.

func (*Config) GetInternalHydraOAuth2Config

func (h *Config) GetInternalHydraOAuth2Config() oauth2.Config

GetInternalHydraOAuth2Config is used to export oauth2 config for internal purpose, for example: exchange token. In case we have a list of callback URLs, this function will use the first URL in the array.

type HydraClient

type HydraClient struct {
	ID            string   `json:"id"`
	Secret        string   `json:"secret"`
	GrantTypes    []string `json:"grantTypes"`
	ResponseTypes []string `json:"responseTypes"`
	Scopes        string   `json:"scopes"`
	CallbacksURL  []string `json:"callbacksURL"`
}

type HydraConfig

type HydraConfig struct {
	BrowserURL string               `json:"browserURL"`
	Public     HydraTransportConfig `json:"public"`
	Admin      HydraTransportConfig `json:"admin"`
	Client     HydraClient          `json:"client"`
}

type HydraTransportConfig

type HydraTransportConfig struct {
	Host     string   `json:"host"`
	BasePath string   `json:"basePath"`
	Schemes  []string `json:"schemes"`
}

type KratosConfig

type KratosConfig struct {
	Host           string `json:"host"`
	Scheme         string `json:"scheme"`
	Debug          bool   `json:"debug"`
	PublicBasePath string `json:"publicBasePath"`
}

type LogConfig

type LogConfig struct {
	Mode  string `json:"mode"`
	Level string `json:"level"`
}

Jump to

Keyboard shortcuts

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