Skip to content

Commit 3d9c81d

Browse files
committed
fix: assign public key correctly in oidc server
1 parent 4e760e8 commit 3d9c81d

2 files changed

Lines changed: 4 additions & 5 deletions

File tree

internal/controller/well_known_controller.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ func NewWellKnownController(oidc *service.OIDCService, router *gin.RouterGroup)
4444
func (controller *WellKnownController) OpenIDConnectConfiguration(c *gin.Context) {
4545
if controller.oidc == nil {
4646
c.JSON(500, gin.H{
47-
"status": "500",
47+
"status": 500,
4848
"message": "OIDC service not configured",
4949
})
5050
return
@@ -73,7 +73,7 @@ func (controller *WellKnownController) OpenIDConnectConfiguration(c *gin.Context
7373
func (controller *WellKnownController) JWKS(c *gin.Context) {
7474
if controller.oidc == nil {
7575
c.JSON(500, gin.H{
76-
"status": "500",
76+
"status": 500,
7777
"message": "OIDC service not configured",
7878
})
7979
return
@@ -83,7 +83,7 @@ func (controller *WellKnownController) JWKS(c *gin.Context) {
8383

8484
if err != nil {
8585
c.JSON(500, gin.H{
86-
"status": "500",
86+
"status": 500,
8787
"message": "failed to get JWK",
8888
})
8989
return

internal/service/oidc_service.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -230,11 +230,10 @@ func NewOIDCService(
230230
return nil, fmt.Errorf("failed to parse public key: %w", err)
231231
}
232232
case "PUBLIC KEY":
233-
publicKey, err := x509.ParsePKIXPublicKey(block.Bytes)
233+
publicKey, err = x509.ParsePKIXPublicKey(block.Bytes)
234234
if err != nil {
235235
return nil, fmt.Errorf("failed to parse public key: %w", err)
236236
}
237-
publicKey = publicKey.(crypto.PublicKey)
238237
default:
239238
return nil, fmt.Errorf("unsupported public key type: %s", block.Type)
240239
}

0 commit comments

Comments
 (0)