Compare commits

...

2 Commits

Author SHA1 Message Date
Stavros
51a6559324 tests: fix tests 2026-04-14 12:37:03 +03:00
Stavros
5b836ee8c4 fix: review comments 2026-04-14 12:18:55 +03:00
5 changed files with 5 additions and 5 deletions

View File

@@ -0,0 +1 @@
ALTER TABLE "oidc_tokens" ADD COLUMN "code_hash" TEXT NOT NULL DEFAULT "";

View File

@@ -1 +0,0 @@
ALTER TABLE "oidc_tokens" ADD COLUMN "code_hash" TEXT DEFAULT "";

View File

@@ -275,9 +275,9 @@ func (controller *OIDCController) Token(c *gin.Context) {
case "authorization_code": case "authorization_code":
entry, err := controller.oidc.GetCodeEntry(c, controller.oidc.Hash(req.Code), client.ClientID) entry, err := controller.oidc.GetCodeEntry(c, controller.oidc.Hash(req.Code), client.ClientID)
if err != nil { if err != nil {
// Delete the access token just in case if err := controller.oidc.DeleteTokenByCodeHash(c, controller.oidc.Hash(req.Code)); err != nil {
controller.oidc.DeleteTokenByCodeHash(c, controller.oidc.Hash(req.Code)) tlog.App.Error().Err(err).Msg("Failed to delete access token by code hash")
}
if errors.Is(err, service.ErrCodeNotFound) { if errors.Is(err, service.ErrCodeNotFound) {
tlog.App.Warn().Msg("Code not found") tlog.App.Warn().Msg("Code not found")
c.JSON(400, gin.H{ c.JSON(400, gin.H{

View File

@@ -387,7 +387,7 @@ func TestOIDCController(t *testing.T) {
err = json.Unmarshal(secondRecorder.Body.Bytes(), &secondRes) err = json.Unmarshal(secondRecorder.Body.Bytes(), &secondRes)
assert.NoError(t, err) assert.NoError(t, err)
assert.Equal(t, secondRes["error"], "invalid_grant") assert.Equal(t, "invalid_grant", secondRes["error"])
}, },
}, },
{ {