Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions lib/auth/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -969,6 +969,9 @@ type Cache interface {
// GetAppSession gets an application web session.
GetAppSession(context.Context, types.GetAppSessionRequest) (types.WebSession, error)

// ListAppSessions returns a page of application web sessions.
ListAppSessions(ctx context.Context, pageSize int, pageToken, user string) ([]types.WebSession, string, error)

// GetSnowflakeSession gets a Snowflake web session.
GetSnowflakeSession(context.Context, types.GetSnowflakeSessionRequest) (types.WebSession, error)

Expand Down
13 changes: 13 additions & 0 deletions lib/cache/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -2272,6 +2272,19 @@ func (c *Cache) GetAppSession(ctx context.Context, req types.GetAppSessionReques
return sess, trace.Wrap(err)
}

// ListAppSessions returns a page of application web sessions.
func (c *Cache) ListAppSessions(ctx context.Context, pageSize int, pageToken, user string) ([]types.WebSession, string, error) {
ctx, span := c.Tracer.Start(ctx, "cache/ListAppSessions")
defer span.End()

rg, err := readCollectionCache(c, c.collections.appSessions)
if err != nil {
return nil, "", trace.Wrap(err)
}
defer rg.Release()
return rg.reader.ListAppSessions(ctx, pageSize, pageToken, user)
}

// GetSnowflakeSession gets Snowflake web session.
func (c *Cache) GetSnowflakeSession(ctx context.Context, req types.GetSnowflakeSessionRequest) (types.WebSession, error) {
ctx, span := c.Tracer.Start(ctx, "cache/GetSnowflakeSession")
Expand Down
1 change: 1 addition & 0 deletions lib/cache/collections.go
Original file line number Diff line number Diff line change
Expand Up @@ -1458,6 +1458,7 @@ func (appSessionExecutor) getReader(cache *Cache, cacheOK bool) appSessionGetter

type appSessionGetter interface {
GetAppSession(ctx context.Context, req types.GetAppSessionRequest) (types.WebSession, error)
ListAppSessions(ctx context.Context, pageSize int, pageToken, user string) ([]types.WebSession, string, error)
}

var _ executor[types.WebSession, appSessionGetter] = appSessionExecutor{}
Expand Down