mirror of
https://github.com/casdoor/casdoor.git
synced 2025-07-03 20:50:19 +08:00
fix: no database check when using accessToken (#461)
Signed-off-by: 0x2a <stevesough@gmail.com>
This commit is contained in:
@ -156,6 +156,16 @@ func DeleteToken(token *Token) bool {
|
||||
return affected != 0
|
||||
}
|
||||
|
||||
func GetTokenByAccessToken(accessToken string) *Token {
|
||||
//Check if the accessToken is in the database
|
||||
token := Token{}
|
||||
existed, err := adapter.Engine.Where("access_token=?", accessToken).Get(&token)
|
||||
if err != nil || !existed {
|
||||
return nil
|
||||
}
|
||||
return &token
|
||||
}
|
||||
|
||||
func CheckOAuthLogin(clientId string, responseType string, redirectUri string, scope string, state string) (string, *Application) {
|
||||
if responseType != "code" {
|
||||
return "response_type should be \"code\"", nil
|
||||
|
Reference in New Issue
Block a user