Skip to content

Commit

Permalink
sender to actor
Browse files Browse the repository at this point in the history
  • Loading branch information
ecrupper committed May 21, 2024
1 parent 5582b26 commit a7d8b9b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 3 additions & 1 deletion api/oi_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,12 @@ func GetOpenIDConfig(c *gin.Context) {
"exp",
"iat",
"iss",
"aud",
"build_number",
"repo",
"token_type",
"build_sender",
"actor",
"commands",
"image",
"request",
},
Expand Down
6 changes: 3 additions & 3 deletions internal/token/mint.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
type Claims struct {
BuildID int64 `json:"build_id,omitempty"`
BuildNumber int `json:"build_number,omitempty"`
BuildSender string `json:"build_sender,omitempty"`
Actor string `json:"actor,omitempty"`
IsActive bool `json:"is_active,omitempty"`
IsAdmin bool `json:"is_admin,omitempty"`
Repo string `json:"repo,omitempty"`
Expand Down Expand Up @@ -104,7 +104,7 @@ func (tm *Manager) MintToken(mto *MintTokenOpts) (string, error) {
claims.Subject = fmt.Sprintf("repo:%s:ref:%s:event:%s", mto.Repo, mto.Build.GetRef(), mto.Build.GetEvent())
claims.BuildID = mto.Build.GetID()
claims.BuildNumber = mto.Build.GetNumber()
claims.BuildSender = mto.Build.GetSender()
claims.Actor = mto.Build.GetSender()
claims.Image = mto.Image
claims.Request = mto.Request
claims.Commands = mto.Commands
Expand Down Expand Up @@ -148,7 +148,7 @@ func (tm *Manager) MintIDToken(mto *MintTokenOpts, db database.Interface) (strin

// set claims based on input
claims.BuildNumber = mto.Build.GetNumber()
claims.BuildSender = mto.Build.GetSender()
claims.Actor = mto.Build.GetSender()
claims.Repo = mto.Repo
claims.Subject = fmt.Sprintf("repo:%s:ref:%s:event:%s", mto.Repo, mto.Build.GetRef(), mto.Build.GetEvent())
claims.Audience = mto.Audience
Expand Down

0 comments on commit a7d8b9b

Please sign in to comment.