AgentStack
Browse Sign in
Browse Why AgentStack Sell Docs
Sign in
SKILL verified MIT Self-run

Litestar Auth Guards

skill-litestar-org-litestar-skills-litestar-auth-guards · by litestar-org

Auto-activate for guards=, Guard, ASGIConnection, JWTAuth, JWTCookieAuth, SessionAuth, role or tenant checks, or WebSocket auth. Not for frontend route protection.

No reviews yet
0 installs
29 views
0.0% view→install

Install

$ agentstack add skill-litestar-org-litestar-skills-litestar-auth-guards

✓ scanned · ✓ verified, works with Claude Code, Cursor, and more.

Security review

✓ Passed

No issues found. Passed automated security review. · v0.1.0 How review works →

  • Prompt-injection patterns
  • Secret / credential exfiltration
  • Dangerous shell & filesystem operations
  • Untrusted network calls
  • Known-malicious package signatures

What it can access

  • Network access Used
  • Filesystem access No
  • Shell / process execution No
  • Environment & secrets No
  • Dynamic code execution No

From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.

View the full security report →

Verified badge

Passed review? Show it. Paste this badge into your README, it links to the public security report.

AgentStack Verified badge Links to your public security report.
[![AgentStack Verified](https://agentstack.voostack.com/badges/verified.svg)](https://agentstack.voostack.com/security/report/skill-litestar-org-litestar-skills-litestar-auth-guards)

Reliability & compatibility

Security review passed
0 installs to date
no reviews yet
2mo ago

Declared compatibility

Claude CodeClaude Desktop

Compatibility is declared by the source manifest. End-to-end runtime verification is coming, see below.

Preview Execution monitoring

We're building live execution health for every listing: tool-call success rate, median latency, uptime, and last-checked timestamps, measured, not self-reported. It isn't live yet, so we don't show numbers we can't stand behind.

How agent discovery & health will work →
Are you the author of Litestar Auth Guards? Claim this listing to set pricing, connect Stripe payouts, and keep 70% of every sale.
Sign up to claim

About

Litestar Auth and Guards

Use this skill for authentication boundaries, authorization checks, guard composition, and user context.

Code Style Rules

  • Put auth and permission checks in Guards or middleware, not handler bodies.
  • Prefer Controller-level guards when a whole domain shares a policy.
  • Raise Litestar HTTP exceptions or domain exceptions consistently.
  • Keep tenant isolation explicit in guard logic and service filters.

Quick Reference

  • Guard patterns: [guards.md](references/guards.md)
  • Middleware user loading: [litestar-middleware](../litestar-middleware/SKILL.md)
  • Realtime auth: [litestar-realtime](../litestar-realtime/SKILL.md)

Workflow

  1. Determine where identity is loaded.
  2. Add Guards at app, Controller, or route scope.
  3. Keep permission checks reusable and testable.
  4. Verify denial paths and authenticated success paths.

Guardrails

  • Do not inline auth checks in handlers.
  • Do not make Guards perform database work repeatedly when middleware can load the user once.
  • Do not trust client-supplied tenant IDs without server-side scoping.
  • Do not use HTTP-only assumptions for WebSocket auth.

Validation Checkpoint

  • [ ] Guard scope matches the policy scope.
  • [ ] Denial paths return the expected status.
  • [ ] Handlers contain no duplicated auth branching.
  • [ ] WebSocket routes use an explicit browser-compatible auth path.

Example

from litestar.connection import ASGIConnection
from litestar.exceptions import PermissionDeniedException
from litestar.handlers import BaseRouteHandler

async def requires_active_user(connection: ASGIConnection, _: BaseRouteHandler) -> None:
    if not connection.user or not connection.user.is_active:
        raise PermissionDeniedException("Authentication required")

References Index

  • [guards.md](references/guards.md)

Official References

  • - Litestar documentation
  • - Litestar API reference

Shared Styleguide Baseline

  • [General](../litestar-styleguide/references/general.md)
  • [Python](../litestar-styleguide/references/python.md)
  • [Litestar](../litestar-styleguide/references/litestar.md)

Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

Install and usage instructions live in the source repository linked above.

Reviews

No reviews yet, be the first.

Versions

  • v0.1.0 Imported from the upstream source.