-
Notifications
You must be signed in to change notification settings - Fork 24
feat(authz): authz v2 versioning implementation #2173
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
57 commits
Select commit
Hold shift + click to select a range
afe3ad1
feat(authz): GetEntitlementsV2 protos and gencode
jakedoublev c547edc
fix copilot-flagged comment
jakedoublev 8843729
proto fixes
jakedoublev 65fd691
put back auth service change accidentally committed
jakedoublev 288592d
latest changes
jakedoublev 999a876
draft v2 protos
jakedoublev 50d8436
put back original authz protos
jakedoublev 6993846
Merge branch 'main' into feat/entitle-actions-protos
jakedoublev 88c25d2
undo change to original authn proto file
ryanulit b3c41f3
rename reg res fqn to use value
ryanulit 13cf017
add entity chain comment
ryanulit ec22eb2
Merge branch 'main' into feat/entitle-actions-protos
ryanulit decdd36
Merge branch 'main' into feat/entitle-actions-protos
ryanulit 7e9e22b
rename bulk methods to use same prefix
ryanulit 2364f25
update protos per meeting outcome
jakedoublev c25a26f
cleanup
jakedoublev 8d3b5ca
Merge branch 'main' into feat/entitle-actions-protos
jakedoublev fe76f4b
Merge branch 'main' into feat/entitle-actions-protos
jakedoublev 03651a8
ERS should take new authv2 entity proto
jakedoublev 5dad8b5
Merge remote-tracking branch 'origin' into feat/entitle-actions-protos
jakedoublev 999428f
auth v2 service scaffold and versioned registration/sdk
ryanulit 095d515
add proper deprecated comments
ryanulit aade0d6
remove non-proto changes moved to separate branch
ryanulit 76390ab
Merge remote-tracking branch 'origin' into feat/entitle-actions-protos
jakedoublev 8833bcb
Merge branch 'main' into feat/entitle-actions-protos
jakedoublev 944a7a8
drop scope from GetEntitlements
jakedoublev ab1fc4f
comment clarity
jakedoublev 120ba08
Merge branch 'main' into feat/entitle-actions-protos
jakedoublev 038cf7d
Merge branch 'main' into feat/entitle-actions-protos
jakedoublev 6cfb545
update protos
jakedoublev 8be0ff6
improve protovalidate rules
jakedoublev 0fdab47
improve protovalidate rules
jakedoublev be2118d
GetDecisionByTokenMultiResource addition
jakedoublev 066cb55
deprecated comments
jakedoublev f003f41
use v1 messages in v2 authz where it makes sense (token and entity ch…
jakedoublev 75b37bd
rm extraneous resource ID
jakedoublev d4444b8
pare back responses, proto comments, better validation
jakedoublev 0ddaeea
ERS v2 after PR review discussion
jakedoublev 2317e79
feat(core): auth v2 with breaking changes to auth v1 protos (#2211)
jakedoublev 8ee0b3b
make no changes at all to authz v1
jakedoublev 1c5a1a9
proto comments
jakedoublev 67bc23c
field names
jakedoublev 1782f18
entity identifier proto name
jakedoublev 7f50caa
proto comments
jakedoublev 96d86d7
fix misnumbered index called out by copilot
jakedoublev 33d98c7
rm empty commits to unchanged proto files
jakedoublev 33dc394
validation PR suggestion
jakedoublev c75ca96
Merge branch 'main' into DSPX-1053-auth-svc-versioning-strategy
jakedoublev a0fc6a3
use auth v2 in sdk
jakedoublev f6d40af
service registry appending version to service logs
jakedoublev a8794d7
auth svc stubs
jakedoublev 74e9606
lint fix
jakedoublev 420f87d
lint fix
jakedoublev b45e5a7
v2 ERS
jakedoublev 2328fb3
rm unused variable
jakedoublev 3426199
cleanup
jakedoublev 598c8f3
tweak
jakedoublev File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
package authorization | ||
|
||
import ( | ||
"context" | ||
"errors" | ||
|
||
"connectrpc.com/connect" | ||
authzV2 "github.com/opentdf/platform/protocol/go/authorization/v2" | ||
authzV2Connect "github.com/opentdf/platform/protocol/go/authorization/v2/authorizationv2connect" | ||
otdf "github.com/opentdf/platform/sdk" | ||
"github.com/opentdf/platform/service/logger" | ||
"github.com/opentdf/platform/service/pkg/serviceregistry" | ||
"go.opentelemetry.io/otel/trace" | ||
) | ||
|
||
type Service struct { | ||
sdk *otdf.SDK | ||
config *Config | ||
logger *logger.Logger | ||
trace.Tracer | ||
} | ||
|
||
type Config struct{} | ||
|
||
func NewRegistration() *serviceregistry.Service[authzV2Connect.AuthorizationServiceHandler] { | ||
as := new(Service) | ||
|
||
return &serviceregistry.Service[authzV2Connect.AuthorizationServiceHandler]{ | ||
ServiceOptions: serviceregistry.ServiceOptions[authzV2Connect.AuthorizationServiceHandler]{ | ||
Namespace: "authorization", | ||
Version: "v2", | ||
ServiceDesc: &authzV2.AuthorizationService_ServiceDesc, | ||
ConnectRPCFunc: authzV2Connect.NewAuthorizationServiceHandler, | ||
RegisterFunc: func(srp serviceregistry.RegistrationParams) (authzV2Connect.AuthorizationServiceHandler, serviceregistry.HandlerServer) { | ||
authZCfg := new(Config) | ||
|
||
logger := srp.Logger | ||
|
||
// default ERS endpoint | ||
as.sdk = srp.SDK | ||
as.logger = logger | ||
// if err := srp.RegisterReadinessCheck("authorization", as.IsReady); err != nil { | ||
// logger.Error("failed to register authorization readiness check", slog.String("error", err.Error())) | ||
// } | ||
|
||
as.config = authZCfg | ||
as.Tracer = srp.Tracer | ||
logger.Debug("authorization v2 service register func") | ||
|
||
return as, nil | ||
}, | ||
}, | ||
} | ||
} | ||
|
||
// TODO: uncomment after v1 is deprecated, as cannot have more than one readiness check under a namespace | ||
// func (as Service) IsReady(ctx context.Context) error { | ||
// as.logger.TraceContext(ctx, "checking readiness of authorization service") | ||
// return nil | ||
// } | ||
|
||
// GetEntitlements for an entity chain | ||
func (as *Service) GetEntitlements(_ context.Context, _ *connect.Request[authzV2.GetEntitlementsRequest]) (*connect.Response[authzV2.GetEntitlementsResponse], error) { | ||
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("GetEntitlements not implemented")) | ||
} | ||
|
||
// GetDecision for an entity chain and an action on a single resource | ||
func (as *Service) GetDecision(_ context.Context, _ *connect.Request[authzV2.GetDecisionRequest]) (*connect.Response[authzV2.GetDecisionResponse], error) { | ||
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("GetDecision not implemented")) | ||
} | ||
|
||
// GetDecisionMultiResource for an entity chain and action on multiple resources | ||
func (as *Service) GetDecisionMultiResource(_ context.Context, _ *connect.Request[authzV2.GetDecisionMultiResourceRequest]) (*connect.Response[authzV2.GetDecisionMultiResourceResponse], error) { | ||
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("GetDecisionMultiResource not implemented")) | ||
} | ||
|
||
// GetDecisionBulk for multiple requests, each comprising a combination of entity chain, action, and one or more resources | ||
func (as *Service) GetDecisionBulk(_ context.Context, _ *connect.Request[authzV2.GetDecisionBulkRequest]) (*connect.Response[authzV2.GetDecisionBulkResponse], error) { | ||
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("GetDecisionBulk not implemented")) | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.