Skip to content
Draft
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
8 changes: 8 additions & 0 deletions docs/Configuring.md
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,14 @@ Root level key `authorization`
| `request_limits.get_decision_multi_resource_resources_max` | Maximum resources allowed in `GetDecisionMultiResourceRequest` | `1000` | |
| `request_limits.get_decision_bulk_decision_requests_max` | Maximum decision requests allowed in `GetDecisionBulkRequest` | `200` | |

Authorization v2 compiles registered-resource and obligation indexes once per cache
refresh and shares the completed snapshot across requests. The first successful
refresh is shared by concurrent callers. A failed refresh retains the last successful
snapshot, so policy changes become visible after a successful refresh. Caching remains
disabled by default. Attributes and subject mappings are refreshed only when direct
entitlements or dynamic value mappings are enabled; ordinary decisions fetch their
required attributes directly from the policy service.

#### Example: Authorization v1

```yaml
Expand Down
11 changes: 3 additions & 8 deletions service/authorization/v2/authorization.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import (
"github.com/opentdf/platform/service/internal/access/v2"
"github.com/opentdf/platform/service/logger"
ctxAuth "github.com/opentdf/platform/service/pkg/auth"
"github.com/opentdf/platform/service/pkg/cache"
"github.com/opentdf/platform/service/pkg/serviceregistry"
"go.opentelemetry.io/otel/trace"
"google.golang.org/protobuf/types/known/wrapperspb"
Expand Down Expand Up @@ -85,20 +84,16 @@ func NewRegistration() *serviceregistry.Service[authzV2Connect.AuthorizationServ
return as, nil
}

cacheClient, err := srp.NewCacheClient(cache.Options{})
if err != nil || cacheClient == nil {
l.Error("failed to create platform cache client", slog.Any("error", err))
panic(fmt.Errorf("failed to create platform cache client: %w", err))
}

refreshInterval, err := time.ParseDuration(authZCfg.Cache.RefreshInterval)
if err != nil {
l.Error("failed to parse entitlement policy cache refresh interval", slog.Any("error", err))
panic(fmt.Errorf("failed to parse entitlement policy cache refresh interval [%s]: %w", authZCfg.Cache.RefreshInterval, err))
}

retriever := access.NewEntitlementPolicyRetriever(as.sdk)
as.cache, err = NewEntitlementPolicyCache(context.Background(), l, retriever, cacheClient, refreshInterval, authZCfg.AllowDynamicValueMappings)
as.cache, err = NewEntitlementPolicyCache(context.Background(), l, retriever, refreshInterval, access.PolicyOptions{
AllowDirectEntitlements: authZCfg.AllowDirectEntitlements, AllowDynamicValueMappings: authZCfg.AllowDynamicValueMappings, NamespacedPolicy: authZCfg.EnforceNamespacedEntitlements,
})
if err != nil {
l.Error("failed to create entitlement policy cache", slog.Any("error", err))
panic(fmt.Errorf("failed to create entitlement policy cache: %w", err))
Expand Down
Loading
Loading