token

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: May 30, 2025 License: BSD-2-Clause Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Token

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

Token represents parsed authentication token used to access the Redis server. It implements the auth.Credentials interface.

func New

func New(username, password, rawToken string, expiresOn, receivedAt time.Time, ttl int64) *Token

New creates a new token with the specified username, password, raw token, expiration time, received at time, and time to live. NOTE: This won't do any validation on the token, expiresOn, receivedAt, or ttl. It will simply create a new token instance. The caller is responsible for ensuring the token is valid. Expiration time and TTL are used to determine when the token should be refreshed. TTL is in milliseconds. receivedAt + ttl should be within a millisecond of expiresOn

func (*Token) BasicAuth

func (t *Token) BasicAuth() (string, string)

BasicAuth returns the username and password for basic authentication.

func (*Token) Copy

func (t *Token) Copy() *Token

Copy creates a copy of the token.

func (*Token) ExpirationOn

func (t *Token) ExpirationOn() time.Time

ExpirationOn returns the expiration time of the token.

func (*Token) RawCredentials

func (t *Token) RawCredentials() string

RawCredentials returns the raw credentials for authentication.

func (*Token) RawToken

func (t *Token) RawToken() string

RawToken returns the raw token.

func (*Token) ReceivedAt

func (t *Token) ReceivedAt() time.Time

ReceivedAt returns the time when the token was received.

func (*Token) TTL

func (t *Token) TTL() int64

TTL returns the time to live of the token.

Jump to

Keyboard shortcuts

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