role

package
v5.5.2 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package role represents the processing logic of role token.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrRoleTokenInvalid "Access denied due to invalid RoleToken"
	ErrRoleTokenInvalid = errors.New("Access denied due to invalid RoleToken")

	// ErrRoleTokenExpired "Access denied due to expired RoleToken"
	ErrRoleTokenExpired = errors.New("Access denied due to expired RoleToken")
)

Functions

This section is empty.

Types

type Option

type Option func(*rtp) error

Option represents a functional options pattern interface

func WithPubkeyProvider

func WithPubkeyProvider(pkp pubkey.Provider) Option

WithPubkeyProvider represents set pubkey provider functional option

type Processor

type Processor interface {
	ParseAndValidateRoleToken(tok string) (*Token, error)
}

Processor represents the role token parser interface.

func New

func New(opts ...Option) (Processor, error)

New returns the Role instance.

type Token

type Token struct {
	// Version    string   // required
	Domain    string   // required
	Roles     []string // required
	Principal string   // required
	// Host       string
	// Salt       string    // required
	TimeStamp  time.Time // required
	ExpiryTime time.Time // required
	KeyID      string    // required
	// IP         string
	// ProxyUser  string
	Signature string // required

	UnsignedToken string
}

Token represents role token data.

func (*Token) Expired

func (r *Token) Expired() bool

Expired returns if the role token is expired or not.

func (*Token) SetParams

func (r *Token) SetParams(key, value string) error

SetParams sets the value for corresponding key data.

Jump to

Keyboard shortcuts

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