mirror of
https://github.com/steveiliop56/tinyauth.git
synced 2026-05-10 22:38:10 +00:00
fix: assign public key correctly in oidc server
This commit is contained in:
@@ -44,7 +44,7 @@ func NewWellKnownController(oidc *service.OIDCService, router *gin.RouterGroup)
|
|||||||
func (controller *WellKnownController) OpenIDConnectConfiguration(c *gin.Context) {
|
func (controller *WellKnownController) OpenIDConnectConfiguration(c *gin.Context) {
|
||||||
if controller.oidc == nil {
|
if controller.oidc == nil {
|
||||||
c.JSON(500, gin.H{
|
c.JSON(500, gin.H{
|
||||||
"status": "500",
|
"status": 500,
|
||||||
"message": "OIDC service not configured",
|
"message": "OIDC service not configured",
|
||||||
})
|
})
|
||||||
return
|
return
|
||||||
@@ -73,7 +73,7 @@ func (controller *WellKnownController) OpenIDConnectConfiguration(c *gin.Context
|
|||||||
func (controller *WellKnownController) JWKS(c *gin.Context) {
|
func (controller *WellKnownController) JWKS(c *gin.Context) {
|
||||||
if controller.oidc == nil {
|
if controller.oidc == nil {
|
||||||
c.JSON(500, gin.H{
|
c.JSON(500, gin.H{
|
||||||
"status": "500",
|
"status": 500,
|
||||||
"message": "OIDC service not configured",
|
"message": "OIDC service not configured",
|
||||||
})
|
})
|
||||||
return
|
return
|
||||||
@@ -83,7 +83,7 @@ func (controller *WellKnownController) JWKS(c *gin.Context) {
|
|||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
c.JSON(500, gin.H{
|
c.JSON(500, gin.H{
|
||||||
"status": "500",
|
"status": 500,
|
||||||
"message": "failed to get JWK",
|
"message": "failed to get JWK",
|
||||||
})
|
})
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -230,11 +230,10 @@ func NewOIDCService(
|
|||||||
return nil, fmt.Errorf("failed to parse public key: %w", err)
|
return nil, fmt.Errorf("failed to parse public key: %w", err)
|
||||||
}
|
}
|
||||||
case "PUBLIC KEY":
|
case "PUBLIC KEY":
|
||||||
publicKey, err := x509.ParsePKIXPublicKey(block.Bytes)
|
publicKey, err = x509.ParsePKIXPublicKey(block.Bytes)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("failed to parse public key: %w", err)
|
return nil, fmt.Errorf("failed to parse public key: %w", err)
|
||||||
}
|
}
|
||||||
publicKey = publicKey.(crypto.PublicKey)
|
|
||||||
default:
|
default:
|
||||||
return nil, fmt.Errorf("unsupported public key type: %s", block.Type)
|
return nil, fmt.Errorf("unsupported public key type: %s", block.Type)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user