2024-01-07 07:52:23 +00:00
|
|
|
package services
|
|
|
|
|
|
|
|
import (
|
2024-02-18 03:20:22 +00:00
|
|
|
"code.smartsheep.studio/hydrogen/identity/pkg/database"
|
|
|
|
"code.smartsheep.studio/hydrogen/identity/pkg/models"
|
2024-01-07 07:52:23 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func LookupSessionWithToken(tokenId string) (models.AuthSession, error) {
|
|
|
|
var session models.AuthSession
|
|
|
|
if err := database.C.
|
|
|
|
Where(models.AuthSession{AccessToken: tokenId}).
|
|
|
|
Or(models.AuthSession{RefreshToken: tokenId}).
|
|
|
|
First(&session).Error; err != nil {
|
|
|
|
return session, err
|
|
|
|
}
|
|
|
|
|
|
|
|
return session, nil
|
|
|
|
}
|