Documentation ¶
Index ¶
- Constants
- func ErrorValueStringAsProviderSessionIDNotValid(value string) error
- func ErrorValueStringAsRestrictedTokenIDNotValid(value string) error
- func IsValidProviderName(value string) bool
- func IsValidProviderSessionID(value string) bool
- func IsValidRestrictedTokenID(value string) bool
- func NewContextWithServerSessionToken(ctx context.Context, serverSessionToken string) context.Context
- func NewProviderSessionID() string
- func NewRestrictedTokenID() string
- func ProviderNameValidator(value string, errorReporter structure.ErrorReporter)
- func ProviderSessionIDValidator(value string, errorReporter structure.ErrorReporter)
- func ProviderTypes() []string
- func RestrictedTokenIDValidator(value string, errorReporter structure.ErrorReporter)
- func ServerSessionTokenFromContext(ctx context.Context) string
- func ValidateProviderName(value string) error
- func ValidateProviderSessionID(value string) error
- func ValidateRestrictedTokenID(value string) error
- 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 ProviderNameLengthMaximum = 100
View Source
const (
ProviderTypeOAuth = "oauth"
)
Variables ¶
This section is empty.
Functions ¶
func ErrorValueStringAsProviderSessionIDNotValid ¶ added in v1.27.0
func ErrorValueStringAsRestrictedTokenIDNotValid ¶ added in v1.27.0
func IsValidProviderName ¶ added in v1.29.0
func IsValidProviderSessionID ¶ added in v1.27.0
func IsValidRestrictedTokenID ¶ added in v1.27.0
func NewProviderSessionID ¶ added in v1.27.0
func NewProviderSessionID() string
func NewRestrictedTokenID ¶ added in v1.27.0
func NewRestrictedTokenID() string
func ProviderNameValidator ¶ added in v1.29.0
func ProviderNameValidator(value string, errorReporter structure.ErrorReporter)
func ProviderSessionIDValidator ¶ added in v1.27.0
func ProviderSessionIDValidator(value string, errorReporter structure.ErrorReporter)
func ProviderTypes ¶
func ProviderTypes() []string
func RestrictedTokenIDValidator ¶ added in v1.27.0
func RestrictedTokenIDValidator(value string, errorReporter structure.ErrorReporter)
func ValidateProviderName ¶ added in v1.29.0
func ValidateProviderSessionID ¶ added in v1.27.0
func ValidateRestrictedTokenID ¶ added in v1.27.0
Types ¶
type Client ¶
type Client interface { ProviderSessionAccessor RestrictedTokenAccessor ExternalAccessor }
type ExternalAccessor ¶
type ExternalAccessor interface { ServerSessionToken() (string, error) ValidateSessionToken(ctx context.Context, token string) (request.Details, error) EnsureAuthorized(ctx context.Context) error EnsureAuthorizedService(ctx context.Context) error EnsureAuthorizedUser(ctx context.Context, targetUserID string, permission string) (string, 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) MutateRequest ¶ added in v1.27.0
func (p *ProviderSessionFilter) MutateRequest(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
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) MutateRequest ¶ added in v1.27.0
func (r *RestrictedTokenFilter) MutateRequest(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
Click to show internal directories.
Click to hide internal directories.