auth

package
v0.0.0-...-3c2e68c Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2022 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const CludoAuthHeader = "X-CLUDO-KEY"

Variables

This section is empty.

Functions

func DecodePrivateKey

func DecodePrivateKey(path string, encoded []byte, interactive bool) (*interface{}, error)

DecodePrivateKey tries to decode the given private key. It will try and handle passphrase-protected keys when encountered. It returns the decoded private key and any errors that were encountered.

func EncodeAuthorizedKey

func EncodeAuthorizedKey(pub *ssh.PublicKey) (string, error)

EncodeAuthorizedKey will encode the given public key into the authorized_key format It returns a string containing the authorized_key and any errors encountered.

func ParseAuthorizedKey

func ParseAuthorizedKey(encoded []byte) (*ssh.PublicKey, error)

ParseAuthorizedKey converts an authorized_key into a PublicKey It returns the PublicKey and any errors encountered.

func VerifyECDSAHeader

func VerifyECDSAHeader(pubKey interface{}, tokens []string, signature []byte, sigType string) (bool, error)

VerifyECDSAHeader verifies a signature using the EDCSA algorithm. It returns nil if the signature is valid, or an error if it is invalid.

func VerifyED25519Header

func VerifyED25519Header(pubKey interface{}, tokens []string, signature []byte) error

VerifyED25519Header verifies a signature using the ed25519 algorithm. It returns nil if the signature is valid, or an error if it is invalid.

func VerifyRSAHeader

func VerifyRSAHeader(pubKey interface{}, tokens []string, signature []byte, hash string) error

VerifyRSAHeader verifies a signature using the RSA algorithm. It returns nil if the signature is valid, or an error if it is invalid.

Types

type Authorizer

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

func NewAuthorizer

func NewAuthorizer(users map[string]*ssh.PublicKey) *Authorizer

NewAuthorizer creates a new Authorizer struct. It returns a pointer to the Authorizer.

func (*Authorizer) CheckAuthHeader

func (authz *Authorizer) CheckAuthHeader(header string) (string, bool, error)

CheckAuthHeader checks the given signature against the avaliable public keys. It returns the user ID if the signature is valid, in addition to a verification boolean and error.

type Signer

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

func NewDefaultSigner

func NewDefaultSigner(privkey *interface{}, pubkey *ssh.PublicKey) *Signer

NewDefaultSigner runs the NewSigner() function It return the response from NewSigner()

func NewSigner

func NewSigner(privkey *interface{}, pubkey *ssh.PublicKey, rng io.Reader) *Signer

NewSigner creates a new Signer that can be used to sign requests It returns a pointer to the signer.

func (*Signer) CludoAuth

func (signer *Signer) CludoAuth() runtime.ClientAuthInfoWriter

CludoAuth provides an API key auth info writer

func (*Signer) GenerateAuthHeader

func (signer *Signer) GenerateAuthHeader(message string) (string, error)

func (*Signer) GenerateRandomAuthHeader

func (signer *Signer) GenerateRandomAuthHeader() (string, error)

Jump to

Keyboard shortcuts

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