access

package
v0.3.19 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2022 License: AGPL-3.0 Imports: 21 Imported by: 2 modules, 1 package

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	AccountServer         = "https://api.account.safing.io"
	LoginPath             = "/api/v1/authenticate"
	UserProfilePath       = "/api/v1/user/profile"
	TokenRequestSetupPath = "/api/v1/token/request/setup"
	TokenRequestIssuePath = "/api/v1/token/request/issue"
	HealthCheckPath       = "/api/v1/health"
)
View Source
const (
	OpTypeAccessCodeAuth = "auth"
)

Variables

View Source
var (
	ErrDeviceIsLocked       = errors.New("device is locked")
	ErrDeviceLimitReached   = errors.New("device limit reached")
	ErrFallbackNotAvailable = errors.New("fallback tokens not available, token issuer is online")
	ErrInvalidCredentials   = errors.New("invalid credentials")
	ErrMayNotUseSPN         = errors.New("may not use SPN")
	ErrNotLoggedIn          = errors.New("not logged in")
)

Errors.

View Source
var (
	ExpandAndConnectZones = []string{"pblind1", "alpha2", "fallback1"}
)

Functions

func GetToken added in v0.3.8

func GetToken(zones []string) (t *token.Token, err error)

func GetTokenAmount added in v0.3.8

func GetTokenAmount(zones []string) (regular, fallback int)

func SaveNewAuthToken added in v0.3.8

func SaveNewAuthToken(deviceID string, resp *http.Response) error

func TokenIssuerIsFailing added in v0.3.8

func TokenIssuerIsFailing() bool

func UpdateAccount added in v0.3.8

func UpdateAccount(_ context.Context, task *modules.Task) error

func VerifyRawToken added in v0.3.8

func VerifyRawToken(data []byte) (granted terminal.Permission, err error)

func VerifyToken added in v0.3.8

func VerifyToken(t *token.Token) (granted terminal.Permission, err error)

Types

type AuthTokenRecord added in v0.3.8

type AuthTokenRecord struct {
	record.Base
	sync.Mutex

	Token *account.AuthToken
}

func GetAuthToken added in v0.3.8

func GetAuthToken() (*AuthTokenRecord, error)

func (*AuthTokenRecord) GetToken added in v0.3.8

func (authToken *AuthTokenRecord) GetToken() *account.AuthToken

func (*AuthTokenRecord) Save added in v0.3.8

func (authToken *AuthTokenRecord) Save() error

func (*AuthTokenRecord) Update added in v0.3.8

func (authToken *AuthTokenRecord) Update(resp *http.Response) error

type AuthorizeOp added in v0.3.0

type AuthorizeOp struct {
	terminal.OpBaseRequest
}

func AuthorizeToTerminal added in v0.3.0

func AuthorizeToTerminal(t terminal.OpTerminal) (*AuthorizeOp, *terminal.Error)

func (*AuthorizeOp) Type added in v0.3.0

func (op *AuthorizeOp) Type() string

type UserRecord added in v0.3.8

type UserRecord struct {
	record.Base
	sync.Mutex

	*account.User

	MayUseSPN  bool
	LoggedInAt *time.Time
}

func GetUser added in v0.3.8

func GetUser() (*UserRecord, error)

func (*UserRecord) IsLoggedIn added in v0.3.8

func (user *UserRecord) IsLoggedIn() bool

func (*UserRecord) MayUseTheSPN added in v0.3.8

func (user *UserRecord) MayUseTheSPN() bool

func (*UserRecord) Save added in v0.3.8

func (user *UserRecord) Save() error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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