Skip to content

Authentication

Sichern Sie Ihre API-Anfragen mit JWT Bearer Tokens.

Übersicht

CyberOrigen verwendet JSON Web Tokens (JWT) für die API-Authentifizierung. Alle Anfragen an geschützte Endpunkte müssen ein gültiges Token enthalten.

Token erhalten

Login Endpunkt

bash
POST /api/v1/auth/token
Content-Type: application/x-www-form-urlencoded

username=[email protected]&password=yourpassword

Antwort

json
{
  "access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
  "token_type": "bearer",
  "expires_in": 3600
}

cURL Beispiel

bash
curl -X POST https://backend.cyberorigen.com/api/v1/auth/token \
  -H "Content-Type: application/x-www-form-urlencoded" \
  -d "[email protected]&password=yourpassword"

Tokens verwenden

Fügen Sie das Token im Authorization Header hinzu:

bash
curl https://backend.cyberorigen.com/api/v1/scans \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"

Token Aktualisierung

Tokens laufen nach 1 Stunde ab. Aktualisieren Sie sie vor Ablauf:

bash
POST /api/v1/auth/refresh
Authorization: Bearer YOUR_CURRENT_TOKEN

Antwort:

json
{
  "access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
  "token_type": "bearer",
  "expires_in": 3600
}

API Keys

Professional und Enterprise

API Keys sind in den Professional und Enterprise Tarifen verfügbar.

Für automatisierte Systeme verwenden Sie API Keys anstelle von Benutzerdaten:

API Key erstellen

  1. Gehen Sie zu Einstellungen > API Keys
  2. Klicken Sie auf Neuen Key generieren
  3. Legen Sie Berechtigungen und Ablaufdatum fest
  4. Kopieren Sie den Key (wird nur einmal angezeigt)

API Keys verwenden

bash
curl https://backend.cyberorigen.com/api/v1/scans \
  -H "X-API-Key: YOUR_API_KEY"

API Key Berechtigungen

BerechtigungBeschreibung
read:scansScan-Ergebnisse ansehen
write:scansScans erstellen und verwalten
read:findingsSchwachstellen ansehen
write:findingsSchwachstellen-Status aktualisieren
read:grcGRC-Daten ansehen
write:grcControls und Nachweise ändern

MFA für API-Zugriff

Wenn MFA aktiviert ist, erfordern initiale Token-Anfragen den MFA-Code:

bash
POST /api/v1/auth/token
Content-Type: application/x-www-form-urlencoded

username=[email protected]&password=yourpassword&mfa_code=123456

Session-Verwaltung

Aktive Sessions auflisten

bash
GET /api/v1/auth/sessions

Session widerrufen

bash
DELETE /api/v1/auth/sessions/{session_id}

Alle Sessions widerrufen

bash
POST /api/v1/auth/logout-all

Sicherheits-Best Practices

  1. Tokens niemals offenlegen in clientseitigem Code oder Versionskontrolle
  2. API Keys verwenden für automatisierte Systeme statt Benutzerdaten
  3. API Keys regelmäßig rotieren
  4. Angemessenes Ablaufdatum für API Keys festlegen
  5. Minimale Berechtigungen verwenden, die für Ihre Integration erforderlich sind

Fehlerantworten

Ungültige Zugangsdaten

json
{
  "detail": "Incorrect email or password",
  "error_code": "INVALID_CREDENTIALS"
}

Abgelaufenes Token

json
{
  "detail": "Token has expired",
  "error_code": "TOKEN_EXPIRED"
}

Ungültiges Token

json
{
  "detail": "Could not validate credentials",
  "error_code": "INVALID_TOKEN"
}

MFA erforderlich

json
{
  "detail": "MFA code required",
  "error_code": "MFA_REQUIRED"
}

Updated at:

Agentic AI-Powered Security & Compliance