client

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2016 License: BSD-3-Clause Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TidepoolServerNameHeaderName          = "X-Tidepool-Server-Name"
	TidepoolServerSecretHeaderName        = "X-Tidepool-Server-Secret"
	TidepoolAuthenticationTokenHeaderName = "X-Tidepool-Session-Token"

	ServerTokenTimeoutOnFailureFirst = time.Second
	ServerTokenTimeoutOnFailureLast  = 60 * time.Second
)
View Source
const CustodianPermission = "custodian"
View Source
const OwnerPermission = "root"
View Source
const UploadPermission = "upload"
View Source
const ViewPermission = "view"

Variables

This section is empty.

Functions

func IsUnauthorizedError

func IsUnauthorizedError(err error) bool

Types

type AuthenticationDetails added in v1.0.0

type AuthenticationDetails interface {
	Token() string

	IsServer() bool
	UserID() string
}

type Client

type Client interface {
	ValidateAuthenticationToken(context service.Context, authenticationToken string) (AuthenticationDetails, error)
	GetUserPermissions(context service.Context, requestUserID string, targetUserID string) (Permissions, error)
	GetUserGroupID(context service.Context, userID string) (string, error)

	ServerToken() (string, error)
}

type Config

type Config struct {
	Address            string `json:"address"`
	RequestTimeout     int    `json:"requestTimeout"`
	ServerTokenSecret  string `json:"serverTokenSecret"`
	ServerTokenTimeout int    `json:"serverTokenTimeout"`
}

func (*Config) Clone added in v0.1.0

func (c *Config) Clone() *Config

func (*Config) Validate

func (c *Config) Validate() error

type Permission

type Permission map[string]interface{}

type Permissions

type Permissions map[string]Permission

type Standard

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

func NewStandard

func NewStandard(logger log.Logger, name string, config *Config) (*Standard, error)

func (*Standard) Close

func (s *Standard) Close()

func (*Standard) GetUserGroupID

func (s *Standard) GetUserGroupID(context service.Context, userID string) (string, error)

func (*Standard) GetUserPermissions added in v0.1.0

func (s *Standard) GetUserPermissions(context service.Context, requestUserID string, targetUserID string) (Permissions, error)

func (*Standard) ServerToken added in v1.2.0

func (s *Standard) ServerToken() (string, error)

func (*Standard) Start

func (s *Standard) Start() error

func (*Standard) ValidateAuthenticationToken added in v1.0.0

func (s *Standard) ValidateAuthenticationToken(context service.Context, authenticationToken string) (AuthenticationDetails, error)

type UnauthorizedError

type UnauthorizedError struct{}

func NewUnauthorizedError

func NewUnauthorizedError() *UnauthorizedError

func (*UnauthorizedError) Error

func (u *UnauthorizedError) Error() string

type UnexpectedResponseError

type UnexpectedResponseError struct {
	Method     string
	URL        string
	StatusCode int
}

func NewUnexpectedResponseError

func NewUnexpectedResponseError(response *http.Response, request *http.Request) *UnexpectedResponseError

func (*UnexpectedResponseError) Error

func (u *UnexpectedResponseError) Error() string

Jump to

Keyboard shortcuts

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