Skip to content

Commit

Permalink
Adds Lock handling methods to OktaAccessPoint (#36221)
Browse files Browse the repository at this point in the history
As the Okta service now needs to manipulate locks, the service's AccessPoint
(i.e. its interface to Teleport auth) needs to have methods for CRUD
operations on locks.

This PR adds them to the Okta imterface.
  • Loading branch information
tcsc committed Jan 4, 2024
1 parent d22eca1 commit 790f959
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions lib/auth/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -803,6 +803,9 @@ type ReadOktaAccessPoint interface {

// ListResources returns a paginated list of resources.
ListResources(ctx context.Context, req proto.ListResourcesRequest) (*types.ListResourcesResponse, error)

// GetLocks lists the locks that target a given set of resources.
GetLocks(ctx context.Context, inForceOnly bool, targets ...types.LockTarget) ([]types.Lock, error)
}

// OktaAccessPoint is a read caching interface used by an Okta component.
Expand Down Expand Up @@ -855,6 +858,12 @@ type OktaAccessPoint interface {

// DeleteApplicationServer removes specified application server.
DeleteApplicationServer(ctx context.Context, namespace, hostID, name string) error

// UpsertLock creates or updates a given lock
UpsertLock(ctx context.Context, lock types.Lock) error

// DeleteLock deletes a given lock
DeleteLock(ctx context.Context, name string) error
}

// AccessCache is a subset of the interface working on the certificate authorities
Expand Down Expand Up @@ -1373,6 +1382,21 @@ func (w *OktaWrapper) DeleteApplicationServer(ctx context.Context, namespace, ho
return w.NoCache.DeleteApplicationServer(ctx, namespace, hostID, name)
}

// GetLocks fetches locks that target a given set of resources
func (w *OktaWrapper) GetLocks(ctx context.Context, inForceOnly bool, targets ...types.LockTarget) ([]types.Lock, error) {
return w.NoCache.GetLocks(ctx, inForceOnly, targets...)
}

// UpsertLock creates and/or updates lock resources
func (w *OktaWrapper) UpsertLock(ctx context.Context, lock types.Lock) error {
return w.NoCache.UpsertLock(ctx, lock)
}

// DeleteLock deletes a lock by name
func (w *OktaWrapper) DeleteLock(ctx context.Context, name string) error {
return w.NoCache.DeleteLock(ctx, name)
}

// Close closes all associated resources
func (w *OktaWrapper) Close() error {
err := w.NoCache.Close()
Expand Down

0 comments on commit 790f959

Please sign in to comment.