auth

package
v1.25.0 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2018 License: BSD-2-Clause Imports: 14 Imported by: 21

Documentation

Index

Constants

View Source
const (
	TidepoolServiceSecretHeaderKey      = "X-Tidepool-Service-Secret"
	TidepoolAuthorizationHeaderKey      = "Authorization"
	TidepoolSessionTokenHeaderKey       = "X-Tidepool-Session-Token"
	TidepoolRestrictedTokenParameterKey = "restricted_token"
)
View Source
const MaximumExpirationDuration = time.Hour
View Source
const (
	ProviderTypeOAuth = "oauth"
)

Variables

This section is empty.

Functions

func NewContextWithServerSessionToken

func NewContextWithServerSessionToken(ctx context.Context, serverSessionToken string) context.Context

func ProviderTypes

func ProviderTypes() []string

func ServerSessionTokenFromContext

func ServerSessionTokenFromContext(ctx context.Context) string

Types

type ExternalAccessor

type ExternalAccessor interface {
	ServerSessionToken() (string, error)
	ValidateSessionToken(ctx context.Context, token string) (request.Details, error)
}

type ProviderSession

type ProviderSession struct {
	ID           string       `json:"id" bson:"id"`
	UserID       string       `json:"userId" bson:"userId"`
	Type         string       `json:"type" bson:"type"`
	Name         string       `json:"name" bson:"name"`
	OAuthToken   *oauth.Token `json:"oauthToken,omitempty" bson:"oauthToken,omitempty"`
	CreatedTime  time.Time    `json:"createdTime" bson:"createdTime"`
	ModifiedTime *time.Time   `json:"modifiedTime,omitempty" bson:"modifiedTime,omitempty"`
}

func NewProviderSession

func NewProviderSession(userID string, create *ProviderSessionCreate) (*ProviderSession, error)

func (*ProviderSession) Parse

func (p *ProviderSession) Parse(parser structure.ObjectParser)

func (*ProviderSession) Sanitize

func (p *ProviderSession) Sanitize(details request.Details) error

func (*ProviderSession) Validate

func (p *ProviderSession) Validate(validator structure.Validator)

type ProviderSessionAccessor

type ProviderSessionAccessor interface {
	ListUserProviderSessions(ctx context.Context, userID string, filter *ProviderSessionFilter, pagination *page.Pagination) (ProviderSessions, error)
	CreateUserProviderSession(ctx context.Context, userID string, create *ProviderSessionCreate) (*ProviderSession, error)
	GetProviderSession(ctx context.Context, id string) (*ProviderSession, error)
	UpdateProviderSession(ctx context.Context, id string, update *ProviderSessionUpdate) (*ProviderSession, error)
	DeleteProviderSession(ctx context.Context, id string) error
}

type ProviderSessionCreate

type ProviderSessionCreate struct {
	Type       string       `json:"type" bson:"type"`
	Name       string       `json:"name" bson:"name"`
	OAuthToken *oauth.Token `json:"oauthToken,omitempty" bson:"oauthToken,omitempty"`
}

func NewProviderSessionCreate

func NewProviderSessionCreate() *ProviderSessionCreate

func (*ProviderSessionCreate) Parse

func (p *ProviderSessionCreate) Parse(parser structure.ObjectParser)

func (*ProviderSessionCreate) Validate

func (p *ProviderSessionCreate) Validate(validator structure.Validator)

type ProviderSessionFilter

type ProviderSessionFilter struct {
	Type *string `json:"type,omitempty" bson:"type,omitempty"`
	Name *string `json:"name,omitempty" bson:"name,omitempty"`
}

func NewProviderSessionFilter

func NewProviderSessionFilter() *ProviderSessionFilter

func (*ProviderSessionFilter) Mutate

func (p *ProviderSessionFilter) Mutate(req *http.Request) error

func (*ProviderSessionFilter) Parse

func (p *ProviderSessionFilter) Parse(parser structure.ObjectParser)

func (*ProviderSessionFilter) Validate

func (p *ProviderSessionFilter) Validate(validator structure.Validator)

type ProviderSessionUpdate

type ProviderSessionUpdate struct {
	OAuthToken *oauth.Token `json:"oauthToken,omitempty" bson:"oauthToken,omitempty"`
}

func NewProviderSessionUpdate

func NewProviderSessionUpdate() *ProviderSessionUpdate

func (*ProviderSessionUpdate) HasUpdates

func (p *ProviderSessionUpdate) HasUpdates() bool

func (*ProviderSessionUpdate) Parse

