Skip to content

Commit

Permalink
fixup claims
Browse files Browse the repository at this point in the history
  • Loading branch information
joecorall committed Jan 25, 2025
1 parent 4f9f8f5 commit 4d18312
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
2 changes: 1 addition & 1 deletion lib/handler/middleware.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (

type contextKey string

const claimsKey contextKey = "claims"
const claimsKey contextKey = "githubClaims"

const githubKeysURL = "https://token.actions.githubusercontent.com/.well-known/jwks"

Expand Down
6 changes: 1 addition & 5 deletions lib/handler/registration_token.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,7 @@ import (
)

func (h *Handler) RepoAdminToken(w http.ResponseWriter, r *http.Request) {
claims, ok := r.Context().Value(claimsKey).(GitHubClaims)
if !ok {
http.Error(w, "Unauthorized: missing claims in context", http.StatusUnauthorized)
return
}
claims := r.Context().Value(claimsKey).(GitHubClaims)
if claims.Repository == "" {
http.Error(w, "Invalid request: repository claim is empty", http.StatusBadRequest)
return
Expand Down

0 comments on commit 4d18312

Please sign in to comment.