Documentation ¶
Index ¶
- Constants
- Variables
- func GetToken(zones []string) (t *token.Token, err error)
- func GetTokenAmount(zones []string) (regular, fallback int)
- func SaveNewAuthToken(deviceID string, resp *http.Response) error
- func TokenIssuerIsFailing() bool
- func UpdateAccount(_ context.Context, task *modules.Task) error
- func VerifyRawToken(data []byte) (granted terminal.Permission, err error)
- func VerifyToken(t *token.Token) (granted terminal.Permission, err error)
- type AuthTokenRecord
- type AuthorizeOp
- type UserRecord
Constants ¶
View Source
const ( AccountServer = "http://127.0.0.1:8081" // AccountServer = "https://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 GetTokenAmount ¶ added in v0.3.8
func SaveNewAuthToken ¶ added in v0.3.8
func TokenIssuerIsFailing ¶ added in v0.3.8
func TokenIssuerIsFailing() bool
func UpdateAccount ¶ added in v0.3.8
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
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
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
Click to show internal directories.
Click to hide internal directories.