一键导入
mykaarma-saml
Use when adding, fixing, or reviewing SAML login, SSO, SP metadata, ACS, SLO, session auth gates, or myKaarma IdP integration in a Python web app.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Use when adding, fixing, or reviewing SAML login, SSO, SP metadata, ACS, SLO, session auth gates, or myKaarma IdP integration in a Python web app.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
Use when creating a new local app, prototype, browser tool, game, demo, or greenfield project, especially when no existing repo stack is already fixed.
Design and review REST APIs following myKaarma organization standards. Use when designing new API endpoints, reviewing API changes, or ensuring API consistency across services. Covers URL patterns, HTTP methods, status codes, versioning, naming conventions, pagination, and bulk operations.
Use when reviewing code, UI screens, or features for localization compliance against myKaarma's attribute-based rendering standards. Triggers on requests like "check localization", "audit i18n", "review RTL support", or "is this locale-ready".
Deep code security audit for Java/Spring Boot and TypeScript services. Covers auth/authz, input validation, SQL injection, PII exposure, and API security. Use when preparing for a security review, before a major release, or when a security concern is raised. Also trigger when the user says things like "audit this service for security", "security review before release", "check for vulnerabilities in the code", "is this endpoint secure?", "check for SQL injection", "check for PII in logs", or "audit our auth layer". Complements the vuln-scan skill (which covers CVEs and dependency scanning) — this skill focuses on application-level code patterns.
Use when reviewing PM-built prototypes, wireframes, Figma mockups, or UI screens for usability gaps, UX issues, and UI quality. Triggers on requests like "review this design", "audit this prototype", "UX feedback", or "check this UI".
Applies myKaarma's official brand colors, typography, spacing, navigation patterns, dark mode, and interaction design to all UI output. Invoke this skill before starting any UI project — components, dashboards, forms, or AI-generated artifacts — to ensure full consistency with myKaarma's visual identity and design system.
基于 SOC 职业分类
| name | mykaarma-saml |
| description | Use when adding, fixing, or reviewing SAML login, SSO, SP metadata, ACS, SLO, session auth gates, or myKaarma IdP integration in a Python web app. |
Use python3-saml as the service provider toolkit for Python apps that need myKaarma SSO. Treat SAML as production security work: generate environment-specific SP metadata, register it with the SSO team, keep private keys out of source, and deny unauthorized users before creating the app session.
Use this skill for:
/saml/metadata, /saml/login, /saml/acs, /saml/logout, or /saml/sls.Do not use this skill for webhook authentication, Basic auth, OAuth, or mkid cookie product APIs unless SAML is also in scope. For myKaarma product APIs, keep following the cookie-based mkid/withCredentials standards.
python3-saml>=1.16,<2.0.python-multipart.SessionMiddleware with SESSION_SECRET.python3-saml: xmlsec1, libxmlsec1-openssl, libxml2, and build tooling as needed.Use the myKaarma IdP values from the current UI integration docs. The current implementation references:
| Field | Value |
|---|---|
| IdP entity ID | https://accounts.mykaarma.com/saml2/idp/metadata.php |
| SSO URL | https://accounts.mykaarma.com/saml2/idp/SSOService.php |
| SLO URL | https://accounts.mykaarma.com/saml2/idp/SingleLogoutService.php |
| Binding | HTTP-Redirect |
Do not fetch IdP metadata dynamically at runtime; the metadata URL may redirect behind login. Pin or configure the IdP public cert and track its expiry in the runbook. The IdP public certificate may be committed if it contains no private material. Use reference/mykaarma-idp-certificate.md for the current public IdP certificate from the UI integration docs. The SP private key is a secret and must come from an environment variable or secret manager.
Implement these routes:
| Route | Purpose | Public? |
|---|---|---|
GET /saml/metadata | Returns generated SP metadata XML | Yes |
GET /saml/login | Starts AuthnRequest, accepts safe return target | Yes |
POST /saml/acs | Processes SAMLResponse and creates session | Yes |
GET /saml/logout | Starts logout with NameID/session index | Session-dependent |
GET /saml/sls | Handles logout callback and clears session | Yes |
Protect all operator/admin UI routes. Keep only health checks, webhook ingestion routes, and SAML protocol routes unauthenticated at the app level.
Use these defaults unless the SSO team confirms a different requirement:
authnRequestsSigned: TruewantMessagesSigned: TruewantAssertionsSigned: FalserequestedAuthnContext: FalsesignatureAlgorithm: rsa-sha256digestAlgorithm: sha256Why: the myKaarma IdP signs the outer response, and requiring a separately signed assertion has rejected valid logins. Requesting PasswordProtectedTransport AuthnContext has also caused IdP rejections.
Required environment:
BASE_URL: canonical public URL for the deployed app, no trailing slash.SP_ENTITY_ID or SAML_SP_ENTITY_ID: stable app-specific SP entity ID in app-ID form. Use local.ORG.APPNAME for local development and reserve com.ORG.APPNAME for UAT/shared registration. Replace ORG.APPNAME with the app-specific identifier. Do not use localhost, 127.0.0.1, ports, or request-derived URLs.SESSION_SECRET: high-entropy session signing secret.SP_PUBLIC_CERT or certs/sp.crt: public SP X.509 certificate configured as sp.x509cert so generated metadata includes <X509Certificate>.SP_PRIVATE_KEY: private key matching the SP public certificate, configured as sp.privateKey.For Flask-only variants:
SAML_SP_ENTITY_ID: same stable app-specific entity ID as above.SAML_SP_ACS_URL: usually ${BASE_URL}/saml/acs.SAML_SP_SLS_URL: usually ${BASE_URL}/saml/sls.FLASK_SECRET_KEY: high-entropy session secret.Local bypass flags are allowed only for development and tests. They must default to off, be visibly named as local-only, and never be required for production.
For FastAPI:
app/saml.py.BASE_URL, not from internal localhost/proxy request URLs.sp.entityId from the stable app-specific entity ID, not from BASE_URL.SessionMiddleware with https_only=True when BASE_URL is HTTPS.await request.form() into post_data before calling auth.process_response().For Flask:
prepare_flask_request(request) to pass scheme, host, path, query, and form data to OneLogin_Saml2_Auth.X-Forwarded-Proto or public env vars so metadata advertises HTTPS behind a proxy./saml/login.In both:
127.0.0.1:5000, without creating identical SP identities. Use the local.* entity ID for local metadata and the com.* entity ID only for UAT/shared environments.python3-saml needs the public certificate in sp.x509cert and the private key in sp.privateKey.UserUUID, Email, UserName, and optionally DealerUUIDs from SAML attributes.BASE_URL./saml/metadata returns valid XML, entity ID equals the environment-specific app ID (local.ORG.APPNAME locally, com.ORG.APPNAME for UAT), ACS/SLS URLs match the public domain exactly, and the SP <X509Certificate> is present.sso@mykaarma.com with the SP metadata XML file attached. In the email body, also list the entity ID, ACS URL, SLS URL, environment, and technical contact./saml/login -> IdP -> /saml/acs -> protected UI.GET /saml/metadata returns 200 text/xml.OneLogin_Saml2_Settings.validate_metadata./saml/login redirects to the myKaarma IdP with signed request parameters when signing is enabled.403.| Mistake | Correct Pattern |
|---|---|
Metadata entity ID uses localhost, 127.0.0.1:5000, a port, an old domain, or the UAT com.* ID for local work | Use local.ORG.APPNAME locally and com.ORG.APPNAME for UAT; use BASE_URL only for ACS/SLS URLs |
| Fetching IdP metadata live | Pin/configure IdP cert and URLs |
| Requiring signed assertions | Require signed response messages; set wantAssertionsSigned: False unless SSO confirms otherwise |
| Requesting default AuthnContext | Set requestedAuthnContext: False |
| Configuring only the SP private key | Configure both sp.x509cert / certs/sp.crt and sp.privateKey |
| Creating a session before authorization | Deny unauthorized users in ACS |
| Redirecting RelayState back to login | Sanitize return targets and fall back to a protected landing page |
| Committing SP private key or session secret | Use env vars or secret manager |