Skip to content
Snippets Groups Projects
Commit 81c2463e authored by ale's avatar ale
Browse files

Update Client with session IDs

parent 46112664
Branches
No related tags found
No related merge requests found
Pipeline #45238 failed
......@@ -14,9 +14,9 @@ var ErrNoKeys = errors.New("no keys available")
// Client for the keystore API.
type Client interface {
Open(context.Context, string, string, string, int) error
Open(context.Context, string, string, string, string, int) error
Get(context.Context, string, string, string) ([]byte, error)
Close(context.Context, string, string) error
Close(context.Context, string, string, string) error
}
type ksClient struct {
......@@ -32,11 +32,12 @@ func New(config *clientutil.BackendConfig) (Client, error) {
return &ksClient{be}, nil
}
func (c *ksClient) Open(ctx context.Context, shard, username, password string, ttl int) error {
func (c *ksClient) Open(ctx context.Context, shard, username, password, sessionID string, ttl int) error {
req := keystore.OpenRequest{
Username: username,
Password: password,
TTL: ttl,
Username: username,
Password: password,
TTL: ttl,
SessionID: sessionID,
}
var resp keystore.OpenResponse
return c.be.Call(ctx, shard, "/api/open", &req, &resp)
......@@ -58,9 +59,10 @@ func (c *ksClient) Get(ctx context.Context, shard, username, ssoTicket string) (
return resp.Key, err
}
func (c *ksClient) Close(ctx context.Context, shard, username string) error {
func (c *ksClient) Close(ctx context.Context, shard, username, sessionID string) error {
req := keystore.CloseRequest{
Username: username,
Username: username,
SessionID: sessionID,
}
var resp keystore.CloseResponse
return c.be.Call(ctx, shard, "/api/close", &req, &resp)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment