# minoru-yamazaki/authenticator architecture

> Architecture diagram of the GitHub repository minoru-yamazaki/authenticator, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/minoru-yamazaki/authenticator
- Repository: https://github.com/minoru-yamazaki/authenticator

## Overview

This is a Spring-based authentication API. Its main workflow accepts registration or credentials through HTTP controllers, executes authentication use cases, and returns user or token responses; refresh-token rotation and logout provide session lifecycle management. JWT validation also supports authenticated user access. Persistence and security adapters implement application ports. The source index and excerpts show key calls and dependencies, but README content is absent and several use cases and configurations were not sampled, so some subsystem links are omitted rather than inferred.

Main entry points: [`src/main/java/br/com/authenticator/inbound/controller/AuthController.java`](https://github.com/minoru-yamazaki/authenticator/blob/master/src/main/java/br/com/authenticator/inbound/controller/AuthController.java) (Auth controller), [`src/main/java/br/com/authenticator/core/application/usecase/Login.java`](https://github.com/minoru-yamazaki/authenticator/blob/master/src/main/java/br/com/authenticator/core/application/usecase/Login.java) (Credential login), [`src/main/java/br/com/authenticator/core/application/usecase/RefreshToken.java`](https://github.com/minoru-yamazaki/authenticator/blob/master/src/main/java/br/com/authenticator/core/application/usecase/RefreshToken.java) (Token rotation), [`src/main/java/br/com/authenticator/core/domain/entity/User.java`](https://github.com/minoru-yamazaki/authenticator/blob/master/src/main/java/br/com/authenticator/core/domain/entity/User.java) (User identity)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["HTTP API"]
  node_auth_controller["Auth controller"]
  node_user_controller["User controller"]
  node_request_dto["Request DTOs"]
  node_response_dto["Response DTOs"]
  node_error_handler["Exception handler"]
end

subgraph group_application["Application workflows"]
  node_register["Registration<br/>[RegisterUser.java]"]
  node_login["Credential login<br/>[Login.java]"]
  node_refresh["Token rotation<br/>[RefreshToken.java]"]
  node_logout["Logout<br/>[Logout.java]"]
  node_current_user["Current user"]
  node_user_port["User repository port"]
  node_refresh_port["Refresh repository port"]
  node_token_port["Token service port<br/>[TokenService.java]"]
  node_password_port["Password encoder port"]
end

subgraph group_domain["Identity domain"]
  node_user_domain["User identity<br/>[User.java]"]
  node_refresh_entity["Refresh-token entity<br/>[RefreshToken.java]"]
  node_domain_base["Entity base<br/>[DomainEntity.java]"]
  node_role["Roles<br/>[Role.java]"]
  node_domain_error["Domain errors"]
  node_email["Email value<br/>[Email.java]"]
  node_password_hash["Password hash<br/>[PasswordHash.java]"]
end

subgraph group_adapters["Security and persistence"]
  node_jwt_service["JWT service"]
  node_jwt_filter["JWT filter"]
  node_bcrypt["BCrypt adapter"]
  node_user_adapter["User persistence adapter"]
  node_refresh_adapter["Refresh persistence adapter"]
  node_user_jpa["User JPA repository"]
  node_refresh_jpa["Refresh JPA repository"]
  node_database[("Relational database")]
end

node_client(("API client"))

node_client -->|"sends requests"| node_auth_controller
node_auth_controller -->|"executes"| node_register
node_auth_controller -->|"executes"| node_login
node_auth_controller -->|"executes"| node_refresh
node_auth_controller -->|"executes"| node_logout
node_user_controller -->|"executes"| node_current_user
node_auth_controller -->|"accepts"| node_request_dto
node_auth_controller -->|"returns"| node_response_dto
node_user_controller -->|"returns"| node_response_dto
node_login -->|"reads user"| node_user_port
node_login -->|"checks password"| node_password_port
node_login -->|"issues access token"| node_token_port
node_login -->|"saves refresh token"| node_refresh_port
node_refresh -->|"rotates token"| node_refresh_port
node_refresh -->|"reads user"| node_user_port
node_refresh -->|"issues access token"| node_token_port
node_login -->|"raises errors"| node_domain_error
node_refresh -->|"raises errors"| node_domain_error
node_error_handler -->|"handles"| node_domain_error
node_user_adapter -->|"delegates"| node_user_jpa
node_refresh_adapter -->|"delegates"| node_refresh_jpa
node_jwt_service -->|"implements"| node_token_port
node_jwt_filter -->|"validates tokens"| node_token_port
node_jwt_filter -->|"loads user"| node_user_port
node_user_adapter -->|"implements"| node_user_port
node_refresh_adapter -->|"implements"| node_refresh_port
node_user_jpa -.->|"reads and writes"| node_database
node_refresh_jpa -.->|"reads and writes"| node_database
node_user_domain -->|"uses value"| node_email
node_user_domain -->|"uses value"| node_password_hash
node_user_domain -->|"assigns roles"| node_role
node_refresh_entity -->|"extends"| node_domain_base
node_user_domain -->|"extends"| node_domain_base

click node_auth_controller "https://github.com/minoru-yamazaki/authenticator/blob/master/src/main/java/br/com/authenticator/inbound/controller/AuthController.java"
click node_user_controller "https://github.com/minoru-yamazaki/authenticator/blob/master/src/main/java/br/com/authenticator/inbound/controller/UserController.java"
click node_request_dto "https://github.com/minoru-yamazaki/authenticator/tree/master/src/main/java/br/com/authenticator/inbound/dto/request"
click node_response_dto "https://github.com/minoru-yamazaki/authenticator/tree/master/src/main/java/br/com/authenticator/inbound/dto/response"
click node_error_handler "https://github.com/minoru-yamazaki/authenticator/blob/master/src/main/java/br/com/authenticator/inbound/exception/GlobalExceptionHandler.java"
click node_register "https://github.com/minoru-yamazaki/authenticator/blob/master/src/main/java/br/com/authenticator/core/application/usecase/RegisterUser.java"
click node_login "https://github.com/minoru-yamazaki/authenticator/blob/master/src/main/java/br/com/authenticator/core/application/usecase/Login.java"
click node_refresh "https://github.com/minoru-yamazaki/authenticator/blob/master/src/main/java/br/com/authenticator/core/application/usecase/RefreshToken.java"
click node_logout "https://github.com/minoru-yamazaki/authenticator/blob/master/src/main/java/br/com/authenticator/core/application/usecase/Logout.java"
click node_current_user "https://github.com/minoru-yamazaki/authenticator/blob/master/src/main/java/br/com/authenticator/core/application/usecase/GetCurrentUser.java"
click node_user_domain "https://github.com/minoru-yamazaki/authenticator/blob/master/src/main/java/br/com/authenticator/core/domain/entity/User.java"
click node_refresh_entity "https://github.com/minoru-yamazaki/authenticator/blob/master/src/main/java/br/com/authenticator/core/domain/entity/RefreshToken.java"
click node_domain_base "https://github.com/minoru-yamazaki/authenticator/blob/master/src/main/java/br/com/authenticator/core/domain/entity/DomainEntity.java"
click node_role "https://github.com/minoru-yamazaki/authenticator/blob/master/src/main/java/br/com/authenticator/core/domain/enums/Role.java"
click node_domain_error "https://github.com/minoru-yamazaki/authenticator/blob/master/src/main/java/br/com/authenticator/core/domain/exceptions/DomainException.java"
click node_email "https://github.com/minoru-yamazaki/authenticator/blob/master/src/main/java/br/com/authenticator/core/domain/valueobject/Email.java"
click node_password_hash "https://github.com/minoru-yamazaki/authenticator/blob/master/src/main/java/br/com/authenticator/core/domain/valueobject/PasswordHash.java"
click node_user_port "https://github.com/minoru-yamazaki/authenticator/blob/master/src/main/java/br/com/authenticator/core/application/port/outbound/UserRepository.java"
click node_refresh_port "https://github.com/minoru-yamazaki/authenticator/blob/master/src/main/java/br/com/authenticator/core/application/port/outbound/RefreshTokenRepository.java"
click node_token_port "https://github.com/minoru-yamazaki/authenticator/blob/master/src/main/java/br/com/authenticator/core/application/port/outbound/TokenService.java"
click node_password_port "https://github.com/minoru-yamazaki/authenticator/blob/master/src/main/java/br/com/authenticator/core/application/port/outbound/PasswordEncoder.java"
click node_jwt_service "https://github.com/minoru-yamazaki/authenticator/blob/master/src/main/java/br/com/authenticator/infra/security/JwtTokenService.java"
click node_jwt_filter "https://github.com/minoru-yamazaki/authenticator/blob/master/src/main/java/br/com/authenticator/infra/security/JwtAuthenticationFilter.java"
click node_bcrypt "https://github.com/minoru-yamazaki/authenticator/blob/master/src/main/java/br/com/authenticator/infra/security/BcryptPasswordEncoderAdapter.java"
click node_user_adapter "https://github.com/minoru-yamazaki/authenticator/blob/master/src/main/java/br/com/authenticator/outbound/persistence/UserRepositoryAdapter.java"
click node_refresh_adapter "https://github.com/minoru-yamazaki/authenticator/blob/master/src/main/java/br/com/authenticator/outbound/persistence/RefreshTokenRepositoryAdapter.java"
click node_user_jpa "https://github.com/minoru-yamazaki/authenticator/blob/master/src/main/java/br/com/authenticator/outbound/persistence/jpa/UserJpaRepository.java"
click node_refresh_jpa "https://github.com/minoru-yamazaki/authenticator/blob/master/src/main/java/br/com/authenticator/outbound/persistence/jpa/RefreshTokenJpaRepository.java"
click node_database "https://github.com/minoru-yamazaki/authenticator/tree/master/src/main/resources/db/migration"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_auth_controller,node_user_controller,node_request_dto,node_response_dto,node_error_handler,node_client toneBlue
class node_register,node_login,node_refresh,node_logout,node_current_user,node_user_port,node_refresh_port,node_token_port,node_password_port toneAmber
class node_user_domain,node_refresh_entity,node_domain_base,node_role,node_domain_error,node_email,node_password_hash toneMint
class node_jwt_service,node_jwt_filter,node_bcrypt,node_user_adapter,node_refresh_adapter,node_user_jpa,node_refresh_jpa,node_database toneRose
```

## Components

### HTTP API

- [Auth controller](https://github.com/minoru-yamazaki/authenticator/blob/master/src/main/java/br/com/authenticator/inbound/controller/AuthController.java): `src/main/java/br/com/authenticator/inbound/controller/AuthController.java`
- [User controller](https://github.com/minoru-yamazaki/authenticator/blob/master/src/main/java/br/com/authenticator/inbound/controller/UserController.java): `src/main/java/br/com/authenticator/inbound/controller/UserController.java`
- [Request DTOs](https://github.com/minoru-yamazaki/authenticator/tree/master/src/main/java/br/com/authenticator/inbound/dto/request): `src/main/java/br/com/authenticator/inbound/dto/request`
- [Response DTOs](https://github.com/minoru-yamazaki/authenticator/tree/master/src/main/java/br/com/authenticator/inbound/dto/response): `src/main/java/br/com/authenticator/inbound/dto/response`
- [Exception handler](https://github.com/minoru-yamazaki/authenticator/blob/master/src/main/java/br/com/authenticator/inbound/exception/GlobalExceptionHandler.java): `src/main/java/br/com/authenticator/inbound/exception/GlobalExceptionHandler.java`

### Application workflows

- [Registration](https://github.com/minoru-yamazaki/authenticator/blob/master/src/main/java/br/com/authenticator/core/application/usecase/RegisterUser.java): `src/main/java/br/com/authenticator/core/application/usecase/RegisterUser.java`
- [Credential login](https://github.com/minoru-yamazaki/authenticator/blob/master/src/main/java/br/com/authenticator/core/application/usecase/Login.java): `src/main/java/br/com/authenticator/core/application/usecase/Login.java`
- [Token rotation](https://github.com/minoru-yamazaki/authenticator/blob/master/src/main/java/br/com/authenticator/core/application/usecase/RefreshToken.java): `src/main/java/br/com/authenticator/core/application/usecase/RefreshToken.java`
- [Logout](https://github.com/minoru-yamazaki/authenticator/blob/master/src/main/java/br/com/authenticator/core/application/usecase/Logout.java): `src/main/java/br/com/authenticator/core/application/usecase/Logout.java`
- [Current user](https://github.com/minoru-yamazaki/authenticator/blob/master/src/main/java/br/com/authenticator/core/application/usecase/GetCurrentUser.java): `src/main/java/br/com/authenticator/core/application/usecase/GetCurrentUser.java`
- [User repository port](https://github.com/minoru-yamazaki/authenticator/blob/master/src/main/java/br/com/authenticator/core/application/port/outbound/UserRepository.java): `src/main/java/br/com/authenticator/core/application/port/outbound/UserRepository.java`
- [Refresh repository port](https://github.com/minoru-yamazaki/authenticator/blob/master/src/main/java/br/com/authenticator/core/application/port/outbound/RefreshTokenRepository.java): `src/main/java/br/com/authenticator/core/application/port/outbound/RefreshTokenRepository.java`
- [Token service port](https://github.com/minoru-yamazaki/authenticator/blob/master/src/main/java/br/com/authenticator/core/application/port/outbound/TokenService.java): `src/main/java/br/com/authenticator/core/application/port/outbound/TokenService.java`
- [Password encoder port](https://github.com/minoru-yamazaki/authenticator/blob/master/src/main/java/br/com/authenticator/core/application/port/outbound/PasswordEncoder.java): `src/main/java/br/com/authenticator/core/application/port/outbound/PasswordEncoder.java`

### Identity domain

- [User identity](https://github.com/minoru-yamazaki/authenticator/blob/master/src/main/java/br/com/authenticator/core/domain/entity/User.java): `src/main/java/br/com/authenticator/core/domain/entity/User.java`
- [Refresh-token entity](https://github.com/minoru-yamazaki/authenticator/blob/master/src/main/java/br/com/authenticator/core/domain/entity/RefreshToken.java): `src/main/java/br/com/authenticator/core/domain/entity/RefreshToken.java`
- [Entity base](https://github.com/minoru-yamazaki/authenticator/blob/master/src/main/java/br/com/authenticator/core/domain/entity/DomainEntity.java): `src/main/java/br/com/authenticator/core/domain/entity/DomainEntity.java`
- [Roles](https://github.com/minoru-yamazaki/authenticator/blob/master/src/main/java/br/com/authenticator/core/domain/enums/Role.java): `src/main/java/br/com/authenticator/core/domain/enums/Role.java`
- [Domain errors](https://github.com/minoru-yamazaki/authenticator/blob/master/src/main/java/br/com/authenticator/core/domain/exceptions/DomainException.java): `src/main/java/br/com/authenticator/core/domain/exceptions/DomainException.java`
- [Email value](https://github.com/minoru-yamazaki/authenticator/blob/master/src/main/java/br/com/authenticator/core/domain/valueobject/Email.java): `src/main/java/br/com/authenticator/core/domain/valueobject/Email.java`
- [Password hash](https://github.com/minoru-yamazaki/authenticator/blob/master/src/main/java/br/com/authenticator/core/domain/valueobject/PasswordHash.java): `src/main/java/br/com/authenticator/core/domain/valueobject/PasswordHash.java`

### Security and persistence

- [JWT service](https://github.com/minoru-yamazaki/authenticator/blob/master/src/main/java/br/com/authenticator/infra/security/JwtTokenService.java): `src/main/java/br/com/authenticator/infra/security/JwtTokenService.java`
- [JWT filter](https://github.com/minoru-yamazaki/authenticator/blob/master/src/main/java/br/com/authenticator/infra/security/JwtAuthenticationFilter.java): `src/main/java/br/com/authenticator/infra/security/JwtAuthenticationFilter.java`
- [BCrypt adapter](https://github.com/minoru-yamazaki/authenticator/blob/master/src/main/java/br/com/authenticator/infra/security/BcryptPasswordEncoderAdapter.java): `src/main/java/br/com/authenticator/infra/security/BcryptPasswordEncoderAdapter.java`
- [User persistence adapter](https://github.com/minoru-yamazaki/authenticator/blob/master/src/main/java/br/com/authenticator/outbound/persistence/UserRepositoryAdapter.java): `src/main/java/br/com/authenticator/outbound/persistence/UserRepositoryAdapter.java`
- [Refresh persistence adapter](https://github.com/minoru-yamazaki/authenticator/blob/master/src/main/java/br/com/authenticator/outbound/persistence/RefreshTokenRepositoryAdapter.java): `src/main/java/br/com/authenticator/outbound/persistence/RefreshTokenRepositoryAdapter.java`
- [User JPA repository](https://github.com/minoru-yamazaki/authenticator/blob/master/src/main/java/br/com/authenticator/outbound/persistence/jpa/UserJpaRepository.java): `src/main/java/br/com/authenticator/outbound/persistence/jpa/UserJpaRepository.java`
- [Refresh JPA repository](https://github.com/minoru-yamazaki/authenticator/blob/master/src/main/java/br/com/authenticator/outbound/persistence/jpa/RefreshTokenJpaRepository.java): `src/main/java/br/com/authenticator/outbound/persistence/jpa/RefreshTokenJpaRepository.java`
- [Relational database](https://github.com/minoru-yamazaki/authenticator/tree/master/src/main/resources/db/migration): `src/main/resources/db/migration`

### Other components

- **API client**

## Connections

- API client → Auth controller: sends requests (evidence: `src/main/java/br/com/authenticator/inbound/controller/AuthController.java`)
- Auth controller → Registration: executes (evidence: `src/main/java/br/com/authenticator/inbound/controller/AuthController.java`)
- Auth controller → Credential login: executes (evidence: `src/main/java/br/com/authenticator/inbound/controller/AuthController.java`)
- Auth controller → Token rotation: executes (evidence: `src/main/java/br/com/authenticator/inbound/controller/AuthController.java`)
- Auth controller → Logout: executes (evidence: `src/main/java/br/com/authenticator/inbound/controller/AuthController.java`)
- User controller → Current user: executes (evidence: `src/main/java/br/com/authenticator/inbound/controller/UserController.java`)
- Auth controller → Request DTOs: accepts (evidence: `src/main/java/br/com/authenticator/inbound/controller/AuthController.java`)
- Auth controller → Response DTOs: returns (evidence: `src/main/java/br/com/authenticator/inbound/controller/AuthController.java`)
- User controller → Response DTOs: returns (evidence: `src/main/java/br/com/authenticator/inbound/controller/UserController.java`)
- Credential login → User repository port: reads user (evidence: `src/main/java/br/com/authenticator/core/application/usecase/Login.java`)
- Credential login → Password encoder port: checks password (evidence: `src/main/java/br/com/authenticator/core/application/usecase/Login.java`)
- Credential login → Token service port: issues access token (evidence: `src/main/java/br/com/authenticator/core/application/usecase/Login.java`)
- Credential login → Refresh repository port: saves refresh token (evidence: `src/main/java/br/com/authenticator/core/application/usecase/Login.java`)
- Token rotation → Refresh repository port: rotates token (evidence: `src/main/java/br/com/authenticator/core/application/usecase/RefreshToken.java`)
- Token rotation → User repository port: reads user (evidence: `src/main/java/br/com/authenticator/core/application/usecase/RefreshToken.java`)
- Token rotation → Token service port: issues access token (evidence: `src/main/java/br/com/authenticator/core/application/usecase/RefreshToken.java`)
- Credential login → Domain errors: raises errors (evidence: `src/main/java/br/com/authenticator/core/application/usecase/Login.java`)
- Token rotation → Domain errors: raises errors (evidence: `src/main/java/br/com/authenticator/core/application/usecase/RefreshToken.java`)
- Exception handler → Domain errors: handles (evidence: `src/main/java/br/com/authenticator/inbound/exception/GlobalExceptionHandler.java`)
- User persistence adapter → User JPA repository: delegates (evidence: `src/main/java/br/com/authenticator/outbound/persistence/UserRepositoryAdapter.java`)
- Refresh persistence adapter → Refresh JPA repository: delegates (evidence: `src/main/java/br/com/authenticator/outbound/persistence/RefreshTokenRepositoryAdapter.java`)
- JWT service → Token service port: implements (evidence: `src/main/java/br/com/authenticator/infra/security/JwtTokenService.java`)
- JWT filter → Token service port: validates tokens (evidence: `src/main/java/br/com/authenticator/infra/security/JwtAuthenticationFilter.java`)
- JWT filter → User repository port: loads user (evidence: `src/main/java/br/com/authenticator/infra/security/JwtAuthenticationFilter.java`)
- User persistence adapter → User repository port: implements (evidence: `src/main/java/br/com/authenticator/outbound/persistence/UserRepositoryAdapter.java`)
- Refresh persistence adapter → Refresh repository port: implements (evidence: `src/main/java/br/com/authenticator/outbound/persistence/RefreshTokenRepositoryAdapter.java`)
- User JPA repository → Relational database: reads and writes
- Refresh JPA repository → Relational database: reads and writes
- User identity → Email value: uses value (evidence: `src/main/java/br/com/authenticator/core/domain/entity/User.java`)
- User identity → Password hash: uses value (evidence: `src/main/java/br/com/authenticator/core/domain/entity/User.java`)
- User identity → Roles: assigns roles (evidence: `src/main/java/br/com/authenticator/core/domain/entity/User.java`)
- Refresh-token entity → Entity base: extends (evidence: `src/main/java/br/com/authenticator/core/domain/entity/RefreshToken.java`)
- User identity → Entity base: extends (evidence: `src/main/java/br/com/authenticator/core/domain/entity/User.java`)
