Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CryptoHashToDigestName ¶
CryptoHashToDigestName returns the algorithm name corresponding to the crypto.Hash ID, or an error if the algorithm is not supported.
Types ¶
type AuthenticationResult ¶
type AuthenticationResult int
AuthenticationResult is a code used to identify the outcome of HmacAuth.AuthenticateRequest().
const ( // ResultNoSignature - the incoming result did not have a signature // header. ResultNoSignature AuthenticationResult = iota // ResultInvalidFormat - the signature header was not parseable. ResultInvalidFormat // ResultUnsupportedAlgorithm - the signature header specified an // unsupported algorithm. ResultUnsupportedAlgorithm // ResultMatch - the signature from the request header matched the // locally-computed signature. ResultMatch // ResultMismatch - the signature from the request header did not match // the locally-computed signature. ResultMismatch )
func (AuthenticationResult) String ¶
func (result AuthenticationResult) String() string
type HmacAuth ¶
type HmacAuth interface {
// Produces the string that will be prefixed to the request body and
// used to generate the signature.
StringToSign(req *http.Request) string
// Adds a signature header to the request.
SignRequest(req *http.Request)
// Generates a signature for the request.
RequestSignature(req *http.Request) string
// Retrieves the signature included in the request header.
SignatureFromHeader(req *http.Request) string
// Authenticates the request, returning the result code, the signature
// from the header, and the locally-computed signature.
AuthenticateRequest(request *http.Request) (
result AuthenticationResult,
headerSignature, computedSignature string)
}
HmacAuth signs outbound requests and authenticates inbound requests.
Click to show internal directories.
Click to hide internal directories.