jwtauth

package
v0.0.0-...-ce409c2 Latest Latest
Warning

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

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

Documentation

Overview

Package jwtauth contains JWT and authentication-related helpers

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildAPIAccessToken

func BuildAPIAccessToken(sdkKeys []string, ttl time.Duration, key []byte) (tokenString string, err error)

BuildAPIAccessToken returns a token for accessing the API service using the argument SDK keys and TTL. It also returns the expiration timestamp.

func BuildAdminAccessToken

func BuildAdminAccessToken(ttl time.Duration, key []byte) (tokenString string, err error)

BuildAdminAccessToken returns a token for accessing the Admin service using the argument TTL. It also returns the expiration timestamp.

func DecodeConfigValue

func DecodeConfigValue(configSecretHash string) ([]byte, error)

DecodeConfigValue returns the decoded value from configuration a byte slice, or an error if decoding failed

func GenerateClientSecretAndHash

func GenerateClientSecretAndHash() (secretStr, hashStr string, err error)

GenerateClientSecretAndHash returns a random secret and its hash, for use with Agent's authN/authZ workflow. - The first return value is the secret - 32 random bytes, base64-encoded. - The second return value is the bcrypt hash of the secret. - The hash should be included in Agent's auth configuration as the client_secret value. - The secret should be sent in the request to the token issuer endpoint.

func ValidateClientSecret

func ValidateClientSecret(reqSecret string, configSecretHash []byte) (bool, error)

ValidateClientSecret returns true if the hash of the secret provided in config matches the secret provided in the request. Returns an error if the req secret fails base64 decoding.

Types

This section is empty.

Jump to

Keyboard shortcuts

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