scramsha

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2021 License: Apache-2.0 Imports: 15 Imported by: 3

Documentation

Overview

Package scramsha provides implementation of client side SCRAM-SHA according to https://tools.ietf.org/html/rfc5802

Package scramsha provides implementation of client side SCRAM-SHA via Http according to https://tools.ietf.org/html/rfc7804

Index

Constants

View Source
const (
	WWWAuthenticate    = "WWW-Authenticate"
	AuthenticationInfo = "Authentication-Info"
	Authorization      = "Authorization"
	DataPrefix         = "data="
	SidPrefix          = "sid="
)

consts used to parse scramsha response from target

Variables

This section is empty.

Functions

func BestMethod

func BestMethod(methods string) (string, error)

BestMethod returns SCRAM-SHA method we consider the best out of suggested by server

func DoScramSha

func DoScramSha(req *Request,
	username string,
	password string,
	client *http.Client) (*http.Response, error)

DoScramSha performs SCRAM-SHA handshake via Http

Types

type Request

type Request struct {

	// Embed an HTTP request directly. This makes a *Request act exactly
	// like an *http.Request so that all meta methods are supported.
	*http.Request
	// contains filtered or unexported fields
}

Request provides implementation of http request that can be retried

func NewRequest

func NewRequest(method, url string, body io.ReadSeeker) (*Request, error)

NewRequest creates http request that can be retried

type ScramSha

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

ScramSha provides context for SCRAM-SHA handling

func NewScramSha

func NewScramSha(method string) (*ScramSha, error)

NewScramSha creates context for SCRAM-SHA handling

func (*ScramSha) GetFinalRequest

func (s *ScramSha) GetFinalRequest(pass string) string

GetFinalRequest builds final SCRAM-SHA request to be sent to server

func (*ScramSha) GetStartRequest

func (s *ScramSha) GetStartRequest(user string) (string, error)

GetStartRequest builds start SCRAM-SHA request to be sent to server

func (*ScramSha) HandleFinalResponse

func (s *ScramSha) HandleFinalResponse(response string) error

HandleFinalResponse handles server's response on final SCRAM-SHA request

func (*ScramSha) HandleStartResponse

func (s *ScramSha) HandleStartResponse(response string) error

HandleStartResponse handles server response on start SCRAM-SHA request

Jump to

Keyboard shortcuts

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