client

package
v0.0.0-...-44558b4 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2019 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Host

type Host struct {
	Client       protocol.CertClient
	Dryrun       bool
	PSKStore     accord.PSKStore
	Salt         string
	DeploymentId string
	KeysDir      string
	Hostnames    []string
	UUID         []byte
}

Host has all fields public because most of them are required to be set by the caller in one way or another anyway and duplicating the fields in another input object is just waste to only be used once

func NewHost

func NewHost(client protocol.CertClient) *Host

func (*Host) Authenticate

func (h *Host) Authenticate(ctx context.Context) (string, error)

For now the response doesn't do a proper challenge auth

func (*Host) RequestCerts

func (h *Host) RequestCerts(ctx context.Context, duration time.Duration) error

It's always in the future, so not giving the user start time option

func (*Host) UpdateUserCertAuthority

func (h *Host) UpdateUserCertAuthority(filePath string) error

type User

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

func NewUser

func NewUser(client protocol.CertClient) *User

func NewUserWithToken

func NewUserWithToken(client protocol.CertClient, token *oauth2.Token) *User

func (*User) CheckAuthorization

func (u *User) CheckAuthorization(ctx context.Context) (bool, string, error)

Validate the Oauth2.0 token against the server it needs to have been generated by the same clientID and have valid expiry date, etc Maybe use a nonce or something, but I can't think of reasonable things to send here, so boolean so that the backend doesn't get bad requests

func (*User) RequestCerts

func (u *User) RequestCerts(ctx context.Context, userId string, duration time.Duration) error

func (*User) SetKeysDir

func (u *User) SetKeysDir(keysDir string)

func (*User) SetPrincipals

func (u *User) SetPrincipals(principals []string)

func (*User) SetRemoteUsername

func (u *User) SetRemoteUsername(username string)

func (*User) SetUsername

func (u *User) SetUsername(username string)

func (*User) UpdateHostCertAuthority

func (u *User) UpdateHostCertAuthority(knownHostsFile string) error

Jump to

Keyboard shortcuts

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