openapi: 3.0.0 info: title: API de Autenticação version: 1.0.0 description: Autenticação com JWT + Redis (blacklist) e rotas protegidas. servers: - url: http://localhost:3000 description: Local paths: /auth/register: post: tags: [Auth] summary: Registro de usuário requestBody: required: true content: application/json: schema: type: object required: [name, email, password] properties: name: { type: string, example: teste } email: { type: string, example: teste@email.com } password: { type: string, example: 123123 } responses: '201': description: Usuário criado content: application/json: schema: type: object properties: id: { type: string, format: uuid } name: { type: string } email: { type: string } '400': { description: Dados inválidos } '409': { description: Email já cadastrado } /auth/login: post: tags: [Auth] summary: Login de usuário requestBody: required: true content: application/json: schema: type: object required: [email, password] properties: email: { type: string, example: teste@email.com } password: { type: string, example: 123123 } responses: '200': description: Login OK content: application/json: schema: type: object properties: token: { type: string, description: JWT } expires_at: { type: integer, description: Epoch seconds } user: type: object properties: id: { type: string, format: uuid } name: { type: string } email: { type: string } '401': { description: Credenciais inválidas } /auth/logout: post: tags: [Auth] summary: Logout seguro (blacklist Redis) security: - bearerAuth: [] responses: '200': { description: Logout realizado com sucesso } '401': { description: Token ausente ou inválido } /protected/me: get: tags: [Protected] summary: Dados do usuário autenticado description: Requer header **Authorization: Bearer <jwt_token>** security: - bearerAuth: [] responses: '200': description: Dados do usuário content: application/json: schema: type: object properties: user: type: object properties: id: { type: string } email: { type: string } iat: { type: integer } exp: { type: integer } '401': { description: Não autorizado } /protected/ping: get: tags: [Protected] summary: Ping autenticado description: Requer header **Authorization: Bearer <jwt_token>** security: - bearerAuth: [] responses: '200': description: OK content: application/json: schema: type: object properties: ok: { type: boolean } time: { type: string, format: date-time } '401': { description: Não autorizado } components: securitySchemes: bearerAuth: type: http scheme: bearer bearerFormat: JWT