token

package
v0.10.1-alpha.7 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2020 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RSAPublicKeyPemType  = "RSA PUBLIC KEY"
	RSAPrivateKeyPemType = "RSA PRIVATE KEY"
	JWTIssuerName        = "wssdagentsvc"
)

Variables

This section is empty.

Functions

func GeneratePrivateKey

func GeneratePrivateKey() ([]byte, error)

GeneratePrivateKey generates a private key for JWT

Types

type JwtAuthorizer

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

func NewJwtAuthorizer

func NewJwtAuthorizer(keyLocation string) (*JwtAuthorizer, error)

NewJwtAuthorizer Creates Authorizer which will validate tokens

func NewJwtAuthorizerFromKey

func NewJwtAuthorizerFromKey(key crypto.PublicKey) (*JwtAuthorizer, error)

NewJwtAuthorizer Creates Authorizer which will validate tokens

func (*JwtAuthorizer) UpdatePublicKey

func (ja *JwtAuthorizer) UpdatePublicKey(publicKey *rsa.PublicKey)

UpdatePublicKey updates an Authorizer's Public Key

func (*JwtAuthorizer) ValidateTokenFromContext

func (ja *JwtAuthorizer) ValidateTokenFromContext(context context.Context) (*jwt.Token, error)

ValidateTokenFromContext obtains the token from the context of the call

func (*JwtAuthorizer) WritePublicKeyToPem

func (ja *JwtAuthorizer) WritePublicKeyToPem(keyLocation string) error

WritePublicKeyToPem creates a pem for a public key and writes it to disk

type JwtSigner

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

func NewJwtSigner

func NewJwtSigner(privateKeyByte []byte) (*JwtSigner, error)

NewJwtSigner Creates Signer which will sign tokens

func (*JwtSigner) GetPublicKey

func (js *JwtSigner) GetPublicKey() *rsa.PublicKey

GetPublicKey returns the Signer's PublicKey

func (*JwtSigner) IssueJWT

func (js *JwtSigner) IssueJWT(name string, guid string) (string, error)

IssueJWT issues a JWT from the name and guid

Jump to

Keyboard shortcuts

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