Skip to content

Commit

Permalink
fix(swagger/oidc): fix swagger and oidc docs
Browse files Browse the repository at this point in the history
includes the following changes:
- oidc and jwks endpoints don't need auth
- proper documentation for JWKSet type
- fix swagger doc creation
  • Loading branch information
wass3r committed Jul 14, 2024
1 parent bc77ee7 commit 9a9863d
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 10 deletions.
5 changes: 2 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -281,9 +281,8 @@ spec-install:
@echo "### Installing utilities (jq and sponge)"
@apt-get update
@apt-get install -y jq moreutils
@echo "### Downloading and installing go-swagger"
@curl -o /usr/local/bin/swagger -L "https://github.com/go-swagger/go-swagger/releases/download/v0.30.2/swagger_linux_amd64"
@chmod +x /usr/local/bin/swagger
@echo "### Installing go-swagger"
@go install github.com/go-swagger/go-swagger/cmd/swagger@latest

# The `spec-gen` target is intended to create an api-spec
# using go-swagger (https://goswagger.io)
Expand Down
2 changes: 0 additions & 2 deletions api/jwks.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ import (
// produces:
// - application/json
// parameters:
// security:
// - ApiKeyAuth: []
// responses:
// '200':
// description: Successfully retrieved the Vela JWKS
Expand Down
2 changes: 0 additions & 2 deletions api/oi_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ import (
// produces:
// - application/json
// parameters:
// security:
// - ApiKeyAuth: []
// responses:
// '200':
// description: Successfully retrieved the Vela OpenID Configuration
Expand Down
13 changes: 10 additions & 3 deletions api/types/oidc.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ package types

import (
"github.com/golang-jwt/jwt/v5"
"github.com/lestrrat-go/jwx/v2/jwk"
)

// OpenIDConfig is a struct that represents the OpenID Connect configuration.
Expand Down Expand Up @@ -37,9 +36,17 @@ type OpenIDClaims struct {
jwt.RegisteredClaims
}

// JWKSet is a wrapper of lestrrat-go/jwx/jwk.Set for API Swagger gen.
// JWKSet exists solely to provide proper swagger documentation.
// It is not otherwise used in code.
//
// swagger:model JWKSet
type JWKSet struct {
jwk.Set
Keys []JWK `json:"keys"`
}

type JWK struct {
Kty string `json:"kty"`
Kid string `json:"kid"`
E string `json:"e"`
N string `json:"n"`
}

0 comments on commit 9a9863d

Please sign in to comment.