Files
threshold/internal/boundary/boundary.go
T
Jeff Mitchell b41e983503 Reorder authz check for sessions (#2042)
* Reorder session authz checks

This implements a mechanism for service handlers to pass a repo
satisfying an interface into the scope IDs listing function. The purpose
of this interface is to allow the same function to perform authorization
checking against resources rather than requiring service handlers to
fetch all resources in the determined set of scopes and then perform
this checking. While this could be done in each service handler, this
approach centralizes the logic, which has the nice benefit of removing
some boilerplate from service handler list functions that have adapted
to it.

Tests haven't changed, which is expected -- the function should return
exactly what was being returned before, simply faster.
2022-04-29 16:33:43 -04:00

39 lines
1.0 KiB
Go

// Package boundary contains global interfaces and other definitions that
// define the Boundary domain.
package boundary
import (
"github.com/hashicorp/boundary/internal/db/timestamp"
)
// An Entity is an object distinguished by its identity, rather than its
// attributes. It can contain value objects and other entities.
type Entity interface {
GetPublicId() string
}
// An Aggregate is an entity that is the root of a transactional
// consistency boundary.
type Aggregate interface {
Entity
GetVersion() uint32
GetCreateTime() *timestamp.Timestamp
GetUpdateTime() *timestamp.Timestamp
}
// A Resource is an aggregate with a name and description.
type Resource interface {
Aggregate
GetName() string
GetDescription() string
}
// AuthzProtectedEntity is used by some functions (primarily
// scopeids.AuthzProtectedEntityProvider-conforming implementations) to deliver
// some common information necessary for calculating authz.
type AuthzProtectedEntity interface {
Entity
GetScopeId() string
GetUserId() string
}