Обзор
Casdoor построен на основе OAuth и использует токены как OAuth-токены пользователей.
Access Token and ID Token
In Casdoor, the access_token and id_token are identical. Both tokens contain the same JWT payload with user information and claims. This is a design choice in Casdoor that simplifies token management.
This approach means:
- Both tokens contain the same user information and custom claims
- Both tokens can be used interchangeably for authentication and authorization
- The token format and expiration settings apply to both tokens equally
- You cannot configure separate claims for access_tokenandid_token
Token Fields
Ниже приведены доступные поля токенов в Casdoor:
- Owner
- Name
- CreatedTime
- Application
- Organization
- User
- Code
- AccessToken
- ExpireIn(Токены истекают через часы)
- Scope(Область авторизации)
- TokenType(например, тип- Bearer)
После входа в приложение есть три варианта генерации JWT-токена:
- JWT
- JWT-Empty
- JWT-Custom
- JWT-Standard
Варианты следующие: JWT сгенерирует токен, содержащий все поля пользователя, JWT-Empty сгенерирует токен со всеми непустыми значениями для пользователя, и JWT-Custom сгенерирует токен, содержащий настраиваемые поля токена пользователя (вы можете выбрать атрибуты в полях токена). JWT-Standard will generate a token with some standard OIDC token fields include email, phone, gender and Address (Address value in other format is not standard).
