authn

package
v0.0.0-...-1290ed6 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	TimeFormatToken4 = "2006-01-02 15:04:05 MST"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type APIKeyAuthenticator

type APIKeyAuthenticator struct {
	Authenticate func(loginPair LoginPair) ([]byte, error)
	LoginPair
}

func (*APIKeyAuthenticator) NeedsTokenRefresh

func (a *APIKeyAuthenticator) NeedsTokenRefresh() bool

func (*APIKeyAuthenticator) RefreshToken

func (a *APIKeyAuthenticator) RefreshToken() ([]byte, error)

type AuthnToken

type AuthnToken interface {
	// Parse from JSON. Required before further usage.
	FromJSON(data []byte) error
	// Raw token as obtained from the authentication service.
	Raw() []byte
	// Whether the token will expire soon.
	ShouldRefresh() bool
}

func NewToken

func NewToken(data []byte) (token AuthnToken, err error)

type AuthnToken4

type AuthnToken4 struct {
	Data      string `json:"data"`
	Signature string `json:"signature"`
	Key       string `json:"key"`
	Timestamp time.Time
	// contains filtered or unexported fields
}

func (*AuthnToken4) FromJSON

func (t *AuthnToken4) FromJSON(data []byte) (err error)

func (*AuthnToken4) Raw

func (t *AuthnToken4) Raw() []byte

func (*AuthnToken4) ShouldRefresh

func (t *AuthnToken4) ShouldRefresh() bool

func (*AuthnToken4) UnmarshalJSON

func (t *AuthnToken4) UnmarshalJSON(data []byte) (err error)

type AuthnToken5

type AuthnToken5 struct {
	Protected string `json:"protected"`
	Payload   string `json:"payload"`
	Signature string `json:"signature"`
	// contains filtered or unexported fields
}

Sample token {"protected":"eyJhbGciOiJjb25qdXIub3JnL3Nsb3NpbG8vdjIiLCJraWQiOiI5M2VjNTEwODRmZTM3Zjc3M2I1ODhlNTYyYWVjZGMxMSJ9","payload":"eyJzdWIiOiJhZG1pbiIsImlhdCI6MTUxMDc1MzI1OX0=","signature":"raCufKOf7sKzciZInQTphu1mBbLhAdIJM72ChLB4m5wKWxFnNz_7LawQ9iYEI_we1-tdZtTXoopn_T1qoTplR9_Bo3KkpI5Hj3DB7SmBpR3CSRTnnEwkJ0_aJ8bql5Cbst4i4rSftyEmUqX-FDOqJdAztdi9BUJyLfbeKTW9OGg-QJQzPX1ucB7IpvTFCEjMoO8KUxZpbHj-KpwqAMZRooG4ULBkxp5nSfs-LN27JupU58oRgIfaWASaDmA98O2x6o88MFpxK_M0FeFGuDKewNGrRc8lCOtTQ9cULA080M5CSnruCqu1Qd52r72KIOAfyzNIiBCLTkblz2fZyEkdSKQmZ8J3AakxQE2jyHmMT-eXjfsEIzEt-IRPJIirI3Qm"} https://www.conjur.org/reference/cryptography.html

func (*AuthnToken5) FromJSON

func (t *AuthnToken5) FromJSON(data []byte) (err error)

func (*AuthnToken5) Raw

func (t *AuthnToken5) Raw() []byte

func (*AuthnToken5) ShouldRefresh

func (t *AuthnToken5) ShouldRefresh() bool

type LoginPair

type LoginPair struct {
	Login  string
	APIKey string
}

type TokenAuthenticator

type TokenAuthenticator struct {
	Token string `env:"CONJUR_AUTHN_TOKEN"`
}

func (*TokenAuthenticator) NeedsTokenRefresh

func (a *TokenAuthenticator) NeedsTokenRefresh() bool

func (*TokenAuthenticator) RefreshToken

func (a *TokenAuthenticator) RefreshToken() ([]byte, error)

type TokenFileAuthenticator

type TokenFileAuthenticator struct {
	TokenFile string `env:"CONJUR_AUTHN_TOKEN_FILE"`

	MaxWaitTime time.Duration
	// contains filtered or unexported fields
}

func (*TokenFileAuthenticator) NeedsTokenRefresh

func (a *TokenFileAuthenticator) NeedsTokenRefresh() bool

func (*TokenFileAuthenticator) RefreshToken

func (a *TokenFileAuthenticator) RefreshToken() ([]byte, error)

TODO: is this implementation concurrent ?

Jump to

Keyboard shortcuts

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