mirror of
https://github.com/steveiliop56/tinyauth.git
synced 2026-03-05 06:12:03 +00:00
fix: add cache control header to token response
This commit is contained in:
@@ -231,7 +231,7 @@ func (controller *OIDCController) Token(c *gin.Context) {
|
|||||||
if !ok {
|
if !ok {
|
||||||
tlog.App.Error().Msg("Missing authorization header")
|
tlog.App.Error().Msg("Missing authorization header")
|
||||||
c.Header("www-authenticate", "basic")
|
c.Header("www-authenticate", "basic")
|
||||||
c.JSON(401, gin.H{
|
c.JSON(400, gin.H{
|
||||||
"error": "invalid_client",
|
"error": "invalid_client",
|
||||||
})
|
})
|
||||||
return
|
return
|
||||||
@@ -313,7 +313,7 @@ func (controller *OIDCController) Token(c *gin.Context) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
if errors.Is(err, service.ErrTokenExpired) {
|
if errors.Is(err, service.ErrTokenExpired) {
|
||||||
tlog.App.Error().Err(err).Msg("Refresh token expired")
|
tlog.App.Error().Err(err).Msg("Refresh token expired")
|
||||||
c.JSON(401, gin.H{
|
c.JSON(400, gin.H{
|
||||||
"error": "invalid_grant",
|
"error": "invalid_grant",
|
||||||
})
|
})
|
||||||
return
|
return
|
||||||
@@ -321,7 +321,7 @@ func (controller *OIDCController) Token(c *gin.Context) {
|
|||||||
|
|
||||||
if errors.Is(err, service.ErrInvalidClient) {
|
if errors.Is(err, service.ErrInvalidClient) {
|
||||||
tlog.App.Error().Err(err).Msg("Invalid client")
|
tlog.App.Error().Err(err).Msg("Invalid client")
|
||||||
c.JSON(401, gin.H{
|
c.JSON(400, gin.H{
|
||||||
"error": "invalid_grant",
|
"error": "invalid_grant",
|
||||||
})
|
})
|
||||||
return
|
return
|
||||||
@@ -337,6 +337,9 @@ func (controller *OIDCController) Token(c *gin.Context) {
|
|||||||
tokenResponse = tokenRes
|
tokenResponse = tokenRes
|
||||||
}
|
}
|
||||||
|
|
||||||
|
c.Header("cache-control", "no-store")
|
||||||
|
c.Header("pragma", "no-cache")
|
||||||
|
|
||||||
c.JSON(200, tokenResponse)
|
c.JSON(200, tokenResponse)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user