jwt

package
v0.0.0-...-4560a53 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2023 License: Zlib Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Service

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

Service represents a service for managing JWT tokens.

func NewService

func NewService(userSessionDuration string, dataStore dataservices.DataStore) (*Service, error)

NewService initializes a new service. It will generate a random key that will be used to sign JWT tokens.

func (*Service) GenerateToken

func (service *Service) GenerateToken(data *portainer.TokenData) (string, error)

GenerateToken generates a new JWT token.

func (*Service) GenerateTokenForKubeconfig

func (service *Service) GenerateTokenForKubeconfig(data *portainer.TokenData) (string, error)

GenerateTokenForKubeconfig generates a new JWT token for Kubeconfig

func (*Service) GenerateTokenForOAuth

func (service *Service) GenerateTokenForOAuth(data *portainer.TokenData, expiryTime *time.Time) (string, error)

GenerateTokenForOAuth generates a new JWT token for OAuth login token expiry time response from OAuth provider is considered

func (*Service) ParseAndVerifyToken

func (service *Service) ParseAndVerifyToken(token string) (*portainer.TokenData, error)

ParseAndVerifyToken parses a JWT token and verify its validity. It returns an error if token is invalid.

func (*Service) SetUserSessionDuration

func (service *Service) SetUserSessionDuration(userSessionDuration time.Duration)

SetUserSessionDuration sets the user session duration

Jump to

Keyboard shortcuts

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