docs: add quixzoom-auth-core product to AAMOS
- Product documentation in docs/products/ - Updated MEMORY.md with product info - quiXzoom Auth Core as AAMOS Identity product
This commit is contained in:
@@ -0,0 +1,118 @@
|
||||
# quiXzoom SSO Authentication Service
|
||||
|
||||
Microsoft-like single sign-on för alla quixzoom-egendomar.
|
||||
|
||||
## Arkitektur
|
||||
|
||||
```
|
||||
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
|
||||
│ quixzoom.com │ │ app.quixzoom │ │ quixzoom.se │
|
||||
│ (landing) │ │ (app/web) │ │ (marknad) │
|
||||
└────────┬────────┘ └────────┬────────┘ └────────┬────────┘
|
||||
│ │ │
|
||||
└───────────────────────┼───────────────────────┘
|
||||
│
|
||||
┌─────────────▼─────────────┐
|
||||
│ auth.quixzoom.com │
|
||||
│ (SSO / JWT / Cookies) │
|
||||
└─────────────┬─────────────┘
|
||||
│
|
||||
┌─────────────▼─────────────┐
|
||||
│ Redis (sessions) │
|
||||
└───────────────────────────┘
|
||||
```
|
||||
|
||||
## Flöde
|
||||
|
||||
### Inloggad i appen → Automatiskt inloggad på webb
|
||||
|
||||
1. Användare loggar in i quiXzoom-appen
|
||||
2. Appen får JWT access token + refresh token
|
||||
3. Cookies sätts på `.quixzoom.com` (shared across subdomains)
|
||||
4. Användare besöker `www.quixzoom.com/mina-sidor`
|
||||
5. Webbsidan kollar `qz_access_token` cookie
|
||||
6. Token är giltig → användare är inloggad utan att göra något
|
||||
|
||||
### Cross-domain cookie-sharing
|
||||
|
||||
```
|
||||
Cookie: qz_access_token=xxx
|
||||
Domain: .quixzoom.com
|
||||
Path: /
|
||||
Secure: true
|
||||
SameSite: lax
|
||||
HttpOnly: true
|
||||
```
|
||||
|
||||
Detta gör att cookien skickas med till:
|
||||
- `www.quixzoom.com`
|
||||
- `app.quixzoom.com`
|
||||
- `quixzoom.se`
|
||||
- `quixzoom.de`
|
||||
- etc.
|
||||
|
||||
## Endpoints
|
||||
|
||||
| Endpoint | Beskrivning |
|
||||
|----------|-------------|
|
||||
| `POST /auth/login` | E-post + lösenord, sätter cookies |
|
||||
| `POST /auth/refresh` | Förnya access token |
|
||||
| `POST /auth/logout` | Logga ut, rensa cookies |
|
||||
| `GET /auth/me` | Hämta inloggad användare |
|
||||
| `GET /auth/check` | Snabb auth-check (200/401) |
|
||||
| `GET /auth/.well-known/jwks.json` | Publik nyckel för verifiering |
|
||||
|
||||
## Användning
|
||||
|
||||
### Webb (JavaScript)
|
||||
|
||||
```javascript
|
||||
import { quixzoomAuth } from './sso-client.js';
|
||||
|
||||
// Kolla om inloggad
|
||||
const user = await quixzoomAuth.getUser();
|
||||
if (user) {
|
||||
console.log('Inloggad som:', user.email);
|
||||
}
|
||||
|
||||
// Logga in
|
||||
await quixzoomAuth.login('user@example.com', 'password');
|
||||
|
||||
// Logga ut
|
||||
await quixzoomAuth.logout();
|
||||
```
|
||||
|
||||
### React Native / App
|
||||
|
||||
```javascript
|
||||
// Samma client, men skickar tokens i Authorization-header
|
||||
const response = await fetch('https://api.quixzoom.com/missions', {
|
||||
headers: {
|
||||
'Authorization': `Bearer ${accessToken}`
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
## Driftsättning
|
||||
|
||||
```bash
|
||||
docker-compose up -d
|
||||
```
|
||||
|
||||
## Miljövariabler
|
||||
|
||||
| Variabel | Default | Beskrivning |
|
||||
|----------|---------|-------------|
|
||||
| `PORT` | 8080 | Server port |
|
||||
| `REDIS_HOST` | localhost | Redis server |
|
||||
| `JWT_PRIVATE_KEY_PATH` | - | Sökväg till privat nyckel |
|
||||
| `JWT_PUBLIC_KEY_PATH` | - | Sökväg till publik nyckel |
|
||||
|
||||
## Säkerhet
|
||||
|
||||
- RS256-signerade JWT-tokens
|
||||
- HttpOnly cookies (skyddade mot XSS)
|
||||
- Secure flag (endast HTTPS)
|
||||
- SameSite=lax (CSRF-skydd)
|
||||
- Refresh token-rotation
|
||||
- Token-blacklisting vid utloggning
|
||||
Reference in New Issue
Block a user