token

package
v1.7.0-beta.2 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2017 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TokenIDBytes     = 3
	TokenSecretBytes = 8
)

Variables

View Source
var (
	TokenIDRegexpString = "^([a-z0-9]{6})$"
	TokenIDRegexp       = regexp.MustCompile(TokenIDRegexpString)
	TokenRegexpString   = "^([a-z0-9]{6})\\.([a-z0-9]{16})$"
	TokenRegexp         = regexp.MustCompile(TokenRegexpString)
)

Functions

func BearerToken

func BearerToken(d *kubeadmapi.TokenDiscovery) string

BearerToken returns a string representation of the passed token.

func GenerateToken

func GenerateToken() (string, error)

GenerateToken generates a new token with a token ID that is valid as a Kubernetes DNS label. For more info, see kubernetes/pkg/util/validation/validation.go.

func ParseToken

func ParseToken(s string) (string, string, error)

ParseToken tries and parse a valid token from a string. A token ID and token secret are returned in case of success, an error otherwise.

func ParseTokenID

func ParseTokenID(s string) error

ParseTokenID tries and parse a valid token ID from a string. An error is returned in case of failure.

func ValidateToken

func ValidateToken(d *kubeadmapi.TokenDiscovery) (bool, error)

ValidateToken validates whether a token is well-formed. In case it's not, the corresponding error is returned as well.

Types

This section is empty.

Jump to

Keyboard shortcuts

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