AS

asl-java-implement-rule-authz

Guidelines for implementing secure RBAC and authz in Java/Spring.

Install

mkdir -p .claude/skills/asl-java-implement-rule-authz && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/18019" && unzip -o skill.zip -d .claude/skills/asl-java-implement-rule-authz && rm skill.zip

Installs to .claude/skills/asl-java-implement-rule-authz

Activation

This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.

Use when: 需要在 LeaveSystem_Backend_Java 中实现认证与鉴权规则,覆盖 Header/JWT、RBAC、资源归属和默认拒绝。关键词: Java 鉴权, Spring Boot, RBAC, Authorization, 资源级权限
132 chars✓ has a “when” trigger
Advanced

Key capabilities

  • Implement authentication constraints for protected interfaces
  • Enforce authorization rules based on role matrices
  • Perform resource-level authorization checks in the Service layer or authentication chain
  • Ensure default rejection for unauthorized requests, missing headers, invalid tokens, or unknown users
  • Maintain consistent role literals between documentation, Java enums, and API headers
  • Return stable error codes for unauthorized responses without leaking internal details

How it works

The skill implements authentication and authorization rules in Spring Boot APIs, covering header/JWT validation, RBAC, resource ownership, and default-deny principles. It ensures that both authentication and authorization are enforced, with resource-level checks performed in the service layer.

Inputs & outputs

You give it
Target interface or service, role matrix source (e.g., docs/Req.md, docs/api_design.md)
You get back
Spring Boot API with clear authentication and authorization boundaries, preventing interface-level and resource-level privilege escalation

When to use asl-java-implement-rule-authz

  • Implement API authentication
  • Apply resource-level RBAC
  • Review authz failure responses

About this skill

Java 认证与鉴权子 Skill

意图

确保 Spring Boot API 具备清晰认证与授权边界,防止接口级和资源级越权。

输入

  • 目标接口或服务
  • 角色矩阵来源,默认 docs/Req.mddocs/api_design.md

规则

  • 认证与鉴权都必须覆盖;不得只依赖前端隐藏按钮或路由不可见。
  • 默认拒绝: 未明确授权的角色、缺失 Header、非法 Token、未知用户必须拒绝。
  • 角色权限按文档执行,当前模拟登录优先核对 X-User-NameX-User-Role,如代码已启用 JWT 则按认证链路执行。
  • 资源级授权必须在 Service 层或认证链路中二次校验,例如员工只能访问本人请假单。
  • 管理员、经理、员工权限边界不能混用;审批、额度调整、删除、撤回属于危险动作,必须校验操作者身份。
  • 未授权返回稳定错误码,如 FORBIDDEN 或项目约定错误码。

最小验证清单

  • 受保护接口有认证约束。
  • 已做资源级权限校验。
  • 默认拒绝未授权请求。
  • 角色字面量与 Java enum / API Header 保持一致。
  • 未授权响应结构稳定且不泄露内部细节。

When not to use it

  • When only relying on front-end hidden buttons or invisible routes for security
  • When authentication and authorization are not both covered
  • When administrator, manager, and employee permissions are mixed

Limitations

  • Authentication and authorization must both be covered
  • Default rejection is required for unauthorized requests, missing headers, illegal tokens, or unknown users
  • Resource-level authorization must be checked in the Service layer or authentication chain

How it compares

This approach systematically enforces clear authentication and authorization boundaries, including resource-level checks and default-deny patterns, providing a reliable security framework unlike relying on client-side controls or incomplete a

Compared to similar skills

asl-java-implement-rule-authz side by side with the closest alternatives in the catalog.

SkillInstallsUpdatedSafetyDifficulty
asl-java-implement-rule-authz (this skill)01moNo flagsAdvanced
springboot-security55moNo flagsIntermediate
spring-authorization-server05moNo flagsAdvanced
spring-boot-security113dNo flagsAdvanced

Try saying

Example prompts that trigger this skill in your AI assistant.

Search skills

Search the agent skills registry