auth

package
v0.0.0-...-4380e07 Latest Latest
Warning

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

Go to latest
Published: May 27, 2022 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KeyName     = "key.pem"
	CertName    = "cert.pem"
	CAChainName = "cacerts.pem"
	CAPoolName  = "root.pem"
)

File names used for saving and loading credentials

View Source
const (
	ControllerServerName = "controller.openness"
	EnrollServerName     = "enroll.controller.openness"
)

Community edition controller server names

Variables

This section is empty.

Functions

func Enroll

func Enroll(certsDir, endpoint string, timeout time.Duration,
	cc CredentialsClient) error

Enroll tries to load credentials from certsDir. If loading failed it requests credentials from endpoint and saves them to certsDir

func LoadCert

func LoadCert(path string) (*x509.Certificate, error)

LoadCert verifies file permissions(0644) and loads a certificate

func LoadCerts

func LoadCerts(path string) ([]*x509.Certificate, error)

LoadCerts verifies file permissions(0644) and loads all certificates If no certificates are found returns an error

func LoadKey

func LoadKey(path string) (crypto.PrivateKey, error)

LoadKey verifies file permissions(0644) and loads a PEM encoded PKCS#8 key

func SaveCert

func SaveCert(path string, certs ...*x509.Certificate) error

SaveCert saves PEM encoded certificate to a file with permissions set to 0644

func SaveKey

func SaveKey(key crypto.PrivateKey, path string) error

SaveKey saves PEM encoded PKCS#8 key to a file with permissions set to 0644

Types

type CredentialsClient

type CredentialsClient interface {
	Get(id *pb.Identity, timeout time.Duration,
		endpoint string) (*pb.Credentials, error)
}

CredentialsClient is the interface that wraps Get method Get gets credentials from the endpoint using provided id

type EnrollClient

type EnrollClient struct{}

EnrollClient implements CredentialsClient interface

func (EnrollClient) Get

func (c EnrollClient) Get(id *pb.Identity, timeout time.Duration,
	endpoint string) (*pb.Credentials, error)

Get gets credentials from gRPC endpoint using TLS connection

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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