core

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2021 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Functions

This section is empty.

Types

type Core

type Core struct {
	Config *config.Config

	Tokenizer Tokenizer
	// contains filtered or unexported fields
}

func New

func New(config *config.Config, tokenizer Tokenizer, userService user.UserService) *Core

func (*Core) AuthURL

func (c *Core) AuthURL(providerID string, state string) (string, error)

func (*Core) Claims

func (c *Core) Claims(token *TokenInfo) (jws.Claims, error)

func (*Core) GenTokenInfo

func (c *Core) GenTokenInfo(providerID string, code string) (*TokenInfo, error)

func (*Core) JwtToken

func (c *Core) JwtToken(claims jws.Claims) ([]byte, error)

func (*Core) LocalEnabled

func (c *Core) LocalEnabled() bool

func (*Core) Providers

func (c *Core) Providers() []string

func (*Core) PublicKeys

func (c *Core) PublicKeys() ([]string, error)

func (*Core) RedirectURI

func (c *Core) RedirectURI() string

type CoreAuth

type CoreAuth interface {
	PublicKeys() ([]string, error)
	GenTokenInfo(provider string, code string) (*TokenInfo, error)
	Claims(token *TokenInfo) (jws.Claims, error)
	JwtToken(jws.Claims) ([]byte, error)
	RedirectURI() string
	AuthURL(provider string, state string) (string, error)
	Providers() []string
}

CoreAuth is the central interface of jwt-proxy. It provides all function necessary for handling the redirect to the provider, process the login, enrich the provider's token with some custom parameters and return the JWT token to the callback URI.

type RSATokenizer

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

func (*RSATokenizer) Serialize

func (t *RSATokenizer) Serialize(claims map[string]interface{}) ([]byte, error)

type TokenInfo

type TokenInfo struct {
	oauth2.Token
	Provider provider.Provider
	User     string
}

TokenInfo wraps oauth.Token and adds two additional fields: Provider is the OAuth provider, e.g. github or facebook UserInfo is the map of user info claims from the provider

type Tokenizer

type Tokenizer interface {
	Serialize(claims map[string]interface{}) ([]byte, error)
}

Tokenizer creates a byte array from an input map.

func NewRSATokenizer

func NewRSATokenizer(signingMethod crypto.SigningMethod, privKey *rsa.PrivateKey) Tokenizer

Jump to

Keyboard shortcuts

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