Documentation ¶
Index ¶
- Constants
- Variables
- func NewContextWithServerSessionToken(ctx context.Context, serverSessionToken string) context.Context
- func ServerSessionTokenFromContext(ctx context.Context) string
- type Client
- type ExternalAccessor
- type ProviderSession
- type ProviderSessionAccessor
- type ProviderSessionCreate
- type ProviderSessionFilter
- type ProviderSessionUpdate
- type ProviderSessions
- type RestrictedToken
- type RestrictedTokenAccessor
- type RestrictedTokenCreate
- type RestrictedTokenFilter
- type RestrictedTokenUpdate
- type RestrictedTokens
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 ¶
View Source
var PathExpression = regexp.MustCompile("^/.*$")
View Source
var ProviderTypes = []string{ProviderTypeOAuth}
Functions ¶
Types ¶
type Client ¶
type Client interface { ProviderSessionAccessor RestrictedTokenAccessor ExternalAccessor }
type ExternalAccessor ¶
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) Parse ¶
func (p *ProviderSessionUpdate) Parse(parser structure.ObjectParser)
func (*ProviderSessionUpdate) Validate ¶
func (p *ProviderSessionUpdate) Validate(validator structure.Validator)
type ProviderSessions ¶
type ProviderSessions []*ProviderSession
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) 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
Click to show internal directories.
Click to hide internal directories.