jwtclient

package module
v0.0.0-...-305276d Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2018 License: MIT Imports: 13 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func KeyFuncFromCertDir

func KeyFuncFromCertDir(directory string) (jwt.Keyfunc, error)

func KeyFuncFromPEMBytes

func KeyFuncFromPEMBytes(pemBytes []byte) (jwt.Keyfunc, error)

KeyFuncFromPEMBytes returns a closure which in turn returns the public part of the JWT certificate from a file.

func KeyFuncFromPEMFile

func KeyFuncFromPEMFile(fileLocation string) (jwt.Keyfunc, error)

KeyFuncFromPEMFile returns a closure which in turn returns the public part of the JWT certificate from a file.

func PEMBytesToCert

func PEMBytesToCert(pemBytes []byte) (*x509.Certificate, error)

PemBytesToKey turns a set of PEM bytes into a x509 certificate

func PEMDirToCertMap

func PEMDirToCertMap(directory string) (map[string]*x509.Certificate, error)

PEMDirToCertMap takes a directory as input and turns it into a map of certificates.

func PEMFileToCert

func PEMFileToCert(fileLocation string) (*x509.Certificate, error)

PEMFileToCert turns a file location into a certificate.

Types

type Client

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

Client is the basic struct for this client.

func New

func New(cfg *Config) (*Client, error)

New takes a config struct, and returns a client struct.

func (*Client) Authenticate

func (c *Client) Authenticate() (err error)

Authenticate is a jwt wrapper that returns the JWT token to be used on subsequent calls.

func (*Client) RetrieveToken

func (c *Client) RetrieveToken() (string, error)

RetrieveToken checks to see if the token we have is still valid, re-authenticates if necessary and returns the token.

func (*Client) StillValid

func (c *Client) StillValid() bool

StillValid checks to see if the token we have is still valid.

type Config

type Config struct {
	AuthKey    string
	AuthSecret string
	URL        string
	Insecure   bool
}

Config is the package configuration struct that configures the package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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