Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/yeboahd24/golang-sso
https://github.com/yeboahd24/golang-sso
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/yeboahd24/golang-sso
- Owner: yeboahd24
- Created: 2024-11-03T01:00:42.000Z (2 months ago)
- Default Branch: main
- Last Pushed: 2024-11-03T01:03:23.000Z (2 months ago)
- Last Synced: 2024-11-03T02:16:52.952Z (2 months ago)
- Language: Go
- Size: 15.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Golang SSO (Single Sign-On) Service
A robust Single Sign-On service built with Go, leveraging OAuth2 for authentication with Google.
![SSO Architecture](images/sso.png)
## Features
- OAuth2 authentication with Google
- Session management
- User creation and updates
- Secure cookie handling
- Domain-specific email validation (@mesika.org)
- Clean architecture with separation of concerns## Prerequisites
- Go 1.18+
- PostgreSQL 13+
- Google OAuth2 credentials## Installation
1. Clone the repository:
```bash
git clone https://github.com/yeboahd24/golang-sso.git
cd golang-sso2. Install dependencies:
```bash
go mod download
```3. Configure the application:
1. Copy config/config.example.yml to config/config.yml
2. Update the database connection details in config.yml
3. Add your Google OAuth2 credentials (client ID, client secret) to config.yml4. Build and run the application:
```bash
go run cmd/main.go
```Usage
Access the login page at `http://localhost:8080`
Click "Continue with SSO" to initiate the OAuth flow
Authenticate with your Google account (must be @mesika.org domain)
Upon successful authentication, you'll be redirected back to the applicationAPI Endpoints
GET /api/auth/sso: Initiates the SSO process
GET /api/auth/callback: OAuth callback URL
GET /api/auth/verify: Verifies the current session
POST /api/auth/logout: Logs out the current userContributing
Contributions are welcome! Please feel free to submit a Pull Request.
LicenseThis project is licensed under the MIT License.