Adding resource backend for scoped join tokens#59609
Conversation
cb83807 to
ac98db3
Compare
ac98db3 to
cb28a3e
Compare
cb28a3e to
d960a90
Compare
lib/services/local/scoped_tokens.go
Outdated
| // UpsertScopedToken upserts a scoped token to the auth server. | ||
| func (s *ScopedTokenService) UpsertScopedToken(ctx context.Context, token *joiningv1.ScopedToken) (*joiningv1.ScopedToken, error) { |
There was a problem hiding this comment.
What use cases will be calling UpsertScopedToken?
7849329 to
703c043
Compare
| // Filter tokens that apply at least one of the provided roles. | ||
| repeated string roles = 5; | ||
|
|
||
| // Filter tokens that match all provided labels. | ||
| map<string, string> labels = 6; |
There was a problem hiding this comment.
In the future please don't backport RPCs in release branches if they're not finalized and the semantics are planned to be changed in backwards-incompatible ways - I almost requested changes on this because I saw the proto definition in branch/v18, and this change is only ok because the server side of things is not actually implemented in any release yet.
fspmarshall
left a comment
There was a problem hiding this comment.
General feedback: I'd like to try to stick a little closer to the patterns used for ScopedRole/ScopedRoleAssignment. In particular:
- Define validation/helpers in
lib/scopes/joining. - Provide separate
StrongValidateScopedTokenandWeakValidateScopedTokenfunctions. - Have the backend always perform strong validation on writes and weak validation on reads.
- Keep the service/interface method signatures equivalent to the grpc method signatures (scope api's are likely going to be high churn for a while, so this tends to just make things easier).
b33fac5 to
9fb4699
Compare
|
@eriktate - this PR will require admin approval to merge due to its size. Consider breaking it up into a series smaller changes. |
5f9bf01 to
735c60e
Compare
lib/services/local/scoped_tokens.go
Outdated
| // UpdateScopedToken updates a scoped token in the auth server. | ||
| func (s *ScopedTokenService) UpdateScopedToken(ctx context.Context, req *joiningv1.UpdateScopedTokenRequest) (*joiningv1.UpdateScopedTokenResponse, error) { |
There was a problem hiding this comment.
If we never plan to support updating scoped tokens should we remove Update from all the API layers?
There was a problem hiding this comment.
It was already in the gRPC service definition and since we may implement it in some form later I'll leave it as NotImplemented in the service implementation. I removed it from the local service and ScopedService interface though 👍
7846fe2 to
0ee1260
Compare
690009e to
4b2557b
Compare
4b2557b to
e810e5a
Compare
This PR adds basic CRUD with list filters and validation for scoped join tokens.