func (p *ProviderSessionUpdate) Parse(parser structure.ObjectParser)

func (*ProviderSessionUpdate) Validate

func (p *ProviderSessionUpdate) Validate(validator structure.Validator)

type ProviderSessions

type ProviderSessions []*ProviderSession

func (ProviderSessions) Sanitize

func (p ProviderSessions) Sanitize(details request.Details) error

type RestrictedToken

type RestrictedToken struct {
	ID             string     `json:"id" bson:"id"`
	UserID         string     `json:"userId" bson:"userId"`
	Paths          *[]string  `json:"paths,omitempty" bson:"paths,omitempty"`
	ExpirationTime time.Time  `json:"expirationTime" bson:"expirationTime"`
	CreatedTime    time.Time  `json:"createdTime" bson:"createdTime"`
	ModifiedTime   *time.Time `json:"modifiedTime,omitempty" bson:"modifiedTime,omitempty"`
}

func NewRestrictedToken

func NewRestrictedToken(userID string, create *RestrictedTokenCreate) (*RestrictedToken, error)

func (*RestrictedToken) Authenticates

func (r *RestrictedToken) Authenticates(req *http.Request) bool

func (*RestrictedToken) Parse

func (r *RestrictedToken) Parse(parser structure.ObjectParser)

func (*RestrictedToken) Sanitize

func (r *RestrictedToken) Sanitize(details request.Details) error

func (*RestrictedToken) Validate

func (r *RestrictedToken) Validate(validator structure.Validator)

type RestrictedTokenAccessor

type RestrictedTokenAccessor interface {
	ListUserRestrictedTokens(ctx context.Context, userID string, filter *RestrictedTokenFilter, pagination *page.Pagination) (RestrictedTokens, error)
	CreateUserRestrictedToken(ctx context.Context, userID string, create *RestrictedTokenCreate) (*RestrictedToken, error)
	GetRestrictedToken(ctx context.Context, id string) (*RestrictedToken, error)
	UpdateRestrictedToken(ctx context.Context, id string, update *RestrictedTokenUpdate) (*RestrictedToken, error)
	DeleteRestrictedToken(ctx context.Context, id string) error
}

type RestrictedTokenCreate

type RestrictedTokenCreate struct {
	Paths          *[]string  `json:"paths,omitempty"`
	ExpirationTime *time.Time `json:"expirationTime,omitempty"`
}

func NewRestrictedTokenCreate

func NewRestrictedTokenCreate() *RestrictedTokenCreate

func (*RestrictedTokenCreate) Normalize

func (r *RestrictedTokenCreate) Normalize(normalizer structure.Normalizer)

func (*RestrictedTokenCreate) Parse

func (r *RestrictedTokenCreate) Parse(parser structure.ObjectParser)

func (*RestrictedTokenCreate) Validate

func (r *RestrictedTokenCreate) Validate(validator structure.Validator)

type RestrictedTokenFilter

type RestrictedTokenFilter struct{}

func NewRestrictedTokenFilter

func NewRestrictedTokenFilter() *RestrictedTokenFilter

func (*RestrictedTokenFilter) Mutate

func (r *RestrictedTokenFilter) Mutate(req *http.Request) error

func (*RestrictedTokenFilter) Parse

func (r *RestrictedTokenFilter) Parse(parser structure.ObjectParser)

func (*RestrictedTokenFilter) Validate

func (r *RestrictedTokenFilter) Validate(validator structure.Validator)

type RestrictedTokenUpdate

type RestrictedTokenUpdate struct {
	Paths          *[]string  `json:"paths,omitempty"`
	ExpirationTime *time.Time `json:"expirationTime,omitempty"`
}

func NewRestrictedTokenUpdate

func NewRestrictedTokenUpdate() *RestrictedTokenUpdate

func (*RestrictedTokenUpdate) HasUpdates

func (r *RestrictedTokenUpdate) HasUpdates() bool

func (*RestrictedTokenUpdate) Normalize

func (r *RestrictedTokenUpdate) Normalize(normalizer structure.Normalizer)

func (*RestrictedTokenUpdate) Parse

func (r *RestrictedTokenUpdate) Parse(parser structure.ObjectParser)

func (*RestrictedTokenUpdate) Validate

func (r *RestrictedTokenUpdate) Validate(validator structure.Validator)

type RestrictedTokens

type RestrictedTokens []*RestrictedToken

func (RestrictedTokens) Sanitize

func (r RestrictedTokens) Sanitize(details request.Details) error

Directories

Path Synopsis
api

Jump to

Keyboard shortcuts

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