# deolin-jaffens/userauthenticationsystem architecture

> Architecture diagram of the GitHub repository deolin-jaffens/userauthenticationsystem, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/deolin-jaffens/userauthenticationsystem
- Repository: https://github.com/deolin-jaffens/userauthenticationsystem

## Overview

This is a small Spring Boot JWT authentication example. A client submits credentials to the login endpoint and receives a token, then presents that token to access a protected greeting endpoint. The tree identifies authentication, user persistence, JWT, security, and greeting components, but no source excerpts were provided; internal wiring shown here is inferred from component names and the documented workflow.

Main entry points: [`src/main/java/com/example/uas1/controller/AuthController.java`](https://github.com/deolin-jaffens/userauthenticationsystem/blob/main/src/main/java/com/example/uas1/controller/AuthController.java) (Auth endpoint), [`src/main/java/com/example/uas1/filter/JwtAuthenticationFilter.java`](https://github.com/deolin-jaffens/userauthenticationsystem/blob/main/src/main/java/com/example/uas1/filter/JwtAuthenticationFilter.java) (JWT filter), [`src/main/java/com/example/uas1/service/UserService.java`](https://github.com/deolin-jaffens/userauthenticationsystem/blob/main/src/main/java/com/example/uas1/service/UserService.java) (User service), [`src/main/java/com/example/uas1/repository/UserRepository.java`](https://github.com/deolin-jaffens/userauthenticationsystem/blob/main/src/main/java/com/example/uas1/repository/UserRepository.java) (User repository)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_auth["Authentication"]
  node_auth_controller["Auth endpoint"]
  node_user_service["User service<br/>[UserService.java]"]
  node_user_repository["User repository"]
  node_user["User model<br/>[User.java]"]
  node_jwt_util["JWT utility<br/>[JwtUtil.java]"]
end

subgraph group_security["Request security"]
  node_security_config["Security config"]
  node_jwt_filter["JWT filter"]
  node_application["Application entry"]
end

subgraph group_greeting["Protected greeting"]
  node_hello_controller["Hello endpoint"]
end

node_client(("Client"))

node_client -->|"submits credentials"| node_auth_controller
node_auth_controller -->|"checks credentials"| node_user_service
node_user_service -->|"looks up user"| node_user_repository
node_user_repository -->|"loads user"| node_user
node_auth_controller -->|"creates token"| node_jwt_util
node_auth_controller -->|"returns token"| node_client
node_client -->|"presents token"| node_jwt_filter
node_jwt_filter -->|"validates token"| node_jwt_util
node_jwt_filter -->|"dispatches request"| node_hello_controller
node_hello_controller -->|"returns greeting"| node_client
node_security_config -->|"registers filter"| node_jwt_filter
node_application -->|"starts application"| node_security_config

click node_auth_controller "https://github.com/deolin-jaffens/userauthenticationsystem/blob/main/src/main/java/com/example/uas1/controller/AuthController.java"
click node_user_service "https://github.com/deolin-jaffens/userauthenticationsystem/blob/main/src/main/java/com/example/uas1/service/UserService.java"
click node_user_repository "https://github.com/deolin-jaffens/userauthenticationsystem/blob/main/src/main/java/com/example/uas1/repository/UserRepository.java"
click node_user "https://github.com/deolin-jaffens/userauthenticationsystem/blob/main/src/main/java/com/example/uas1/model/User.java"
click node_jwt_util "https://github.com/deolin-jaffens/userauthenticationsystem/blob/main/src/main/java/com/example/uas1/util/JwtUtil.java"
click node_security_config "https://github.com/deolin-jaffens/userauthenticationsystem/blob/main/src/main/java/com/example/uas1/config/SecurityConfig.java"
click node_jwt_filter "https://github.com/deolin-jaffens/userauthenticationsystem/blob/main/src/main/java/com/example/uas1/filter/JwtAuthenticationFilter.java"
click node_hello_controller "https://github.com/deolin-jaffens/userauthenticationsystem/blob/main/src/main/java/com/example/uas1/controller/HelloController.java"
click node_application "https://github.com/deolin-jaffens/userauthenticationsystem/blob/main/src/main/java/com/example/uas1/Uas1Application.java"

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_service,node_user_repository,node_user,node_jwt_util,node_client toneBlue
class node_security_config,node_jwt_filter,node_application toneAmber
class node_hello_controller toneMint
```

## Components

### Authentication

- [Auth endpoint](https://github.com/deolin-jaffens/userauthenticationsystem/blob/main/src/main/java/com/example/uas1/controller/AuthController.java): `src/main/java/com/example/uas1/controller/AuthController.java`
- [User service](https://github.com/deolin-jaffens/userauthenticationsystem/blob/main/src/main/java/com/example/uas1/service/UserService.java): `src/main/java/com/example/uas1/service/UserService.java`
- [User repository](https://github.com/deolin-jaffens/userauthenticationsystem/blob/main/src/main/java/com/example/uas1/repository/UserRepository.java): `src/main/java/com/example/uas1/repository/UserRepository.java`
- [User model](https://github.com/deolin-jaffens/userauthenticationsystem/blob/main/src/main/java/com/example/uas1/model/User.java): `src/main/java/com/example/uas1/model/User.java`
- [JWT utility](https://github.com/deolin-jaffens/userauthenticationsystem/blob/main/src/main/java/com/example/uas1/util/JwtUtil.java): `src/main/java/com/example/uas1/util/JwtUtil.java`

### Request security

- [Security config](https://github.com/deolin-jaffens/userauthenticationsystem/blob/main/src/main/java/com/example/uas1/config/SecurityConfig.java): `src/main/java/com/example/uas1/config/SecurityConfig.java`
- [JWT filter](https://github.com/deolin-jaffens/userauthenticationsystem/blob/main/src/main/java/com/example/uas1/filter/JwtAuthenticationFilter.java): `src/main/java/com/example/uas1/filter/JwtAuthenticationFilter.java`
- [Application entry](https://github.com/deolin-jaffens/userauthenticationsystem/blob/main/src/main/java/com/example/uas1/Uas1Application.java): `src/main/java/com/example/uas1/Uas1Application.java`

### Protected greeting

- [Hello endpoint](https://github.com/deolin-jaffens/userauthenticationsystem/blob/main/src/main/java/com/example/uas1/controller/HelloController.java): `src/main/java/com/example/uas1/controller/HelloController.java`

### Other components

- **Client**

## Connections

- Client → Auth endpoint: submits credentials
- Auth endpoint → User service: checks credentials
- User service → User repository: looks up user
- User repository → User model: loads user
- Auth endpoint → JWT utility: creates token
- Auth endpoint → Client: returns token
- Client → JWT filter: presents token
- JWT filter → JWT utility: validates token
- JWT filter → Hello endpoint: dispatches request
- Hello endpoint → Client: returns greeting
- Security config → JWT filter: registers filter
- Application entry → Security config: starts application
