> ## Documentation Index
> Fetch the complete documentation index at: https://kxp.wyhil.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Login

> Learn how to create login modules using Prometheus.

## Login Feature Overview

To write or edit posts on a bulletin board, a **login** process to verify the user's identity is essential. Through Vibe Coding, you can easily implement login features while complying with security standards and integrate them with the bulletin board service.

***

## Step-by-Step Login Implementation

### 1. Security Settings and Authentication Method Definition

Explain to the AI what method of login you want. We recommend a combination of Spring Security and JWT (JSON Web Token), which is the recent standard.

> **Prompt:** "Add a login feature to our board. I want to use Spring Security and apply the JWT token authentication method for security. Include ID, password, and email in the user information."

### 2. Authentication Logic Creation (Logic Create)

The AI creates the `User` entity, the `AuthController` responsible for authentication, and the `SecurityConfig` file containing security settings.

* **Using Tools**: The AI automatically configures the filters and handlers needed for login through `create_new_file`.

### 3. Integration with Bulletin Board Logic (Logic Update)

Update the previously created bulletin board logic to restrict permissions so that only logged-in users can write posts.

> **Prompt:** "Update the post creation (`post`) and modification (`update`) logic. Now, make it accessible only to users who have a JWT token after logging in, and add validation logic so they can only edit posts they wrote themselves."

***

## Utilization Tip: Social Login Integration

With Vibe Coding, you can solve complex OAuth2 settings just through conversation.

> **Prompt:** "Expand the feature so users can also log in with their Google accounts. If Google login is successful, have them automatically registered as user information in our system."

***

## 💡 Precautions for Login Implementation

* **Password Encryption**: When the AI generates logic, make sure to use `BCryptPasswordEncoder` or similar to ensure passwords are encrypted before being saved.
* **Logout Handling**: It's recommended to choose either a method to expire the token on the client side or a server-side blacklist method and request logout logic as well.
* **Error Messages**: Strengthen security by using general messages like "Invalid ID or password" rather than specific errors like "ID does not exist."
