jwttoken

package
v0.17.0 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2024 License: Apache-2.0 Imports: 8 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClaimsFromBearerToken added in v0.17.0

func ClaimsFromBearerToken(publicKey *rsa.PublicKey, bearerToken string) (interface{}, error)

ClaimsFromBearerToken decodes the provided bearer token into either github.com/shellhub-io/shellhub/pkg/api/authorizer.UserClaims or github.com/shellhub-io/shellhub/pkg/api/authorizer.DeviceClaims. It returns the decoded claims and an error if any.

func EncodeDeviceClaims added in v0.17.0

func EncodeDeviceClaims(claims authorizer.DeviceClaims, privateKey *rsa.PrivateKey) (string, error)

EncodeDeviceClaims encodes the provided device claims into a signed JWT token. It returns the encoded token and an error, if any.

func EncodeUserClaims added in v0.17.0

func EncodeUserClaims(claims authorizer.UserClaims, privateKey *rsa.PrivateKey) (string, error)

EncodeUserClaims encodes the provided user claims into a signed JWT token. It returns the encoded token and an error, if any.

The token is valid for 72 hours; tenantID is optional.

Types

This section is empty.

Jump to

Keyboard shortcuts

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