Documentation
¶
Index ¶
- Constants
- Variables
- func MakeBadRequest(err error) *goa.ServiceError
- func MakeForbidden(err error) *goa.ServiceError
- func MakeInternalServerError(err error) *goa.ServiceError
- func MakeNotFound(err error) *goa.ServiceError
- func MakeUnauthorized(err error) *goa.ServiceError
- func NewCleanLoginTokenEndpoint(s Service, authJWTFn security.AuthJWTFunc, ...) goa.Endpoint
- func NewCleanMergeTokenEndpoint(s Service, authJWTFn security.AuthJWTFunc, ...) goa.Endpoint
- func NewCleanSessionsEndpoint(s Service, authJWTFn security.AuthJWTFunc, ...) goa.Endpoint
- func NewGetSessionsEndpoint(s Service, authJWTFn security.AuthJWTFunc, ...) goa.Endpoint
- func NewLogoutEndpoint(s Service, authJWTFn security.AuthJWTFunc, ...) goa.Endpoint
- func NewLogoutOtherEndpoint(s Service, authJWTFn security.AuthJWTFunc, ...) goa.Endpoint
- func NewLogoutSpecificEndpoint(s Service, authJWTFn security.AuthJWTFunc, ...) goa.Endpoint
- func NewRedeemTokenEndpoint(s Service, authAPIKeyFn security.AuthAPIKeyFunc) goa.Endpoint
- func NewRefreshEndpoint(s Service, authAPIKeyFn security.AuthAPIKeyFunc) goa.Endpoint
- func NewViewedAllSessions(res *AllSessions, view string) *sessionviews.AllSessions
- type AllSessions
- type Auther
- type CleanLoginTokenPayload
- type CleanMergeTokenPayload
- type CleanSessionsPayload
- type Client
- func (c *Client) CleanLoginToken(ctx context.Context, p *CleanLoginTokenPayload) (err error)
- func (c *Client) CleanMergeToken(ctx context.Context, p *CleanMergeTokenPayload) (err error)
- func (c *Client) CleanSessions(ctx context.Context, p *CleanSessionsPayload) (err error)
- func (c *Client) GetSessions(ctx context.Context, p *GetSessionsPayload) (res *AllSessions, err error)
- func (c *Client) Logout(ctx context.Context, p *LogoutPayload) (err error)
- func (c *Client) LogoutOther(ctx context.Context, p *LogoutOtherPayload) (err error)
- func (c *Client) LogoutSpecific(ctx context.Context, p *LogoutSpecificPayload) (err error)
- func (c *Client) RedeemToken(ctx context.Context, p *RedeemTokenPayload) (res *RedeemTokenResult, err error)
- func (c *Client) Refresh(ctx context.Context, p *RefreshPayload) (res *RefreshResult, err error)
- type Endpoints
- type GetSessionsPayload
- type LogoutOtherPayload
- type LogoutPayload
- type LogoutSpecificPayload
- type RedeemTokenPayload
- type RedeemTokenResult
- type RefreshPayload
- type RefreshResult
- type Service
- type Session
- type SessionCollection
Constants ¶
const ServiceName = "session"
ServiceName is the name of the service as defined in the design. This is the same value that is set in the endpoint request contexts under the ServiceKey key.
Variables ¶
var MethodNames = [9]string{"refresh", "logout", "logout-other", "logout-specific", "get-sessions", "redeemToken", "clean-sessions", "clean-login-token", "clean-merge-token"}
MethodNames lists the service method names as defined in the design. These are the same values that are set in the endpoint request contexts under the MethodKey key.
Functions ¶
func MakeBadRequest ¶
func MakeBadRequest(err error) *goa.ServiceError
MakeBadRequest builds a goa.ServiceError from an error.
func MakeForbidden ¶
func MakeForbidden(err error) *goa.ServiceError
MakeForbidden builds a goa.ServiceError from an error.
func MakeInternalServerError ¶
func MakeInternalServerError(err error) *goa.ServiceError
MakeInternalServerError builds a goa.ServiceError from an error.
func MakeNotFound ¶
func MakeNotFound(err error) *goa.ServiceError
MakeNotFound builds a goa.ServiceError from an error.
func MakeUnauthorized ¶
func MakeUnauthorized(err error) *goa.ServiceError
MakeUnauthorized builds a goa.ServiceError from an error.
func NewCleanLoginTokenEndpoint ¶
func NewCleanLoginTokenEndpoint(s Service, authJWTFn security.AuthJWTFunc, authAPIKeyFn security.AuthAPIKeyFunc) goa.Endpoint
NewCleanLoginTokenEndpoint returns an endpoint function that calls the method "clean-login-token" of service "session".
func NewCleanMergeTokenEndpoint ¶
func NewCleanMergeTokenEndpoint(s Service, authJWTFn security.AuthJWTFunc, authAPIKeyFn security.AuthAPIKeyFunc) goa.Endpoint
NewCleanMergeTokenEndpoint returns an endpoint function that calls the method "clean-merge-token" of service "session".
func NewCleanSessionsEndpoint ¶
func NewCleanSessionsEndpoint(s Service, authJWTFn security.AuthJWTFunc, authAPIKeyFn security.AuthAPIKeyFunc) goa.Endpoint
NewCleanSessionsEndpoint returns an endpoint function that calls the method "clean-sessions" of service "session".
func NewGetSessionsEndpoint ¶
func NewGetSessionsEndpoint(s Service, authJWTFn security.AuthJWTFunc, authAPIKeyFn security.AuthAPIKeyFunc) goa.Endpoint
NewGetSessionsEndpoint returns an endpoint function that calls the method "get-sessions" of service "session".
func NewLogoutEndpoint ¶
func NewLogoutEndpoint(s Service, authJWTFn security.AuthJWTFunc, authAPIKeyFn security.AuthAPIKeyFunc) goa.Endpoint
NewLogoutEndpoint returns an endpoint function that calls the method "logout" of service "session".
func NewLogoutOtherEndpoint ¶
func NewLogoutOtherEndpoint(s Service, authJWTFn security.AuthJWTFunc, authAPIKeyFn security.AuthAPIKeyFunc) goa.Endpoint
NewLogoutOtherEndpoint returns an endpoint function that calls the method "logout-other" of service "session".
func NewLogoutSpecificEndpoint ¶
func NewLogoutSpecificEndpoint(s Service, authJWTFn security.AuthJWTFunc, authAPIKeyFn security.AuthAPIKeyFunc) goa.Endpoint
NewLogoutSpecificEndpoint returns an endpoint function that calls the method "logout-specific" of service "session".
func NewRedeemTokenEndpoint ¶
func NewRedeemTokenEndpoint(s Service, authAPIKeyFn security.AuthAPIKeyFunc) goa.Endpoint
NewRedeemTokenEndpoint returns an endpoint function that calls the method "redeemToken" of service "session".
func NewRefreshEndpoint ¶
func NewRefreshEndpoint(s Service, authAPIKeyFn security.AuthAPIKeyFunc) goa.Endpoint
NewRefreshEndpoint returns an endpoint function that calls the method "refresh" of service "session".
func NewViewedAllSessions ¶
func NewViewedAllSessions(res *AllSessions, view string) *sessionviews.AllSessions
NewViewedAllSessions initializes viewed result type AllSessions from result type AllSessions using the given view.
Types ¶
type AllSessions ¶
type AllSessions struct {
CurrentSession *Session
OtherSessions SessionCollection
}
AllSessions is the result type of the session service get-sessions method.
func NewAllSessions ¶
func NewAllSessions(vres *sessionviews.AllSessions) *AllSessions
NewAllSessions initializes result type AllSessions from viewed result type AllSessions.
type Auther ¶
type Auther interface {
// APIKeyAuth implements the authorization logic for the APIKey security scheme.
APIKeyAuth(ctx context.Context, key string, schema *security.APIKeyScheme) (context.Context, error)
// JWTAuth implements the authorization logic for the JWT security scheme.
JWTAuth(ctx context.Context, token string, schema *security.JWTScheme) (context.Context, error)
}
Auther defines the authorization functions to be implemented by the service.
type CleanLoginTokenPayload ¶
CleanLoginTokenPayload is the payload type of the session service clean-login-token method.
type CleanMergeTokenPayload ¶
CleanMergeTokenPayload is the payload type of the session service clean-merge-token method.
type CleanSessionsPayload ¶
CleanSessionsPayload is the payload type of the session service clean-sessions method.
type Client ¶
type Client struct {
RefreshEndpoint goa.Endpoint
LogoutEndpoint goa.Endpoint
LogoutOtherEndpoint goa.Endpoint
LogoutSpecificEndpoint goa.Endpoint
GetSessionsEndpoint goa.Endpoint
RedeemTokenEndpoint goa.Endpoint
CleanSessionsEndpoint goa.Endpoint
CleanLoginTokenEndpoint goa.Endpoint
CleanMergeTokenEndpoint goa.Endpoint
}
Client is the "session" service client.
func NewClient ¶
func NewClient(refresh, logout, logoutOther, logoutSpecific, getSessions, redeemToken, cleanSessions, cleanLoginToken, cleanMergeToken goa.Endpoint) *Client
NewClient initializes a "session" service client given the endpoints.
func (*Client) CleanLoginToken ¶
func (c *Client) CleanLoginToken(ctx context.Context, p *CleanLoginTokenPayload) (err error)
CleanLoginToken calls the "clean-login-token" endpoint of the "session" service. CleanLoginToken may return the following errors:
- "Forbidden" (type *goa.ServiceError)
- error: internal error
func (*Client) CleanMergeToken ¶
func (c *Client) CleanMergeToken(ctx context.Context, p *CleanMergeTokenPayload) (err error)
CleanMergeToken calls the "clean-merge-token" endpoint of the "session" service. CleanMergeToken may return the following errors:
- "Forbidden" (type *goa.ServiceError)
- error: internal error
func (*Client) CleanSessions ¶
func (c *Client) CleanSessions(ctx context.Context, p *CleanSessionsPayload) (err error)
CleanSessions calls the "clean-sessions" endpoint of the "session" service. CleanSessions may return the following errors:
- "Forbidden" (type *goa.ServiceError)
- error: internal error
func (*Client) GetSessions ¶
func (c *Client) GetSessions(ctx context.Context, p *GetSessionsPayload) (res *AllSessions, err error)
GetSessions calls the "get-sessions" endpoint of the "session" service. GetSessions may return the following errors:
- "InternalServerError" (type *goa.ServiceError)
- error: internal error
func (*Client) Logout ¶
func (c *Client) Logout(ctx context.Context, p *LogoutPayload) (err error)
Logout calls the "logout" endpoint of the "session" service. Logout may return the following errors:
- "BadRequest" (type *goa.ServiceError)
- "InternalServerError" (type *goa.ServiceError)
- error: internal error
func (*Client) LogoutOther ¶
func (c *Client) LogoutOther(ctx context.Context, p *LogoutOtherPayload) (err error)
LogoutOther calls the "logout-other" endpoint of the "session" service. LogoutOther may return the following errors:
- "BadRequest" (type *goa.ServiceError)
- "InternalServerError" (type *goa.ServiceError)
- error: internal error
func (*Client) LogoutSpecific ¶
func (c *Client) LogoutSpecific(ctx context.Context, p *LogoutSpecificPayload) (err error)
LogoutSpecific calls the "logout-specific" endpoint of the "session" service. LogoutSpecific may return the following errors:
- "BadRequest" (type *goa.ServiceError)
- "NotFound" (type *goa.ServiceError)
- "InternalServerError" (type *goa.ServiceError)
- error: internal error
func (*Client) RedeemToken ¶
func (c *Client) RedeemToken(ctx context.Context, p *RedeemTokenPayload) (res *RedeemTokenResult, err error)
RedeemToken calls the "redeemToken" endpoint of the "session" service. RedeemToken may return the following errors:
- "Forbidden" (type *goa.ServiceError)
- "InternalServerError" (type *goa.ServiceError)
- error: internal error
func (*Client) Refresh ¶
func (c *Client) Refresh(ctx context.Context, p *RefreshPayload) (res *RefreshResult, err error)
Refresh calls the "refresh" endpoint of the "session" service. Refresh may return the following errors:
- "Unauthorized" (type *goa.ServiceError)
- "BadRequest" (type *goa.ServiceError)
- "InternalServerError" (type *goa.ServiceError)
- error: internal error
type Endpoints ¶
type Endpoints struct {
Refresh goa.Endpoint
Logout goa.Endpoint
LogoutOther goa.Endpoint
LogoutSpecific goa.Endpoint
GetSessions goa.Endpoint
RedeemToken goa.Endpoint
CleanSessions goa.Endpoint
CleanLoginToken goa.Endpoint
CleanMergeToken goa.Endpoint
}
Endpoints wraps the "session" service endpoints.
func NewEndpoints ¶
NewEndpoints wraps the methods of the "session" service with endpoints.
type GetSessionsPayload ¶
GetSessionsPayload is the payload type of the session service get-sessions method.
type LogoutOtherPayload ¶
LogoutOtherPayload is the payload type of the session service logout-other method.
type LogoutPayload ¶
LogoutPayload is the payload type of the session service logout method.
type LogoutSpecificPayload ¶
type LogoutSpecificPayload struct {
SessionID *string
Authorization *string
XSession *string
APIKey *string
}
LogoutSpecificPayload is the payload type of the session service logout-specific method.
type RedeemTokenPayload ¶
type RedeemTokenPayload struct {
// A merge token for merging into an account
Token string
UserAgent *string
APIKey *string
}
RedeemTokenPayload is the payload type of the session service redeemToken method.
type RedeemTokenResult ¶
RedeemTokenResult is the result type of the session service redeemToken method.
type RefreshPayload ¶
RefreshPayload is the payload type of the session service refresh method.
type RefreshResult ¶
RefreshResult is the result type of the session service refresh method.
type Service ¶
type Service interface {
// Take a user's session token and refresh it, also returns a new
// authentication token
Refresh(context.Context, *RefreshPayload) (res *RefreshResult, err error)
// Takes a user's auth token, and logs-out the session associated with it
Logout(context.Context, *LogoutPayload) (err error)
// Logout all sessions for the current user except their current session
LogoutOther(context.Context, *LogoutOtherPayload) (err error)
// Logout of a specific session
LogoutSpecific(context.Context, *LogoutSpecificPayload) (err error)
// Gets all of the sessions that are associated with the currently logged in
// user
GetSessions(context.Context, *GetSessionsPayload) (res *AllSessions, err error)
// Redeems a login token for credentials
RedeemToken(context.Context, *RedeemTokenPayload) (res *RedeemTokenResult, err error)
// Deletes all the sessions that have expired
CleanSessions(context.Context, *CleanSessionsPayload) (err error)
// Cleans old login tokens from the database
CleanLoginToken(context.Context, *CleanLoginTokenPayload) (err error)
// Cleans old account merge tokens from the database
CleanMergeToken(context.Context, *CleanMergeTokenPayload) (err error)
}
Service is the session service interface.
type Session ¶
type Session struct {
// Unique unchanging session ID
ID string
// ID of the user this session is for
UserID string
// Time that this session was last used
LastUsed string
// The browser and browser version connected with this session
Browser string
// The OS of the system where this session was used
Os string
// The last IP address where this session was used
IP string
// A humanReadable string describing the last known location of the session
Location string
// The latitude of the last known location of the session
Latitude string
// The longitude of the last known location of the session
Longitude string
// Whether the session was from a mobile device
IsMobile bool
// The URL of the Google map to show the location, suitable for using in an img
// tag
MapURL string
}
A session for a user, associated with a specific browser
type SessionCollection ¶
type SessionCollection []*Session