Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterOAuthClient ¶
func RegisterOAuthClient(client OAuthClient)
RegisterOAuthClient registers an oauth client for resource.
Types ¶
type AuthClient ¶ added in v1.0.3
type AuthClient interface { CreateToken(ctx context.Context, in *authProto.CreateTokenRequest) (*authProto.CreateTokenResponse, error) DeleteToken(ctx context.Context, in *authProto.DeleteTokenRequest) (*empty.Empty, error) DeleteUserTokens(ctx context.Context, in *authProto.DeleteUserTokensRequest) (*empty.Empty, error) }
AuthClient is an extension of AuthClient interface with Closer interface to close connection
func NewHTTPAuthClient ¶ added in v1.0.3
func NewHTTPAuthClient(serverURL string) (AuthClient, error)
NewHTTPAuthClient returns client for auth service works using http protocol
type MailClient ¶
type MailClient interface { SendConfirmationMail(ctx context.Context, recipient *mttypes.Recipient) error SendActivationMail(ctx context.Context, recipient *mttypes.Recipient) error SendBlockedMail(ctx context.Context, recipient *mttypes.Recipient) error SendUnBlockedMail(ctx context.Context, recipient *mttypes.Recipient) error SendPasswordChangedMail(ctx context.Context, recipient *mttypes.Recipient) error SendPasswordResetMail(ctx context.Context, recipient *mttypes.Recipient) error SendAccDeletedMail(ctx context.Context, recipient *mttypes.Recipient) error }
MailClient is an interface to mail-templater service
func NewHTTPMailClient ¶
func NewHTTPMailClient(serverURL string) MailClient
NewHTTPMailClient returns client for mail-templater service working via restful api
type OAuthClient ¶
type OAuthClient interface { GetUserInfo(ctx context.Context, authCode string) (*OAuthUserInfo, error) GetResource() models.OAuthResource }
OAuthClient is an interface to 3rd-party resource for fetching information needed for login
func NewFacebookOAuthClient ¶
func NewFacebookOAuthClient() OAuthClient
NewFacebookOAuthClient returns resty client for http://facebook.com
func NewGithubOAuthClient ¶
func NewGithubOAuthClient() OAuthClient
NewGithubOAuthClient returns resty client for http://github.com
func NewGoogleOAuthClient ¶
func NewGoogleOAuthClient() OAuthClient
NewGoogleOAuthClient returns resty client for http://google.com
func OAuthClientByResource ¶
func OAuthClientByResource(resource models.OAuthResource) (client OAuthClient, exists bool)
OAuthClientByResource returns oauth client for service by it`s name. Client for resource must be registered using RegisterOAuthClient
type OAuthUserInfo ¶
OAuthUserInfo describes information about user needed to login via 3rd-party resource
type PermissionsClient ¶
type PermissionsClient interface { // GetUserAccess returns information about user access to resources (namespace, volumes) needed for token creation. GetUserAccess(ctx context.Context, user *db.User) (*authProto.ResourcesAccess, error) DeleteUserNamespaces(ctx context.Context, user *db.User) error }
PermissionsClient is an interface to resource-service.
func NewHTTPPermissionsClient ¶
func NewHTTPPermissionsClient(serverURL string) PermissionsClient
NewHTTPPermissionsClient returns client for resource-service working via restful api
type ReCaptchaClient ¶
type ReCaptchaClient interface {
Check(ctx context.Context, remoteIP, clientResponse string) (r *ReCaptchaResponse, err error)
}
ReCaptchaClient is an interface to Google`s ReCaptcha service
func NewDummyReCaptchaClient ¶
func NewDummyReCaptchaClient() ReCaptchaClient
NewDummyReCaptchaClient returns a dummy client. It returns success on any request and log actions. Useful for testing purposes.
func NewHTTPReCaptchaClient ¶
func NewHTTPReCaptchaClient(privateKey string) ReCaptchaClient
NewHTTPReCaptchaClient returns client for ReCaptcha service working via HTTP
type ReCaptchaResponse ¶
type ReCaptchaResponse struct { Success bool `json:"success"` ChallengeTS time.Time `json:"challenge_ts"` Hostname string `json:"hostname"` ErrorCodes []int `json:"error-codes"` }
ReCaptchaResponse describes response from ReCaptcha service. It`s enough to check only "Success" field. Other fields is for logging purposes.
type TelegramClient ¶ added in v1.0.3
type TelegramClient interface { SendRegistrationMessage(ctx context.Context, userLogin string) error SendActivationMessage(ctx context.Context, userLogin string) error }
AuthClient is an extension of AuthClient interface with Closer interface to close connection
func NewTelegramClient ¶ added in v1.0.3
func NewTelegramClient(botid, token, chatid string) (TelegramClient, error)
NewTelegramClient returns client for auth service works using http protocol