Skip to content

Commit

Permalink
Add attrs
Browse files Browse the repository at this point in the history
  • Loading branch information
strideynet committed Dec 9, 2024
1 parent a66391e commit 7f7a8e1
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
4 changes: 4 additions & 0 deletions api/proto/teleport/workloadidentity/v1/issuer_service.proto
Original file line number Diff line number Diff line change
Expand Up @@ -91,3 +91,7 @@ message IssueWorkloadIdentityResponse {

// The attributes provided by `tbot` regarding the workload's attestation.
message WorkloadAttrs {}

message JoinAttrs {}

Check failure on line 95 in api/proto/teleport/workloadidentity/v1/issuer_service.proto

View workflow job for this annotation

GitHub Actions / Lint (Proto)

Message "JoinAttrs" should have a non-empty comment for documentation.

message Attrs {}

Check failure on line 97 in api/proto/teleport/workloadidentity/v1/issuer_service.proto

View workflow job for this annotation

GitHub Actions / Lint (Proto)

Message "Attrs" should have a non-empty comment for documentation.
33 changes: 33 additions & 0 deletions lib/auth/machineid/workloadidentityv1/issuer_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,42 @@ func NewIssuanceService(cfg *IssuanceServiceConfig) (*IssuanceService, error) {
}, nil
}

func (s *IssuanceService) evaluateRules(wi *workloadidentityv1pb.WorkloadIdentity) error {
return trace.NotImplemented("not implemented")
}

func (s *IssuanceService) IssueWorkloadIdentity(
ctx context.Context,
req *workloadidentityv1pb.IssueWorkloadIdentityRequest,
) (*workloadidentityv1pb.IssueWorkloadIdentityResponse, error) {
_, err := s.authorizer.Authorize(ctx)
if err != nil {
return nil, trace.Wrap(err)
}

if req.GetName() == "" {
return nil, trace.BadParameter("name: is required")
}

// TODO: Enforce WorkloadIdentity labelling access control?
wi, err := s.cache.GetWorkloadIdentity(ctx, req.GetName())
if err != nil {
return nil, trace.Wrap(err)
}

// TODO: Build up workload identity evaluation context.

if err := s.evaluateRules(wi); err != nil {
return nil, trace.Wrap(err)
}

// TODO: Enforce rules

// TODO: Perform templating

// TODO: Issue X509 or JWT

// Return.

return nil, trace.NotImplemented("not implemented")
}

0 comments on commit 7f7a8e1

Please sign in to comment.