Pular para o conteúdo principal

Visão Geral

O Casdoor é construído sobre o OAuth e utiliza tokens como tokens OAuth dos usuários.

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_token and id_token

Token Fields

São os seguintes os campos de token disponíveis no Casdoor:

  • Owner
  • Name
  • CreatedTime
  • Application
  • Organization
  • User
  • Code
  • AccessToken
  • ExpireIn (Os tokens expirarão em horas)
  • Scope (Escopo da autorização)
  • TokenType (por exemplo, tipo Bearer)

Após fazer login no aplicativo, existem três opções para gerar um Token JWT:

  • JWT
  • JWT-Empty
  • JWT-Custom
  • JWT-Standard

As opções são as seguintes: JWT irá gerar um token contendo todos os campos do Usuário, JWT-Empty irá gerar um token com todos os valores não vazios para o usuário, e JWT-Custom irá gerar um token contendo campos personalizados do Token do Usuário (você pode escolher atributos nos campos do Token). 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).

JWT-Custom