Documentation ¶
Index ¶
- Constants
- Variables
- func CheckEmailExists(email string) bool
- func CheckPhoneExists(phone string) bool
- func CheckUsernameExists(username string) bool
- func NewFacebookService(log *logrus.Logger, jwt *auth.JWTSecurity, session *SessionService) facebook.Service
- func NewGoogleService(log *logrus.Logger, jwt *auth.JWTSecurity, session *SessionService) google.Service
- func NewInstagramService(log *logrus.Logger, jwt *auth.JWTSecurity, session *SessionService) instagram.Service
- func NewLinkedinService(log *logrus.Logger, jwt *auth.JWTSecurity, session *SessionService) linkedin.Service
- func NewMonitoring(logger *logrus.Logger) monitoring.Service
- func NewPasswordAuthService(log *logrus.Logger, jwt *auth.JWTSecurity, session *SessionService) passwordauth.Service
- func NewTwitterService(log *logrus.Logger, jwt *auth.JWTSecurity, session *SessionService) twitter.Service
- func NewUsersService(log *logrus.Logger, jwt *auth.JWTSecurity, session *SessionService) user.Service
- type FacebookRegisterMedia
- type FacebookService
- func (s *FacebookService) APIKeyAuth(ctx context.Context, key string, scheme *security.APIKeyScheme) (context.Context, error)
- func (s *FacebookService) AttachToAccount(ctx context.Context, p *facebook.AttachToAccountPayload) (res string, err error)
- func (s *FacebookService) DetachFromAccount(ctx context.Context, p *facebook.DetachFromAccountPayload) (err error)
- func (s *FacebookService) FacebookRegister(ctx context.Context, grm *FacebookRegisterMedia, OauthKey string) (*facebook.UserMedia, error)
- func (s *FacebookService) JWTAuth(ctx context.Context, token string, scheme *security.JWTScheme) (context.Context, error)
- func (s *FacebookService) Receive(ctx context.Context, p *facebook.ReceivePayload) (res *facebook.UserMedia, err error)
- func (s *FacebookService) RegisterURL(ctx context.Context, p *facebook.RegisterURLPayload) (res string, err error)
- type FacebookUser
- type GeoIP
- type GoogleRegisterMedia
- type GoogleService
- func (s *GoogleService) APIKeyAuth(ctx context.Context, key string, scheme *security.APIKeyScheme) (context.Context, error)
- func (s *GoogleService) AttachToAccount(ctx context.Context, p *google.AttachToAccountPayload) (res string, err error)
- func (s *GoogleService) DetachFromAccount(ctx context.Context, p *google.DetachFromAccountPayload) (err error)
- func (s *GoogleService) GoogleRegister(ctx context.Context, gr *GoogleRegisterMedia, OauthKey string) (*google.UserMedia, error)
- func (s *GoogleService) JWTAuth(ctx context.Context, token string, scheme *security.JWTScheme) (context.Context, error)
- func (s *GoogleService) Receive(ctx context.Context, p *google.ReceivePayload) (res *google.UserMedia, err error)
- func (s *GoogleService) RegisterURL(ctx context.Context, p *google.RegisterURLPayload) (res string, err error)
- type GoogleUser
- type InstagramRegisterMedia
- type InstagramService
- func (s *InstagramService) APIKeyAuth(ctx context.Context, key string, scheme *security.APIKeyScheme) (context.Context, error)
- func (s *InstagramService) AttachToAccount(ctx context.Context, p *instagram.AttachToAccountPayload) (res string, err error)
- func (s *InstagramService) DetachFromAccount(ctx context.Context, p *instagram.DetachFromAccountPayload) (err error)
- func (s *InstagramService) InstagramRegister(ctx context.Context, gr *database.InstagramRegister, ...) (res *instagram.UserMedia, err error)
- func (s *InstagramService) JWTAuth(ctx context.Context, token string, scheme *security.JWTScheme) (context.Context, error)
- func (s *InstagramService) Receive(ctx context.Context, p *instagram.ReceivePayload) (res *instagram.UserMedia, err error)
- func (s *InstagramService) RegisterURL(ctx context.Context, p *instagram.RegisterURLPayload) (res string, err error)
- type InstagramUser
- type InstagramUserMedia
- type LinkedinRegisterMedia
- type LinkedinService
- func (s *LinkedinService) APIKeyAuth(ctx context.Context, key string, scheme *security.APIKeyScheme) (context.Context, error)
- func (s *LinkedinService) AttachToAccount(ctx context.Context, p *linkedin.AttachToAccountPayload) (res string, err error)
- func (s *LinkedinService) DetachFromAccount(ctx context.Context, p *linkedin.DetachFromAccountPayload) (err error)
- func (s *LinkedinService) JWTAuth(ctx context.Context, token string, scheme *security.JWTScheme) (context.Context, error)
- func (s *LinkedinService) LinkedinRegister(ctx context.Context, grm *LinkedinRegisterMedia, OauthKey string) (*linkedin.UserMedia, error)
- func (s *LinkedinService) Receive(ctx context.Context, p *linkedin.ReceivePayload) (res *linkedin.UserMedia, err error)
- func (s *LinkedinService) RegisterURL(ctx context.Context, p *linkedin.RegisterURLPayload) (res string, err error)
- type LinkedinUser
- type PasswordAuthService
- func (s *PasswordAuthService) APIKeyAuth(ctx context.Context, key string, scheme *security.APIKeyScheme) (context.Context, error)
- func (s *PasswordAuthService) ChangePassword(ctx context.Context, p *passwordauth.ChangePasswordParams) (err error)
- func (s *PasswordAuthService) CheckEmailAvailable(ctx context.Context, p *passwordauth.CheckEmailAvailablePayload) (res bool, err error)
- func (s *PasswordAuthService) CheckPhoneAvailable(ctx context.Context, p *passwordauth.CheckPhoneAvailablePayload) (res bool, err error)
- func (s *PasswordAuthService) CheckUsernameAvailable(ctx context.Context, p *passwordauth.CheckUsernameAvailablePayload) (res bool, err error)
- func (s *PasswordAuthService) ConfirmReset(ctx context.Context, p *passwordauth.ResetPasswordParams) (err error)
- func (s *PasswordAuthService) JWTAuth(ctx context.Context, token string, scheme *security.JWTScheme) (context.Context, error)
- func (s *PasswordAuthService) Login(ctx context.Context, p *passwordauth.LoginParams) (res *passwordauth.UserMedia, err error)
- func (s *PasswordAuthService) Register(ctx context.Context, p *passwordauth.RegisterParams) (res *passwordauth.UserMedia, err error)
- func (s *PasswordAuthService) Remove(ctx context.Context, p *passwordauth.RemovePayload) (err error)
- func (s *PasswordAuthService) Reset(ctx context.Context, p *passwordauth.ResetPayload) (err error)
- type SessionService
- func (s *SessionService) APIKeyAuth(ctx context.Context, key string, scheme *security.APIKeyScheme) (context.Context, error)
- func (s *SessionService) CleanLoginToken(ctx context.Context, p *session.CleanLoginTokenPayload) (err error)
- func (s *SessionService) CleanMergeToken(ctx context.Context, p *session.CleanMergeTokenPayload) (err error)
- func (s *SessionService) CleanSessions(ctx context.Context, p *session.CleanSessionsPayload) (err error)
- func (s *SessionService) GetSessions(ctx context.Context, p *session.GetSessionsPayload) (res *session.AllSessions, err error)
- func (s *SessionService) JWTAuth(ctx context.Context, token string, scheme *security.JWTScheme) (context.Context, error)
- func (s *SessionService) Logout(ctx context.Context, p *session.LogoutPayload) (err error)
- func (s *SessionService) LogoutOther(ctx context.Context, p *session.LogoutOtherPayload) (err error)
- func (s *SessionService) LogoutSpecific(ctx context.Context, p *session.LogoutSpecificPayload) (err error)
- func (s *SessionService) RedeemToken(ctx context.Context, p *session.RedeemTokenPayload) (res *session.RedeemTokenResult, err error)
- func (s *SessionService) Refresh(ctx context.Context, p *session.RefreshPayload) (res *session.RefreshResult, err error)
- type TwitterRegisterMedia
- type TwitterService
- func (s *TwitterService) APIKeyAuth(ctx context.Context, key string, scheme *security.APIKeyScheme) (context.Context, error)
- func (s *TwitterService) AttachToAccount(ctx context.Context, p *twitter.AttachToAccountPayload) (res string, err error)
- func (s *TwitterService) DetachFromAccount(ctx context.Context, p *twitter.DetachFromAccountPayload) (err error)
- func (s *TwitterService) JWTAuth(ctx context.Context, token string, scheme *security.JWTScheme) (context.Context, error)
- func (s *TwitterService) Receive(ctx context.Context, p *twitter.ReceivePayload) (res *twitter.UserMedia, err error)
- func (s *TwitterService) RegisterURL(ctx context.Context, p *twitter.RegisterURLPayload) (res string, err error)
- func (s *TwitterService) TwitterRegister(ctx context.Context, grm *TwitterRegisterMedia, OauthKey string) (*twitter.UserMedia, error)
- type UsersService
- func (s *UsersService) APIKeyAuth(ctx context.Context, key string, scheme *security.APIKeyScheme) (context.Context, error)
- func (s *UsersService) Deactivate(ctx context.Context, p *user.DeactivatePayload) (retErr error)
- func (s *UsersService) GetAuths(ctx context.Context, p *user.GetAuthsPayload) (res *user.AuthStatusMedia, retErr error)
- func (s *UsersService) GetUser(ctx context.Context, p *user.GetUserPayload) (res *user.UserMedia, retErr error)
- func (s *UsersService) JWTAuth(ctx context.Context, token string, scheme *security.JWTScheme) (context.Context, error)
- func (s *UsersService) ResendVerifyEmail(ctx context.Context, p *user.ResendVerifyEmailPayload) (err error)
- func (s *UsersService) UpdateUser(ctx context.Context, p *user.UserUpdateParams) (res *user.UserMedia, retErr error)
- func (s *UsersService) ValidateEmail(ctx context.Context, p *user.ValidateEmailPayload) (err error)
Constants ¶
const ( SessionTime = 7 * 24 * time.Hour // 1 week TokenTime = 10 * time.Minute // 10 minutes )
Variables ¶
var ( ErrNoKey error = errors.New("api key missing") // Key is the key used in JWT authentication Key = []byte("secret") )
var ErrInvalidRecaptcha = errors.New("Invalid recaptcha response")
Functions ¶
func CheckEmailExists ¶
func CheckPhoneExists ¶
func CheckUsernameExists ¶
func NewFacebookService ¶
func NewFacebookService(log *logrus.Logger, jwt *auth.JWTSecurity, session *SessionService) facebook.Service
NewFacebookController creates a facebook controller.
func NewGoogleService ¶
func NewGoogleService(log *logrus.Logger, jwt *auth.JWTSecurity, session *SessionService) google.Service
NewGoogleService creates a google controller.
func NewInstagramService ¶
func NewInstagramService(log *logrus.Logger, jwt *auth.JWTSecurity, session *SessionService) instagram.Service
NewInstagramService creates a instagram controller.
func NewLinkedinService ¶
func NewLinkedinService(log *logrus.Logger, jwt *auth.JWTSecurity, session *SessionService) linkedin.Service
NewLinkedinService creates a linkedin controller.
func NewMonitoring ¶
func NewMonitoring(logger *logrus.Logger) monitoring.Service
NewMonitoring returns the monitoring service implementation.
func NewPasswordAuthService ¶
func NewPasswordAuthService(log *logrus.Logger, jwt *auth.JWTSecurity, session *SessionService) passwordauth.Service
NewPasswordAuthService creates a password-auth controller.
func NewTwitterService ¶
func NewTwitterService(log *logrus.Logger, jwt *auth.JWTSecurity, session *SessionService) twitter.Service
NewTwitterService creates a twitter controller.
func NewUsersService ¶
func NewUsersService(log *logrus.Logger, jwt *auth.JWTSecurity, session *SessionService) user.Service
NewUsersService creates a user controller.
Types ¶
type FacebookRegisterMedia ¶
type FacebookService ¶
type FacebookService struct {
// contains filtered or unexported fields
}
FacebookController implements the facebook resource.
func (*FacebookService) APIKeyAuth ¶
func (s *FacebookService) APIKeyAuth(ctx context.Context, key string, scheme *security.APIKeyScheme) (context.Context, error)
APIKeyAuth implements the authorization logic for service "facebook" for the "api_key" security scheme.
func (*FacebookService) AttachToAccount ¶
func (s *FacebookService) AttachToAccount(ctx context.Context, p *facebook.AttachToAccountPayload) (res string, err error)
Attaches a Facebook account to an existing user account, returns the URL the browser should be redirected to
func (*FacebookService) DetachFromAccount ¶
func (s *FacebookService) DetachFromAccount(ctx context.Context, p *facebook.DetachFromAccountPayload) (err error)
Detaches a Facebook account from an existing user account.
func (*FacebookService) FacebookRegister ¶
func (s *FacebookService) FacebookRegister(ctx context.Context, grm *FacebookRegisterMedia, OauthKey string) (*facebook.UserMedia, error)
func (*FacebookService) JWTAuth ¶
func (s *FacebookService) JWTAuth(ctx context.Context, token string, scheme *security.JWTScheme) (context.Context, error)
JWTAuth implements the authorization logic for service "facebook" for the "jwt" security scheme.
func (*FacebookService) Receive ¶
func (s *FacebookService) Receive(ctx context.Context, p *facebook.ReceivePayload) (res *facebook.UserMedia, err error)
The endpoint that Facebook redirects the browser to after the user has authenticated
func (*FacebookService) RegisterURL ¶
func (s *FacebookService) RegisterURL(ctx context.Context, p *facebook.RegisterURLPayload) (res string, err error)
Gets the URL the front-end should redirect the browser to in order to be authenticated with Facebook, and then register
type FacebookUser ¶
type FacebookUser struct { ID string `json:"id"` Email string `json:"email"` FirstName string `json:"first_name"` LastName string `json:"last_name"` }
func (*FacebookUser) GetID ¶
func (g *FacebookUser) GetID() string
type GeoIP ¶
type GeoIP struct { // The right side is the name of the JSON variable Ip string `json:"ip"` CountryCode string `json:"country_code"` CountryName string `json:"country_name"` RegionCode string `json:"region_code"` RegionName string `json:"region_name"` City string `json:"city"` Zipcode string `json:"zipcode"` Lat float32 `json:"latitude"` Lon float32 `json:"longitude"` MetroCode int `json:"metro_code"` AreaCode int `json:"area_code"` }
type GoogleRegisterMedia ¶
type GoogleService ¶
type GoogleService struct {
// contains filtered or unexported fields
}
GoogleService implements the google resource.
func (*GoogleService) APIKeyAuth ¶
func (s *GoogleService) APIKeyAuth(ctx context.Context, key string, scheme *security.APIKeyScheme) (context.Context, error)
APIKeyAuth implements the authorization logic for service "google" for the "api_key" security scheme.
func (*GoogleService) AttachToAccount ¶
func (s *GoogleService) AttachToAccount(ctx context.Context, p *google.AttachToAccountPayload) (res string, err error)
Attaches a Google account to an existing user account, returns the URL the browser should be redirected to
func (*GoogleService) DetachFromAccount ¶
func (s *GoogleService) DetachFromAccount(ctx context.Context, p *google.DetachFromAccountPayload) (err error)
Detaches a Google account from an existing user account.
func (*GoogleService) GoogleRegister ¶
func (s *GoogleService) GoogleRegister(ctx context.Context, gr *GoogleRegisterMedia, OauthKey string) (*google.UserMedia, error)
func (*GoogleService) JWTAuth ¶
func (s *GoogleService) JWTAuth(ctx context.Context, token string, scheme *security.JWTScheme) (context.Context, error)
JWTAuth implements the authorization logic for service "google" for the "jwt" security scheme.
func (*GoogleService) Receive ¶
func (s *GoogleService) Receive(ctx context.Context, p *google.ReceivePayload) (res *google.UserMedia, err error)
The endpoint that Google redirects the browser to after the user has authenticated
func (*GoogleService) RegisterURL ¶
func (s *GoogleService) RegisterURL(ctx context.Context, p *google.RegisterURLPayload) (res string, err error)
Gets the URL the front-end should redirect the browser to in order to be authenticated with Google, and then register
type GoogleUser ¶
type GoogleUser struct { ID *string `json:"id"` FirstName string `json:"given_name"` LastName string `json:"family_name"` Email *string `json:"email"` }
func (*GoogleUser) GetEmail ¶
func (g *GoogleUser) GetEmail() string
type InstagramRegisterMedia ¶
type InstagramRegisterMedia struct { AccessToken *string `json:"access_token"` // Instagram user User *InstagramUserMedia `json:"user"` // A merge token for merging into an account OauthKey *string `json:"oauth_key"` Authorization *string `json:"authorization"` XSession *string `json:"x_session"` }
type InstagramService ¶
type InstagramService struct {
// contains filtered or unexported fields
}
InstagramService implements the instagram resource.
func (*InstagramService) APIKeyAuth ¶
func (s *InstagramService) APIKeyAuth(ctx context.Context, key string, scheme *security.APIKeyScheme) (context.Context, error)
APIKeyAuth implements the authorization logic for service "instagram" for the "api_key" security scheme.
func (*InstagramService) AttachToAccount ¶
func (s *InstagramService) AttachToAccount(ctx context.Context, p *instagram.AttachToAccountPayload) (res string, err error)
Attaches a Instagram account to an existing user account, returns the URL the browser should be redirected to
func (*InstagramService) DetachFromAccount ¶
func (s *InstagramService) DetachFromAccount(ctx context.Context, p *instagram.DetachFromAccountPayload) (err error)
Detaches a Instagram account from an existing user account.
func (*InstagramService) InstagramRegister ¶
func (s *InstagramService) InstagramRegister(ctx context.Context, gr *database.InstagramRegister, grm *InstagramRegisterMedia) (res *instagram.UserMedia, err error)
func (*InstagramService) JWTAuth ¶
func (s *InstagramService) JWTAuth(ctx context.Context, token string, scheme *security.JWTScheme) (context.Context, error)
JWTAuth implements the authorization logic for service "instagram" for the "jwt" security scheme.
func (*InstagramService) Receive ¶
func (s *InstagramService) Receive(ctx context.Context, p *instagram.ReceivePayload) (res *instagram.UserMedia, err error)
The endpoint that Instagram redirects the browser to after the user has authenticated
func (*InstagramService) RegisterURL ¶
func (s *InstagramService) RegisterURL(ctx context.Context, p *instagram.RegisterURLPayload) (res string, err error)
Gets the URL the front-end should redirect the browser to in order to be authenticated with Instagram, and then register
type InstagramUser ¶
type InstagramUser struct { AccessToken string `json:"access_token"` User struct { ID string `json:"id"` Username string `json:"username"` FullName string `json:"full_name"` ProfilePicture string `json:"profile_picture"` } `json:"user"` }
func (*InstagramUser) GetID ¶
func (g *InstagramUser) GetID() string
type InstagramUserMedia ¶
type InstagramUserMedia struct { // Instagram id of connected account ID *string `json:"id"` // Instagram username of connected account Username *string `json:"username"` // Full name of the user FullName *string `json:"full_name"` // Instagram DP of the user ProfilePicture *string `json:"profile_picture"` }
type LinkedinRegisterMedia ¶
type LinkedinService ¶
type LinkedinService struct {
// contains filtered or unexported fields
}
LinkedinService implements the linkedin resource.
func (*LinkedinService) APIKeyAuth ¶
func (s *LinkedinService) APIKeyAuth(ctx context.Context, key string, scheme *security.APIKeyScheme) (context.Context, error)
APIKeyAuth implements the authorization logic for service "linkedin" for the "api_key" security scheme.
func (*LinkedinService) AttachToAccount ¶
func (s *LinkedinService) AttachToAccount(ctx context.Context, p *linkedin.AttachToAccountPayload) (res string, err error)
Attaches a Linkedin account to an existing user account, returns the URL the browser should be redirected to
func (*LinkedinService) DetachFromAccount ¶
func (s *LinkedinService) DetachFromAccount(ctx context.Context, p *linkedin.DetachFromAccountPayload) (err error)
Detaches a Linkedin account from an existing user account.
func (*LinkedinService) JWTAuth ¶
func (s *LinkedinService) JWTAuth(ctx context.Context, token string, scheme *security.JWTScheme) (context.Context, error)
JWTAuth implements the authorization logic for service "linkedin" for the "jwt" security scheme.
func (*LinkedinService) LinkedinRegister ¶
func (s *LinkedinService) LinkedinRegister(ctx context.Context, grm *LinkedinRegisterMedia, OauthKey string) (*linkedin.UserMedia, error)
func (*LinkedinService) Receive ¶
func (s *LinkedinService) Receive(ctx context.Context, p *linkedin.ReceivePayload) (res *linkedin.UserMedia, err error)
The endpoint that Linkedin redirects the browser to after the user has authenticated
func (*LinkedinService) RegisterURL ¶
func (s *LinkedinService) RegisterURL(ctx context.Context, p *linkedin.RegisterURLPayload) (res string, err error)
Gets the URL the front-end should redirect the browser to in order to be authenticated with Linkedin, and then register
type LinkedinUser ¶
type PasswordAuthService ¶
type PasswordAuthService struct {
// contains filtered or unexported fields
}
PasswordAuthService implements the password-auth resource.
func (*PasswordAuthService) APIKeyAuth ¶
func (s *PasswordAuthService) APIKeyAuth(ctx context.Context, key string, scheme *security.APIKeyScheme) (context.Context, error)
APIKeyAuth implements the authorization logic for service "password-auth" for the "api_key" security scheme.
func (*PasswordAuthService) ChangePassword ¶
func (s *PasswordAuthService) ChangePassword(ctx context.Context, p *passwordauth.ChangePasswordParams) (err error)
Changes the user's current password to a new one, also adds a password to the account if there is none
func (*PasswordAuthService) CheckEmailAvailable ¶
func (s *PasswordAuthService) CheckEmailAvailable(ctx context.Context, p *passwordauth.CheckEmailAvailablePayload) (res bool, err error)
func (*PasswordAuthService) CheckPhoneAvailable ¶
func (s *PasswordAuthService) CheckPhoneAvailable(ctx context.Context, p *passwordauth.CheckPhoneAvailablePayload) (res bool, err error)
func (*PasswordAuthService) CheckUsernameAvailable ¶
func (s *PasswordAuthService) CheckUsernameAvailable(ctx context.Context, p *passwordauth.CheckUsernameAvailablePayload) (res bool, err error)
func (*PasswordAuthService) ConfirmReset ¶
func (s *PasswordAuthService) ConfirmReset(ctx context.Context, p *passwordauth.ResetPasswordParams) (err error)
Confirms that a reset has been completed and changes the password to the new one passed in
func (*PasswordAuthService) JWTAuth ¶
func (s *PasswordAuthService) JWTAuth(ctx context.Context, token string, scheme *security.JWTScheme) (context.Context, error)
JWTAuth implements the authorization logic for service "password-auth" for the "jwt" security scheme.
func (*PasswordAuthService) Login ¶
func (s *PasswordAuthService) Login(ctx context.Context, p *passwordauth.LoginParams) (res *passwordauth.UserMedia, err error)
Login a user using an email and password
func (*PasswordAuthService) Register ¶
func (s *PasswordAuthService) Register(ctx context.Context, p *passwordauth.RegisterParams) (res *passwordauth.UserMedia, err error)
Register a new user with an email and password
func (*PasswordAuthService) Remove ¶
func (s *PasswordAuthService) Remove(ctx context.Context, p *passwordauth.RemovePayload) (err error)
Removes using a password as a login method
func (*PasswordAuthService) Reset ¶
func (s *PasswordAuthService) Reset(ctx context.Context, p *passwordauth.ResetPayload) (err error)
Send an email to user to get a password reset, responds with no content even if the email is not on any user account
type SessionService ¶
type SessionService struct {
// contains filtered or unexported fields
}
SessionService implements the session resource.
func NewSessionService ¶
func NewSessionService(log *logrus.Logger, jwt *auth.JWTSecurity) *SessionService
NewSessionService creates a session controller.
func (*SessionService) APIKeyAuth ¶
func (s *SessionService) APIKeyAuth(ctx context.Context, key string, scheme *security.APIKeyScheme) (context.Context, error)
APIKeyAuth implements the authorization logic for service "session" for the "api_key" security scheme.
func (*SessionService) CleanLoginToken ¶
func (s *SessionService) CleanLoginToken(ctx context.Context, p *session.CleanLoginTokenPayload) (err error)
Cleans old login tokens from the database
func (*SessionService) CleanMergeToken ¶
func (s *SessionService) CleanMergeToken(ctx context.Context, p *session.CleanMergeTokenPayload) (err error)
Cleans old account merge tokens from the database
func (*SessionService) CleanSessions ¶
func (s *SessionService) CleanSessions(ctx context.Context, p *session.CleanSessionsPayload) (err error)
Deletes all the sessions that have expired
func (*SessionService) GetSessions ¶
func (s *SessionService) GetSessions(ctx context.Context, p *session.GetSessionsPayload) (res *session.AllSessions, err error)
Gets all of the sessions that are associated with the currently logged in user
func (*SessionService) JWTAuth ¶
func (s *SessionService) JWTAuth(ctx context.Context, token string, scheme *security.JWTScheme) (context.Context, error)
JWTAuth implements the authorization logic for service "session" for the "jwt" security scheme.
func (*SessionService) Logout ¶
func (s *SessionService) Logout(ctx context.Context, p *session.LogoutPayload) (err error)
Takes a user's auth token, and logs-out the session associated with it
func (*SessionService) LogoutOther ¶
func (s *SessionService) LogoutOther(ctx context.Context, p *session.LogoutOtherPayload) (err error)
Logout all sessions for the current user except their current session
func (*SessionService) LogoutSpecific ¶
func (s *SessionService) LogoutSpecific(ctx context.Context, p *session.LogoutSpecificPayload) (err error)
Logout of a specific session
func (*SessionService) RedeemToken ¶
func (s *SessionService) RedeemToken(ctx context.Context, p *session.RedeemTokenPayload) (res *session.RedeemTokenResult, err error)
Redeems a login token for credentials
func (*SessionService) Refresh ¶
func (s *SessionService) Refresh(ctx context.Context, p *session.RefreshPayload) (res *session.RefreshResult, err error)
Take a user's session token and refresh it, also returns a new authentication token
type TwitterRegisterMedia ¶
type TwitterService ¶
type TwitterService struct {
// contains filtered or unexported fields
}
TwitterService implements the twitter resource.
func (*TwitterService) APIKeyAuth ¶
func (s *TwitterService) APIKeyAuth(ctx context.Context, key string, scheme *security.APIKeyScheme) (context.Context, error)
APIKeyAuth implements the authorization logic for service "twitter" for the "api_key" security scheme.
func (*TwitterService) AttachToAccount ¶
func (s *TwitterService) AttachToAccount(ctx context.Context, p *twitter.AttachToAccountPayload) (res string, err error)
Attaches a Twitter account to an existing user account, returns the URL the browser should be redirected to
func (*TwitterService) DetachFromAccount ¶
func (s *TwitterService) DetachFromAccount(ctx context.Context, p *twitter.DetachFromAccountPayload) (err error)
Detaches a Twitter account from an existing user account.
func (*TwitterService) JWTAuth ¶
func (s *TwitterService) JWTAuth(ctx context.Context, token string, scheme *security.JWTScheme) (context.Context, error)
JWTAuth implements the authorization logic for service "twitter" for the "jwt" security scheme.
func (*TwitterService) Receive ¶
func (s *TwitterService) Receive(ctx context.Context, p *twitter.ReceivePayload) (res *twitter.UserMedia, err error)
The endpoint that Twitter redirects the browser to after the user has authenticated
func (*TwitterService) RegisterURL ¶
func (s *TwitterService) RegisterURL(ctx context.Context, p *twitter.RegisterURLPayload) (res string, err error)
Gets the URL the front-end should redirect the browser to in order to be authenticated with Twitter, and then register
func (*TwitterService) TwitterRegister ¶
func (s *TwitterService) TwitterRegister(ctx context.Context, grm *TwitterRegisterMedia, OauthKey string) (*twitter.UserMedia, error)
type UsersService ¶
type UsersService struct {
// contains filtered or unexported fields
}
UsersService implements the user resource.
func (*UsersService) APIKeyAuth ¶
func (s *UsersService) APIKeyAuth(ctx context.Context, key string, scheme *security.APIKeyScheme) (context.Context, error)
APIKeyAuth implements the authorization logic for service "user" for the "api_key" security scheme.
func (*UsersService) Deactivate ¶
func (s *UsersService) Deactivate(ctx context.Context, p *user.DeactivatePayload) (retErr error)
Disable a user's account
func (*UsersService) GetAuths ¶
func (s *UsersService) GetAuths(ctx context.Context, p *user.GetAuthsPayload) (res *user.AuthStatusMedia, retErr error)
Returns whether Oauth is attached or not
func (*UsersService) GetUser ¶
func (s *UsersService) GetUser(ctx context.Context, p *user.GetUserPayload) (res *user.UserMedia, retErr error)
func (*UsersService) JWTAuth ¶
func (s *UsersService) JWTAuth(ctx context.Context, token string, scheme *security.JWTScheme) (context.Context, error)
JWTAuth implements the authorization logic for service "user" for the "jwt" security scheme.
func (*UsersService) ResendVerifyEmail ¶
func (s *UsersService) ResendVerifyEmail(ctx context.Context, p *user.ResendVerifyEmailPayload) (err error)
Resends a verify email for the current user, also invalidates the link on the previously send email verification
func (*UsersService) UpdateUser ¶
func (s *UsersService) UpdateUser(ctx context.Context, p *user.UserUpdateParams) (res *user.UserMedia, retErr error)
Update a user
func (*UsersService) ValidateEmail ¶
func (s *UsersService) ValidateEmail(ctx context.Context, p *user.ValidateEmailPayload) (err error)
Validates an email address, designed to be called by users directly in their browser