credential

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package credential provides different types of credentials for authentication.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrMissingCredential        = customerror.NewMissingError("credential", "", nil)
	ErrUsernamePasswordRequired = customerror.NewRequiredError("username, and password are", "", nil)
)

Functions

This section is empty.

Types

type BasicAuth

type BasicAuth struct {
	Username string `json:"username" validate:"required,gte=3"`
	Password string `json:"password" validate:"required,gte=3"`
}

BasicAuth is the basic authentication credential definition.

See: https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication#basic_authentication_scheme

func NewBasicAuth

func NewBasicAuth(username, password string) (*BasicAuth, error)

NewBasicAuth is the BasicAuth factory.

func NewBasicAuthFromText

func NewBasicAuthFromText(credential string) (*BasicAuth, error)

NewBasicAuthFromText is a BasicAuth factory that automatically parses `credential` from text.

func (*BasicAuth) ToBase64

func (bC *BasicAuth) ToBase64() string

ToBase64 converts a basic auth credential to the base64 format.

Jump to

Keyboard shortcuts

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