Lizenzserver im Adminpanel

Dieser Commit ist enthalten in:
2025-06-18 22:48:22 +02:00
Ursprung 86d805c392
Commit 6d1a52b7e3
17 geänderte Dateien mit 2483 neuen und 32 gelöschten Zeilen

Datei anzeigen

@@ -794,7 +794,12 @@ def license_anomalies():
except Exception as e:
flash(f'Fehler beim Laden der Anomalie-Daten: {str(e)}', 'error')
return render_template('license_anomalies.html')
return render_template('license_anomalies.html',
anomalies=[],
anomaly_stats=[],
severity='all',
resolved='false'
)
finally:
if 'cur' in locals():
cur.close()
@@ -972,3 +977,25 @@ def license_live_stats():
cur.close()
if 'conn' in locals():
conn.close()
@admin_bp.route("/api/admin/license/auth-token")
@login_required
def get_analytics_token():
"""Get JWT token for accessing Analytics Service"""
import jwt
from datetime import datetime, timedelta
# Generate a short-lived token for the analytics service
payload = {
'sub': session.get('user_id', 'admin'),
'type': 'analytics_access',
'exp': datetime.utcnow() + timedelta(hours=1),
'iat': datetime.utcnow()
}
# Use the same secret as configured in the analytics service
jwt_secret = os.environ.get('JWT_SECRET', 'your-secret-key')
token = jwt.encode(payload, jwt_secret, algorithm='HS256')
return jsonify({'token': token})