使用 Gin 的 Cookie 基础身份验证示例
A simple example demonstrating how to implement cookie-based session authentication in Go using Gin. This project showcases basic authentication flows including login, logout, and protected routes.
# Clone the repository
git clone https://github.com/depado/gin-auth-example
cd gin-auth-example
# Run the server
go run main.goThe server will start on localhost:8080
POST /login: Authenticate user{"username": "hello", "password": "itsme"}GET /logout: End user sessionGET /private/me: Get current user informationGET /private/status: Get login status/login with credentials/logout to end the sessionRun the test suite:
go test -vThis is a demonstration project. For production use:
暂无开放 Issues,或尚未同步最近议题。