axum-impl-authorization

Official

Protect Axum routes with correct authz.

AuthorImpertio-Studio
Version1.0.0
Installs0

System Documentation

What problem does it solve?

Prevents authorization mistakes in Axum—like converting real 404s into 401s, returning the wrong status codes, or implementing guards in a way that leaks route existence.

Core Features & Use Cases

  • Correct guard placement: Uses .route_layer() for authorization so the guard runs only for matched routes, avoiding 404-to-401/403 leakage.
  • Right status code semantics: Enforces the rule that failed authorization returns 403 Forbidden, while 401 Unauthorized remains the job of the authentication layer.
  • Two authorization mechanisms: Supports both middleware guards (from_fn, from_fn_with_state + route_layer) for route groups and newtype guard extractors (FromRequestParts, e.g., AdminClaims) for single-handler enforcement.
  • Version-aware extractor patterns: Covers Axum 0.7 and 0.8 differences for the FromRequestParts newtype implementation.

Quick Start

Use the axum-impl-authorization skill to design a role/permission guard that returns 403 on unauthorized access and is applied with .route_layer() so missing routes still produce a real 404.

Dependency Matrix

Required Modules

None required

Components

references

💻 Claude Code Installation

Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.

Please help me install this Skill:
Name: axum-impl-authorization
Download link: https://github.com/Impertio-Studio/Axum-Claude-Skill-Package/archive/main.zip#axum-impl-authorization

Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
View Source Repository

Agent Skills Search Helper

Install a tiny helper to your Agent, search and equip skill from 471,000+ vetted skills library on demand.