š AuthController - bbarrosomoreira/digital-bank-api GitHub Wiki
š PT-BR | EN-US
š§š· AuthController ā Descrição
Este controller é responsÔvel por registrar novos usuÔrios e realizar login no sistema. Tanto após o registro (signin) quanto o login, um token JWT é gerado e deve ser usado como Authorization: Bearer {token}
em todas as demais requisiƧƵes autenticadas.
šŗšø AuthController ā Description
This controller is responsible for registering new users and logging in to the system. After signing in or logging in, a JWT token is generated and must be used as Authorization: Bearer {token}
in all subsequent authenticated requests.
š„ Endpoints
Método | Endpoint | Acesso | Descrição (PT-BR) | Description (EN-US) |
---|---|---|---|---|
POST | /auth/signin |
PĆBLICO | Registra um novo usuĆ”rio e retorna o token (login automĆ”tico) | Registers a new user and returns the token (auto login) |
POST | /auth/login |
PĆBLICO | Autentica o usuĆ”rio e retorna o token | Authenticates user and returns the token |
š§¾ Regras
- Os usuƔrios podem se registrar como
CLIENTE
ouADMIN
. - O token JWT retornado deve ser incluĆdo no cabeƧalho de autorização para acessar os demais endpoints.
š Exemplos (JSON)
Registro de UsuƔrio
Requisição:
POST /auth/signin
Content-Type: application/json
{
"email": "[email protected]",
"senha": "123456",
"role": "CLIENTE"
}
Resposta:
{
"token": "eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJkZXZAZ21haWwuY29tIiwiaWF0IjoxNzQ1NTQyMjIzLCJleHAiOjE3NDU1NDk0MjN9.5ElJ3CLrMF_SABEontXqXAVIQfhb4wp5BbbJ4pdGS48"
}