mirror of
https://github.com/casdoor/casdoor.git
synced 2025-07-03 04:10:20 +08:00
feat: add GET method of logout API (#903)
This commit is contained in:
@ -78,6 +78,7 @@ p, *, *, POST, /api/get-email-and-phone, *, *
|
|||||||
p, *, *, POST, /api/login, *, *
|
p, *, *, POST, /api/login, *, *
|
||||||
p, *, *, GET, /api/get-app-login, *, *
|
p, *, *, GET, /api/get-app-login, *, *
|
||||||
p, *, *, POST, /api/logout, *, *
|
p, *, *, POST, /api/logout, *, *
|
||||||
|
p, *, *, GET, /api/logout, *, *
|
||||||
p, *, *, GET, /api/get-account, *, *
|
p, *, *, GET, /api/get-account, *, *
|
||||||
p, *, *, GET, /api/userinfo, *, *
|
p, *, *, GET, /api/userinfo, *, *
|
||||||
p, *, *, *, /api/login/oauth, *, *
|
p, *, *, *, /api/login/oauth, *, *
|
||||||
|
@ -228,7 +228,7 @@ func (c *ApiController) Signup() {
|
|||||||
// @Tag Login API
|
// @Tag Login API
|
||||||
// @Description logout the current user
|
// @Description logout the current user
|
||||||
// @Success 200 {object} controllers.Response The Response object
|
// @Success 200 {object} controllers.Response The Response object
|
||||||
// @router /logout [post]
|
// @router /logout [get,post]
|
||||||
func (c *ApiController) Logout() {
|
func (c *ApiController) Logout() {
|
||||||
user := c.GetSessionUsername()
|
user := c.GetSessionUsername()
|
||||||
util.LogInfo(c.Ctx, "API: [%s] logged out", user)
|
util.LogInfo(c.Ctx, "API: [%s] logged out", user)
|
||||||
|
@ -48,7 +48,7 @@ func initAPI() {
|
|||||||
beego.Router("/api/signup", &controllers.ApiController{}, "POST:Signup")
|
beego.Router("/api/signup", &controllers.ApiController{}, "POST:Signup")
|
||||||
beego.Router("/api/login", &controllers.ApiController{}, "POST:Login")
|
beego.Router("/api/login", &controllers.ApiController{}, "POST:Login")
|
||||||
beego.Router("/api/get-app-login", &controllers.ApiController{}, "GET:GetApplicationLogin")
|
beego.Router("/api/get-app-login", &controllers.ApiController{}, "GET:GetApplicationLogin")
|
||||||
beego.Router("/api/logout", &controllers.ApiController{}, "POST:Logout")
|
beego.Router("/api/logout", &controllers.ApiController{}, "GET,POST:Logout")
|
||||||
beego.Router("/api/get-account", &controllers.ApiController{}, "GET:GetAccount")
|
beego.Router("/api/get-account", &controllers.ApiController{}, "GET:GetAccount")
|
||||||
beego.Router("/api/userinfo", &controllers.ApiController{}, "GET:GetUserinfo")
|
beego.Router("/api/userinfo", &controllers.ApiController{}, "GET:GetUserinfo")
|
||||||
beego.Router("/api/unlink", &controllers.ApiController{}, "POST:Unlink")
|
beego.Router("/api/unlink", &controllers.ApiController{}, "POST:Unlink")
|
||||||
|
@ -2418,6 +2418,21 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"/api/logout": {
|
"/api/logout": {
|
||||||
|
"get": {
|
||||||
|
"tags": [
|
||||||
|
"Login API"
|
||||||
|
],
|
||||||
|
"description": "logout the current user",
|
||||||
|
"operationId": "ApiController.Logout",
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "The Response object",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/controllers.Response"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"post": {
|
"post": {
|
||||||
"tags": [
|
"tags": [
|
||||||
"Login API"
|
"Login API"
|
||||||
@ -3096,14 +3111,120 @@
|
|||||||
],
|
],
|
||||||
"operationId": "ApiController.VerifyCaptcha"
|
"operationId": "ApiController.VerifyCaptcha"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"/api/webauthn/signin/begin": {
|
||||||
|
"get": {
|
||||||
|
"tags": [
|
||||||
|
"Login API"
|
||||||
|
],
|
||||||
|
"description": "WebAuthn Login Flow 1st stage",
|
||||||
|
"operationId": "ApiController.WebAuthnSigninBegin",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"in": "query",
|
||||||
|
"name": "owner",
|
||||||
|
"description": "owner",
|
||||||
|
"required": true,
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"in": "query",
|
||||||
|
"name": "name",
|
||||||
|
"description": "name",
|
||||||
|
"required": true,
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "The CredentialAssertion object",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/protocol.CredentialAssertion"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"/api/webauthn/signin/finish": {
|
||||||
|
"post": {
|
||||||
|
"tags": [
|
||||||
|
"Login API"
|
||||||
|
],
|
||||||
|
"description": "WebAuthn Login Flow 2nd stage",
|
||||||
|
"operationId": "ApiController.WebAuthnSigninBegin",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"in": "body",
|
||||||
|
"name": "body",
|
||||||
|
"description": "authenticator assertion Response",
|
||||||
|
"required": true,
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/protocol.CredentialAssertionResponse"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "\"The Response object\"",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/Response"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"/api/webauthn/signup/begin": {
|
||||||
|
"get": {
|
||||||
|
"tags": [
|
||||||
|
"User API"
|
||||||
|
],
|
||||||
|
"description": "WebAuthn Registration Flow 1st stage",
|
||||||
|
"operationId": "ApiController.WebAuthnSignupBegin",
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "The CredentialCreationOptions object",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/protocol.CredentialCreation"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"/api/webauthn/signup/finish": {
|
||||||
|
"post": {
|
||||||
|
"tags": [
|
||||||
|
"User API"
|
||||||
|
],
|
||||||
|
"description": "WebAuthn Registration Flow 2nd stage",
|
||||||
|
"operationId": "ApiController.WebAuthnSignupFinish",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"in": "body",
|
||||||
|
"name": "body",
|
||||||
|
"description": "authenticator attestation Response",
|
||||||
|
"required": true,
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/protocol.CredentialCreationResponse"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "\"The Response object\"",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/Response"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"definitions": {
|
"definitions": {
|
||||||
"2127.0xc000398090.false": {
|
"2127.0xc000427560.false": {
|
||||||
"title": "false",
|
"title": "false",
|
||||||
"type": "object"
|
"type": "object"
|
||||||
},
|
},
|
||||||
"2161.0xc0003980c0.false": {
|
"2161.0xc000427590.false": {
|
||||||
"title": "false",
|
"title": "false",
|
||||||
"type": "object"
|
"type": "object"
|
||||||
},
|
},
|
||||||
@ -3221,10 +3342,10 @@
|
|||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
"data": {
|
"data": {
|
||||||
"$ref": "#/definitions/2127.0xc000398090.false"
|
"$ref": "#/definitions/2127.0xc000427560.false"
|
||||||
},
|
},
|
||||||
"data2": {
|
"data2": {
|
||||||
"$ref": "#/definitions/2161.0xc0003980c0.false"
|
"$ref": "#/definitions/2161.0xc000427590.false"
|
||||||
},
|
},
|
||||||
"msg": {
|
"msg": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
@ -3329,12 +3450,18 @@
|
|||||||
"enablePassword": {
|
"enablePassword": {
|
||||||
"type": "boolean"
|
"type": "boolean"
|
||||||
},
|
},
|
||||||
|
"enableSamlCompress": {
|
||||||
|
"type": "boolean"
|
||||||
|
},
|
||||||
"enableSignUp": {
|
"enableSignUp": {
|
||||||
"type": "boolean"
|
"type": "boolean"
|
||||||
},
|
},
|
||||||
"enableSigninSession": {
|
"enableSigninSession": {
|
||||||
"type": "boolean"
|
"type": "boolean"
|
||||||
},
|
},
|
||||||
|
"enableWebAuthn": {
|
||||||
|
"type": "boolean"
|
||||||
|
},
|
||||||
"expireInHours": {
|
"expireInHours": {
|
||||||
"type": "integer",
|
"type": "integer",
|
||||||
"format": "int64"
|
"format": "int64"
|
||||||
@ -4507,6 +4634,12 @@
|
|||||||
"updatedTime": {
|
"updatedTime": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
|
"webauthnCredentials": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"$ref": "#/definitions/webauthn.Credential"
|
||||||
|
}
|
||||||
|
},
|
||||||
"wechat": {
|
"wechat": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
@ -4596,6 +4729,26 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"protocol.CredentialAssertion": {
|
||||||
|
"title": "CredentialAssertion",
|
||||||
|
"type": "object"
|
||||||
|
},
|
||||||
|
"protocol.CredentialAssertionResponse": {
|
||||||
|
"title": "CredentialAssertionResponse",
|
||||||
|
"type": "object"
|
||||||
|
},
|
||||||
|
"protocol.CredentialCreation": {
|
||||||
|
"title": "CredentialCreation",
|
||||||
|
"type": "object"
|
||||||
|
},
|
||||||
|
"protocol.CredentialCreationResponse": {
|
||||||
|
"title": "CredentialCreationResponse",
|
||||||
|
"type": "object"
|
||||||
|
},
|
||||||
|
"webauthn.Credential": {
|
||||||
|
"title": "Credential",
|
||||||
|
"type": "object"
|
||||||
|
},
|
||||||
"xorm.Engine": {
|
"xorm.Engine": {
|
||||||
"title": "Engine",
|
"title": "Engine",
|
||||||
"type": "object"
|
"type": "object"
|
||||||
|
@ -1584,6 +1584,16 @@ paths:
|
|||||||
schema:
|
schema:
|
||||||
$ref: '#/definitions/object.TokenError'
|
$ref: '#/definitions/object.TokenError'
|
||||||
/api/logout:
|
/api/logout:
|
||||||
|
get:
|
||||||
|
tags:
|
||||||
|
- Login API
|
||||||
|
description: logout the current user
|
||||||
|
operationId: ApiController.Logout
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: The Response object
|
||||||
|
schema:
|
||||||
|
$ref: '#/definitions/controllers.Response'
|
||||||
post:
|
post:
|
||||||
tags:
|
tags:
|
||||||
- Login API
|
- Login API
|
||||||
@ -2028,11 +2038,80 @@ paths:
|
|||||||
tags:
|
tags:
|
||||||
- Verification API
|
- Verification API
|
||||||
operationId: ApiController.VerifyCaptcha
|
operationId: ApiController.VerifyCaptcha
|
||||||
|
/api/webauthn/signin/begin:
|
||||||
|
get:
|
||||||
|
tags:
|
||||||
|
- Login API
|
||||||
|
description: WebAuthn Login Flow 1st stage
|
||||||
|
operationId: ApiController.WebAuthnSigninBegin
|
||||||
|
parameters:
|
||||||
|
- in: query
|
||||||
|
name: owner
|
||||||
|
description: owner
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
- in: query
|
||||||
|
name: name
|
||||||
|
description: name
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: The CredentialAssertion object
|
||||||
|
schema:
|
||||||
|
$ref: '#/definitions/protocol.CredentialAssertion'
|
||||||
|
/api/webauthn/signin/finish:
|
||||||
|
post:
|
||||||
|
tags:
|
||||||
|
- Login API
|
||||||
|
description: WebAuthn Login Flow 2nd stage
|
||||||
|
operationId: ApiController.WebAuthnSigninBegin
|
||||||
|
parameters:
|
||||||
|
- in: body
|
||||||
|
name: body
|
||||||
|
description: authenticator assertion Response
|
||||||
|
required: true
|
||||||
|
schema:
|
||||||
|
$ref: '#/definitions/protocol.CredentialAssertionResponse'
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: '"The Response object"'
|
||||||
|
schema:
|
||||||
|
$ref: '#/definitions/Response'
|
||||||
|
/api/webauthn/signup/begin:
|
||||||
|
get:
|
||||||
|
tags:
|
||||||
|
- User API
|
||||||
|
description: WebAuthn Registration Flow 1st stage
|
||||||
|
operationId: ApiController.WebAuthnSignupBegin
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: The CredentialCreationOptions object
|
||||||
|
schema:
|
||||||
|
$ref: '#/definitions/protocol.CredentialCreation'
|
||||||
|
/api/webauthn/signup/finish:
|
||||||
|
post:
|
||||||
|
tags:
|
||||||
|
- User API
|
||||||
|
description: WebAuthn Registration Flow 2nd stage
|
||||||
|
operationId: ApiController.WebAuthnSignupFinish
|
||||||
|
parameters:
|
||||||
|
- in: body
|
||||||
|
name: body
|
||||||
|
description: authenticator attestation Response
|
||||||
|
required: true
|
||||||
|
schema:
|
||||||
|
$ref: '#/definitions/protocol.CredentialCreationResponse'
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: '"The Response object"'
|
||||||
|
schema:
|
||||||
|
$ref: '#/definitions/Response'
|
||||||
definitions:
|
definitions:
|
||||||
2127.0xc000398090.false:
|
2127.0xc000427560.false:
|
||||||
title: "false"
|
title: "false"
|
||||||
type: object
|
type: object
|
||||||
2161.0xc0003980c0.false:
|
2161.0xc000427590.false:
|
||||||
title: "false"
|
title: "false"
|
||||||
type: object
|
type: object
|
||||||
Response:
|
Response:
|
||||||
@ -2113,9 +2192,9 @@ definitions:
|
|||||||
type: object
|
type: object
|
||||||
properties:
|
properties:
|
||||||
data:
|
data:
|
||||||
$ref: '#/definitions/2127.0xc000398090.false'
|
$ref: '#/definitions/2127.0xc000427560.false'
|
||||||
data2:
|
data2:
|
||||||
$ref: '#/definitions/2161.0xc0003980c0.false'
|
$ref: '#/definitions/2161.0xc000427590.false'
|
||||||
msg:
|
msg:
|
||||||
type: string
|
type: string
|
||||||
name:
|
name:
|
||||||
@ -2185,10 +2264,14 @@ definitions:
|
|||||||
type: boolean
|
type: boolean
|
||||||
enablePassword:
|
enablePassword:
|
||||||
type: boolean
|
type: boolean
|
||||||
|
enableSamlCompress:
|
||||||
|
type: boolean
|
||||||
enableSignUp:
|
enableSignUp:
|
||||||
type: boolean
|
type: boolean
|
||||||
enableSigninSession:
|
enableSigninSession:
|
||||||
type: boolean
|
type: boolean
|
||||||
|
enableWebAuthn:
|
||||||
|
type: boolean
|
||||||
expireInHours:
|
expireInHours:
|
||||||
type: integer
|
type: integer
|
||||||
format: int64
|
format: int64
|
||||||
@ -2977,6 +3060,10 @@ definitions:
|
|||||||
type: string
|
type: string
|
||||||
updatedTime:
|
updatedTime:
|
||||||
type: string
|
type: string
|
||||||
|
webauthnCredentials:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
$ref: '#/definitions/webauthn.Credential'
|
||||||
wechat:
|
wechat:
|
||||||
type: string
|
type: string
|
||||||
wecom:
|
wecom:
|
||||||
@ -3035,6 +3122,21 @@ definitions:
|
|||||||
type: string
|
type: string
|
||||||
url:
|
url:
|
||||||
type: string
|
type: string
|
||||||
|
protocol.CredentialAssertion:
|
||||||
|
title: CredentialAssertion
|
||||||
|
type: object
|
||||||
|
protocol.CredentialAssertionResponse:
|
||||||
|
title: CredentialAssertionResponse
|
||||||
|
type: object
|
||||||
|
protocol.CredentialCreation:
|
||||||
|
title: CredentialCreation
|
||||||
|
type: object
|
||||||
|
protocol.CredentialCreationResponse:
|
||||||
|
title: CredentialCreationResponse
|
||||||
|
type: object
|
||||||
|
webauthn.Credential:
|
||||||
|
title: Credential
|
||||||
|
type: object
|
||||||
xorm.Engine:
|
xorm.Engine:
|
||||||
title: Engine
|
title: Engine
|
||||||
type: object
|
type: object
|
||||||
|
Reference in New Issue
Block a user