Documentation
¶
Index ¶
- type Client
- func (client *Client) Close()
- func (client *Client) GetUnverifiedUsers(ctx context.Context, token string) ([]UserData, error)
- func (client *Client) GetUser(ctx context.Context, userId, token string) (*UserData, error)
- func (client *Client) Start() error
- func (client *Client) TokenProvide() string
- func (client *Client) UpdateUser(ctx context.Context, userId string, userUpdate UserUpdate, token string) error
- type ClientBuilder
- func (b *ClientBuilder) Build() *Client
- func (b *ClientBuilder) WithConfig(val *ClientConfig) *ClientBuilder
- func (b *ClientBuilder) WithHTTPClient(httpClient *http.Client) *ClientBuilder
- func (b *ClientBuilder) WithHost(host string) *ClientBuilder
- func (b *ClientBuilder) WithName(val string) *ClientBuilder
- func (b *ClientBuilder) WithSecret(val string) *ClientBuilder
- func (b *ClientBuilder) WithTokenGetInterval(val time.Duration) *ClientBuilder
- func (b *ClientBuilder) WithTokenRefreshInterval(val time.Duration) *ClientBuilder
- type ClientConfig
- type ShorelineMockClient
- func (client *ShorelineMockClient) Close()
- func (client *ShorelineMockClient) DeleteUser(userId string, token string) error
- func (client *ShorelineMockClient) GetUnverifiedUsers(token string) ([]UserData, error)
- func (client *ShorelineMockClient) GetUser(userID, token string) (*UserData, error)
- func (client *ShorelineMockClient) Start() error
- func (client *ShorelineMockClient) TokenProvide() string
- func (client *ShorelineMockClient) UpdateUser(userID string, userUpdate UserUpdate, token string) error
- type UserData
- type UserUpdate
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func NewShorelineClientFromEnv ¶
NewShorelineClientFromEnv read the config from the environment variables
func (*Client) GetUnverifiedUsers ¶
Get users with unverified email
func (*Client) GetUser ¶
Get user details for the given user (from legacy auth system) In this case the userID could be the actual ID or an email address
func (*Client) Start ¶
Start starts the client and makes it ready for us. This must be done before using any of the functionality that requires a server token
func (*Client) TokenProvide ¶
Return a valid service token
func (*Client) UpdateUser ¶
func (client *Client) UpdateUser(ctx context.Context, userId string, userUpdate UserUpdate, token string) error
Update a user in backloops legacy authentication db (shoreline)
type ClientBuilder ¶
type ClientBuilder struct {
// contains filtered or unexported fields
}
func NewShorelineClientBuilder ¶
func NewShorelineClientBuilder() *ClientBuilder
func (*ClientBuilder) Build ¶
func (b *ClientBuilder) Build() *Client
Build return client from builder
func (*ClientBuilder) WithConfig ¶
func (b *ClientBuilder) WithConfig(val *ClientConfig) *ClientBuilder
WithConfig sets the whole config
func (*ClientBuilder) WithHTTPClient ¶
func (b *ClientBuilder) WithHTTPClient(httpClient *http.Client) *ClientBuilder
WithHTTPClient set the HTTP client
func (*ClientBuilder) WithHost ¶
func (b *ClientBuilder) WithHost(host string) *ClientBuilder
WithHost set the host
func (*ClientBuilder) WithName ¶
func (b *ClientBuilder) WithName(val string) *ClientBuilder
WithName sets the name of the server (config)
func (*ClientBuilder) WithSecret ¶
func (b *ClientBuilder) WithSecret(val string) *ClientBuilder
WithSecret sets the secret (config)
func (*ClientBuilder) WithTokenGetInterval ¶
func (b *ClientBuilder) WithTokenGetInterval(val time.Duration) *ClientBuilder
WithTokenGetInterval sets the duration interval for token initial ack (config)
func (*ClientBuilder) WithTokenRefreshInterval ¶
func (b *ClientBuilder) WithTokenRefreshInterval(val time.Duration) *ClientBuilder
WithTokenRefreshInterval sets the duration interval for token refresh (config)
type ClientConfig ¶
type ClientConfig struct {
Name string `json:"name"` // The name of this server for use in obtaining a server token
Secret string `json:"secret"` // The secret used along with the name to obtain a server token
TokenRefreshInterval time.Duration `json:"tokenRefreshInterval"` // The amount of time between refreshes of the server token
TokenGetInterval time.Duration `json:"tokenGetInterval"` // The amount of time between attempts to get the server token
}
type ShorelineMockClient ¶
func NewMock ¶
func NewMock(token string) *ShorelineMockClient
func (*ShorelineMockClient) Close ¶
func (client *ShorelineMockClient) Close()
func (*ShorelineMockClient) DeleteUser ¶
func (client *ShorelineMockClient) DeleteUser(userId string, token string) error
func (*ShorelineMockClient) GetUnverifiedUsers ¶
func (client *ShorelineMockClient) GetUnverifiedUsers(token string) ([]UserData, error)
func (*ShorelineMockClient) GetUser ¶
func (client *ShorelineMockClient) GetUser(userID, token string) (*UserData, error)
func (*ShorelineMockClient) Start ¶
func (client *ShorelineMockClient) Start() error
func (*ShorelineMockClient) TokenProvide ¶
func (client *ShorelineMockClient) TokenProvide() string
func (*ShorelineMockClient) UpdateUser ¶
func (client *ShorelineMockClient) UpdateUser(userID string, userUpdate UserUpdate, token string) error
type UserData ¶
type UserData struct {
UserID string `json:"userid,omitempty" bson:"userid,omitempty"` // map userid to id
Username string `json:"username,omitempty" bson:"username,omitempty"`
Emails []string `json:"emails,omitempty" bson:"emails,omitempty"`
PasswordExists bool `json:"passwordExists,omitempty"` // Does a password exist for the user?
Roles []string `json:"roles,omitempty" bson:"roles,omitempty"`
TermsAccepted string `json:"termsAccepted,omitempty" bson:"termsAccepted,omitempty"`
EmailVerified bool `json:"emailVerified" bson:"authenticated"` //tag is name `authenticated` for historical reasons
IdVerified bool `json:"idVerified"`
}
UserData is the data structure returned from a successful Login query.
type UserUpdate ¶
type UserUpdate struct {
Username *string `json:"username,omitempty"`
Emails *[]string `json:"emails,omitempty"`
Password *string `json:"password,omitempty"`
Roles *[]string `json:"roles,omitempty"`
EmailVerified *bool `json:"emailVerified,omitempty"`
}
UserUpdate is the data structure for updating of a users details