Documentation
¶
Index ¶
- type Client
- func (c *Client) CreateUser(ctx context.Context, uid, pwd string, newUser User) error
- func (c *Client) DeleteUser(ctx context.Context, uid, pwd, usrToBeDeleted string) error
- func (c *Client) Login(ctx context.Context, uid, pwd string) (string, error)
- func (c *Client) RefreshToken(ctx context.Context, refreshToken []byte) (*auth.Payload, error)
- func (c *Client) UpdatePassword(ctx context.Context, uid, pwd, usrToBeUpdated, newPwd string) error
- type RedisManager
- type UIDClient
- type User
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
}
Client defines a Redis client, which has the interface methods
func NewRedisClient ¶
func NewRedisClient() *Client
NewRedisClient creates and returns a new Redis client
func (*Client) CreateUser ¶
CreateUser inserts a new user into Redis
func (*Client) DeleteUser ¶
DeleteUser deletes an user from Redis, if it exists
func (*Client) Login ¶
Login receives an user and a password, and checks if they exist and match. If so, it sends a request to Insprd so it can generate a new token for the given user, and returns the toker if it's creation was successful
func (*Client) RefreshToken ¶
RefreshToken receives a refreshToken and checks if it's valid. If so, it returns a payload containing the updated user info (user which is associated with the given refreshToken)
type RedisManager ¶
type RedisManager interface { UIDClient RefreshToken(ctx context.Context, refreshToken []byte) (*auth.Payload, error) }
RedisManager defines methods to manage Redis in the cluster
type UIDClient ¶
type UIDClient interface { // creates payload and sends it to insprd // when creating the payload, generetes the Refresh Token (cryptografado) Login(ctx context.Context, uid, pwd string) (string, error) // asks Insprd to generate token and saves it into file CreateUser(ctx context.Context, uid, pwd string, newUser User) error DeleteUser(ctx context.Context, uid, pwd, usrToBeDeleted string) error UpdatePassword(ctx context.Context, uid, pwd, usrToBeUpdated, newPwd string) error }
UIDClient is a client for communicating with inspr's uid provider