mirror of
https://github.com/yusing/godoxy.git
synced 2026-04-24 09:48:49 +02:00
feat(auth): add GET endpoint for logout and update documentation
This commit is contained in:
@@ -56,6 +56,7 @@ func NewHandler() *gin.Engine {
|
|||||||
v1Auth.GET("/callback", authApi.Callback)
|
v1Auth.GET("/callback", authApi.Callback)
|
||||||
v1Auth.POST("/callback", authApi.Callback)
|
v1Auth.POST("/callback", authApi.Callback)
|
||||||
v1Auth.POST("/logout", authApi.Logout)
|
v1Auth.POST("/logout", authApi.Logout)
|
||||||
|
v1Auth.GET("/logout", authApi.Logout)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import (
|
|||||||
// @Produce plain
|
// @Produce plain
|
||||||
// @Success 302 {string} string "Redirects to home page"
|
// @Success 302 {string} string "Redirects to home page"
|
||||||
// @Router /auth/logout [post]
|
// @Router /auth/logout [post]
|
||||||
|
// @Router /auth/logout [get]
|
||||||
func Logout(c *gin.Context) {
|
func Logout(c *gin.Context) {
|
||||||
auth.GetDefaultAuth().LogoutHandler(c.Writer, c.Request)
|
auth.GetDefaultAuth().LogoutHandler(c.Writer, c.Request)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -285,6 +285,26 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"/auth/logout": {
|
"/auth/logout": {
|
||||||
|
"get": {
|
||||||
|
"description": "Logs out the user by invalidating the token",
|
||||||
|
"produces": [
|
||||||
|
"text/plain"
|
||||||
|
],
|
||||||
|
"tags": [
|
||||||
|
"auth"
|
||||||
|
],
|
||||||
|
"summary": "Logout",
|
||||||
|
"responses": {
|
||||||
|
"302": {
|
||||||
|
"description": "Redirects to home page",
|
||||||
|
"schema": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"x-id": "logout",
|
||||||
|
"operationId": "logout"
|
||||||
|
},
|
||||||
"post": {
|
"post": {
|
||||||
"description": "Logs out the user by invalidating the token",
|
"description": "Logs out the user by invalidating the token",
|
||||||
"produces": [
|
"produces": [
|
||||||
|
|||||||
@@ -1613,6 +1613,19 @@ paths:
|
|||||||
- auth
|
- auth
|
||||||
x-id: login
|
x-id: login
|
||||||
/auth/logout:
|
/auth/logout:
|
||||||
|
get:
|
||||||
|
description: Logs out the user by invalidating the token
|
||||||
|
produces:
|
||||||
|
- text/plain
|
||||||
|
responses:
|
||||||
|
"302":
|
||||||
|
description: Redirects to home page
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
summary: Logout
|
||||||
|
tags:
|
||||||
|
- auth
|
||||||
|
x-id: logout
|
||||||
post:
|
post:
|
||||||
description: Logs out the user by invalidating the token
|
description: Logs out the user by invalidating the token
|
||||||
produces:
|
produces:
|
||||||
|
|||||||
Reference in New Issue
Block a user