Token导航 LogoToken导航

Agent Skill · 研究检索

setup-auth(设置授权)

用于辅助安全审计、权限检查、凭据风险、认证流程和常见漏洞排查。它适合让 Agent 梳理敏感配置、检查依赖风险、分析鉴权逻辑或生成安全复核清单。使用时不能把工具输出直接当最终结论,涉及密钥、令牌、用户数据或生产系统时,应先确认最小权限、脱敏方式和操作边界。

setup-auth 是研究检索类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为接触敏感数据;许可证信息还不明确,第三方扫描已通过,按安装量在研究检索类的 73,675 个 Skill 里排第 48,806。

总安装 675周安装 29GitHub Stars 228下载 237核验 2026-05-01

安装说明

本站只整理中文说明,不托管安装包,也不代用户安装。
GitHub
许可证
unknown

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:setup-auth(设置授权)
来源仓库:https://github.com/microsoft/power-platform-skills
仓库路径:skills/setup-auth
安装命令:
npx skills add https://github.com/microsoft/power-platform-skills --skill setup-auth
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/microsoft/power-platform-skills --skill setup-auth

这个 Skill 是做什么的

研究检索类 Skill 主要解决「找资料、核对事实、把来源整理清楚」的问题,通常会让助手先检索再总结。

用于辅助安全审计、权限检查和认证流程分析。适合梳理敏感配置、检查依赖风险或生成安全复核清单。通过 npx skills add 命令从 Microsoft Power Platform Skills 仓库安装。不能将工具输出直接作为最终结论,涉及密钥或生产系统时应确认最小权限和操作边界。

setup-auth 属于研究检索类 Skill,可作为该场景下的辅助能力补充。

来源仓库内路径:skills/setup-auth

上手步骤

4 步
  1. 1

    确认自己的宿主工具

    公开资料标注支持 Codex、Claude、Cursor、Gemini CLI;先确认自己用的是其中之一,再按对应工具的 Skills 目录放置。

  2. 2

    拿到安装命令

    可以直接复制的命令是 npx skills add https://github.com/microsoft/power-platform-skills --skill setup-…;命令里的占位符换成自己的路径或密钥再执行。

  3. 3

    安装后重启宿主

    命令执行完要完全退出宿主工具再打开,让新装的 Skill 被重新扫描到,否则列表里可能看不到。

  4. 4

    按最小权限试用

    它需要接触敏感数据,先在测试目录或测试账号里跑,确认没问题再放到正式项目。

常见问题

6 条

setup-auth 怎么安装?

在终端执行 npx skills add https://github.com/microsoft/power-platform-skills --skill setup-auth。装完完全退出宿主工具再打开,让它重新扫描本地 Skill。

setup-auth 支持哪些 AI 工具?

公开资料标注支持 Codex、Claude、Cursor、Gemini CLI。其他工具只要能读取本地 Skill 目录,一般也能手动放进去,但要自己确认触发方式是否一致。

setup-auth 需要什么权限?

权限级别是接触敏感数据。该 Skill 可能接触密钥、Token、环境变量或敏感配置,应进入高风险复核队列,默认不自动发布。

setup-auth 是免费的吗?

公开资料没有标注明确许可证,收费和商用限制都无法确认。正式使用前请到来源仓库核对授权说明。

setup-auth 用的人多吗?

公开数据是累计安装 675 次,近一周安装 29 次,下载 237 次,GitHub 228 星。这些数字来自第三方目录统计,只能当作热度参考,不代表质量或安全性。

setup-auth 安全吗?

第三方扫描结果为通过,但这只覆盖已知的静态检查项,不能替代自己读一遍源码和安装命令。

值得选的地方和要先想清楚的地方

值得选的地方

  • 同时适配 4 种工具,换客户端不用重新找替代品。
  • 第三方扫描已通过,常见的高风险行为没有命中。

先想清楚的地方

  • 需要接触敏感数据,装到常用环境前要先评估影响面。
  • 许可证没有明确标注,能不能商用、能不能再分发都不确定。
  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

  • 已经在用 Codex,想直接扩展它能力的人。
  • 需要处理研究检索类任务、又不想每次都手写提示词的人。

不太适合

  • 环境里有大量密钥、凭证,不方便给第三方 Skill 读取的人。
  • 需要明确授权才能用到公司项目里的场景。
  • 需要厂商级技术支持和 SLA 的生产系统。

研究检索类 Skill 对比

6 个同类
Skill总安装GitHub 星权限许可证扫描
find-skills

寻找技能 · Codex、Claude

31,199,81316,486操作浏览器MIT有提醒
self-improving-agent

自我改进 Agent · OpenClaw

16,464,0023,396接触敏感数据MIT-0通过
soultrace

灵魂追踪 · Codex、Claude

7,588,94412需要联网未明确有提醒
self-improving

自我完善 · OpenClaw

6,829,2841,046需要联网MIT-0通过
microsoft-foundry

微软代工厂 · Codex、Claude

6,614,144764调用外部服务未明确有提醒
setup-auth

设置授权 · 本页

675228接触敏感数据未明确通过

按安装量取同分类前几名;数字来自第三方目录统计,只作热度参考,不代表质量结论。

SKILL.md 原文

Plugin check: Run node "${CLAUDE_PLUGIN_ROOT}/scripts/check-version.js" — if it outputs a message, show it to the user before proceeding.

Set Up Authentication & Authorization

Configure authentication (login/logout via Microsoft Entra ID) and role-based authorization for a Power Pages code site. This skill creates an auth service, type declarations, authorization utilities, auth UI components, and role-based access control patterns appropriate to the site's framework.

Core Principles

  • Client-side auth is UX only — Power Pages authentication is server-side (session cookies). Client-side role checks control what users see, not what they can access. Server-side table permissions enforce actual security.
  • Framework-appropriate patterns — Every auth artifact (hooks, composables, services, directives, guards) must match the detected framework's idioms and conventions.
  • Development parity — Include mock data for local development so developers can test auth flows and role-based UI without deploying to Power Pages.

Initial request: $ARGUMENTS

Prerequisites: - An existing Power Pages code site created via /create-site - The site must be deployed at least once (.powerpages-site folder must exist) - Web roles must be created via /create-webroles

Workflow

  1. Phase 1: Check Prerequisites — Verify site exists, detect framework, check web roles
  2. Phase 2: Plan — Gather auth requirements and present plan for approval
  3. Phase 3: Create Auth Service — Auth service with login/logout and type declarations
  4. Phase 4: Create Authorization Utils — Role-checking functions and wrapper components
  5. Phase 5: Create Auth UI — Login/logout button integrated into navigation
  6. Phase 6: Implement Role-Based UI — Apply role-based patterns to site components
  7. Phase 7: Verify Auth Setup — Validate all auth files exist, build succeeds, auth UI renders
  8. Phase 8: Review & Deploy — Summary and deployment prompt

Phase 1: Check Prerequisites

Goal: Confirm the project exists, identify the framework, verify deployment status and web roles, and check for existing auth code.

Actions

1.1 Locate Project

Look for powerpages.config.json in the current directory or immediate subdirectories:

**/powerpages.config.json

If not found: Tell the user to create a site first with /create-site.

1.2 Detect Framework

Read package.json to determine the framework (React, Vue, Angular, or Astro). See ${CLAUDE_PLUGIN_ROOT}/references/framework-conventions.md for the full framework detection mapping.

1.3 Check Deployment Status

Look for the .powerpages-site folder:

**/.powerpages-site

If not found: Tell the user the site must be deployed first:

"The .powerpages-site folder was not found. The site needs to be deployed at least once before authentication can be configured."

Use AskUserQuestion:

QuestionOptions
Your site needs to be deployed first. Would you like to deploy now?Yes, deploy now (Recommended), No, I'll do it later

If "Yes, deploy now": Invoke /deploy-site, then resume.

If "No": Stop — the site must be deployed first.

1.4 Check Web Roles

Look for web role YAML files in .powerpages-site/web-roles/:

**/.powerpages-site/web-roles/*.yml

Read each file and compile a list of existing web roles (name, id, flags).

If no web roles exist: Warn the user that web roles are needed for authorization. Ask if they want to create them first:

QuestionOptions
No web roles were found. Web roles are required for role-based authorization. Would you like to create them now?Yes, create web roles first (Recommended), Skip — I'll add roles later

If "Yes": Invoke /create-webroles, then resume.

If "Skip": Continue — auth service and login/logout will still work, but role-based authorization will need roles created later.

1.5 Check for Existing Auth Code

Search for existing auth files to avoid duplicating work:

  • src/services/authService.ts or src/services/authService.js
  • src/types/powerPages.d.ts
  • src/utils/authorization.ts or src/utils/authorization.js
  • Auth components (e.g., AuthButton.tsx, AuthButton.vue)

If auth files already exist, present them to the user and ask whether to overwrite or skip.

Output

  • Project root path confirmed
  • Framework identified (React, Vue, Angular, or Astro)
  • Deployment status verified
  • Web roles inventory compiled
  • Existing auth code conflicts identified (if any)

Phase 2: Plan

Goal: Gather authentication requirements from the user and present the implementation plan for approval.

Actions

2.1 Gather Requirements

Use AskUserQuestion to determine the scope:

QuestionOptions
Which authentication features do you need?Login & Logout + Role-based access control (Recommended), Login & Logout only, Role-based access control only (auth service already exists)

If web roles were found in Phase 1.4, also ask:

QuestionOptions
Which web roles should have access to protected areas of the site?*(List discovered web role names as options)*
2.2 Present Plan for Approval

Present the implementation plan inline:

  • Which files will be created (auth service, types, authorization utils, components)
  • How the auth UI will be integrated into the site's navigation
  • Which routes/components will be protected and with which roles
  • The site setting that needs to be configured (Authentication/Registration/ProfileRedirectEnabled = false)

Use AskUserQuestion to get approval:

QuestionOptions
Here is the implementation plan for authentication and authorization. Would you like to proceed?Approve and proceed (Recommended), I'd like to make changes

If "Approve and proceed": Continue to Phase 3.

If "I'd like to make changes": Ask the user what they want to change, revise the plan, and present it again for approval.

Output

  • Authentication scope confirmed (login/logout, role-based access, or both)
  • Target web roles selected
  • Implementation plan approved by user

Phase 3: Create Auth Service

Goal: Create the authentication service, type declarations, and framework-specific auth hook/composable with local development mock support.

Reference: ${CLAUDE_PLUGIN_ROOT}/skills/setup-auth/references/authentication-reference.md

Actions

3.1 Create Type Declarations

Create src/types/powerPages.d.ts with type definitions for the Power Pages portal object and user:

  • PowerPagesUser interface — userName, firstName, lastName, email, contactId, userRoles[]
  • PowerPagesPortal interface — User, version, type, id, geo, tenant, etc.
  • Global Window interface extension for Microsoft.Dynamic365.Portal
3.2 Create Auth Service

Create the auth service file based on the detected framework:

All frameworks: Create src/services/authService.ts with these functions:

  • getCurrentUser() — reads from window.Microsoft.Dynamic365.Portal.User
  • isAuthenticated() — checks if user exists and has userName
  • getTenantId() — reads from portal config (window.Microsoft.Dynamic365.Portal.tenant)
  • fetchAntiForgeryToken() — fetches from /_layout/tokenhtml and parses HTML response
  • login(returnUrl?) — creates a form POST to /Account/Login/ExternalLogin with:

- Anti-forgery token from /_layout/tokenhtml - Provider URL: https://login.windows.net/{tenantId}/ - Return URL (defaults to current page)

  • logout(returnUrl?) — redirects to /Account/Login/LogOff
  • getUserDisplayName() — prefers full name, falls back to userName
  • getUserInitials() — for avatar display

CRITICAL: Power Pages authentication is server-side (session cookies). The login flow posts a form to the server which redirects to Entra ID. There is no client-side token management. The fetchAntiForgeryToken() call gets a CSRF token for the form POST, not a bearer token.

3.3 Create Framework-Specific Auth Hook/Composable

Based on the detected framework:

  • React: Create src/hooks/useAuth.ts — custom hook returning {user, isAuthenticated, isLoading, displayName, initials, login, logout, refresh}
  • Vue: Create src/composables/useAuth.ts — composable using ref, computed, onMounted returning reactive auth state
  • Angular: Create src/app/services/auth.service.ts — injectable service with BehaviorSubject for user state
  • Astro: Create src/services/authService.ts only (no framework-specific wrapper needed — use the service directly in components)
3.4 Add Mock Data for Local Development

Auth only works when served from Power Pages (not during local npm run dev). Add a development mock pattern in the auth service:

// In development (localhost), return mock user data for testing
const isDevelopment = window.location.hostname === 'localhost' || window.location.hostname === '127.0.0.1';

The mock should return a fake user with configurable roles so developers can test role-based UI locally.

Output

  • src/types/powerPages.d.ts created with Power Pages type definitions
  • src/services/authService.ts created with login/logout functions
  • Framework-specific auth hook/composable created
  • Local development mock data included

Phase 4: Create Authorization Utils

Goal: Create role-checking utilities and framework-specific authorization components (guards, directives, wrapper components).

Reference: ${CLAUDE_PLUGIN_ROOT}/skills/setup-auth/references/authorization-reference.md

Actions

4.1 Create Core Authorization Utilities

Create src/utils/authorization.ts with:

  • getUserRoles() — returns array of role names from current user
  • hasRole(roleName) — case-insensitive single role check
  • hasAnyRole(roleNames) — OR check across multiple roles
  • hasAllRoles(roleNames) — AND check across multiple roles
  • isAuthenticated() — re-exports from auth service
  • isAdmin() — checks for "Administrators" role
  • hasElevatedAccess(additionalRoles) — checks admin or specified roles
4.2 Create Framework-Specific Authorization Components

Based on the detected framework:

React:

  • src/components/RequireAuth.tsx — renders children only for authenticated users, optional login prompt fallback
  • src/components/RequireRole.tsx — renders children only for users with specified roles, supports requireAll mode
  • src/hooks/useAuthorization.ts — hook returning {roles, hasRole, hasAnyRole, hasAllRoles, isAuthenticated, isAdmin}

Vue:

  • src/composables/useAuthorization.ts — composable with computed roles and role-checking functions
  • src/directives/vRole.ts — v-role directive for declarative role-based visibility

Angular:

  • src/app/guards/auth.guard.ts — CanActivateFn with route data for required roles
  • src/app/directives/has-role.directive.ts — structural directive *appHasRole="'RoleName'"

Astro:

  • src/utils/authorization.ts only (use directly in component scripts)
4.3 Security Reminder

Add a comment at the top of the authorization utilities:

// IMPORTANT: Client-side authorization is for UX only, not security.
// Server-side table permissions enforce actual access control.
// Always configure table permissions via /integrate-webapi.

Output

  • src/utils/authorization.ts created with role-checking functions
  • Framework-specific authorization components created (guards, directives, or wrapper components)
  • Security reminder comments included

Phase 5: Create Auth UI

Goal: Create the login/logout button component and integrate it into the site's navigation.

Actions

5.1 Create Auth Button Component

Based on the detected framework, create a login/logout button component:

  • React: src/components/AuthButton.tsx + src/components/AuthButton.css
  • Vue: src/components/AuthButton.vue
  • Angular: src/app/components/auth-button/auth-button.component.ts + template + styles
  • Astro: src/components/AuthButton.astro

The component should:

  • Show a "Sign In" button when the user is not authenticated
  • Show the user's display name, avatar (initials-based), and a "Sign Out" button when authenticated
  • Include a loading state while checking auth status
  • Be styled to match the site's existing design (read existing CSS variables/theme)
5.2 Integrate into Navigation

Find the site's navigation component and integrate the auth button:

  1. Search for the nav/header component in the site's source code
  2. Import the AuthButton component
  3. Add it to the navigation bar (typically in the top-right area)

Do NOT replace the existing navigation — add the auth button alongside existing nav items.

5.3 Git Commit

Stage and commit the auth files:

git add -A
git commit -m "Add authentication service and auth UI component"

Output

  • Auth button component created for the detected framework
  • Auth button integrated into the site's navigation
  • Changes committed to git

Phase 6: Implement Role-Based UI

Goal: Identify protected content areas and apply role-based authorization patterns to the site's components.

Actions

6.1 Identify Protected Content

Analyze the site's components to find content that should be role-gated:

  • Admin-only sections (dashboards, settings)
  • Authenticated-only content (profile, data views)
  • Role-specific features (edit buttons, create forms)

Present findings to the user and confirm which areas to protect.

6.2 Apply Authorization Patterns

Based on the user's choices, wrap the appropriate components:

React example:

<RequireAuth fallback={<p>Please sign in to view this content.</p>}>
  <Dashboard />
</RequireAuth>

<RequireRole roles={['Administrators']} fallback={<p>Access denied.</p>}>
  <AdminPanel />
</RequireRole>

Vue example:

<div v-role="'Administrators'">
  <AdminPanel />
</div>

Angular example:

{ path: 'admin', component: AdminComponent, canActivate: [authGuard, roleGuard], data: { roles: ['Administrators'] } }
6.3 Git Commit

Stage and commit:

git add -A
git commit -m "Add role-based access control to site components"

Output

  • Protected content areas identified and confirmed with user
  • Role-based authorization patterns applied to components
  • Changes committed to git

Phase 7: Verify Auth Setup

Goal: Validate that all auth files exist, the project builds, and the auth UI renders correctly.

Actions

7.1 Verify File Inventory

Confirm the following files were created:

  • src/types/powerPages.d.ts — Power Pages type declarations
  • src/services/authService.ts — Auth service with login/logout functions
  • Framework-specific auth hook/composable (e.g., src/hooks/useAuth.ts for React)
  • src/utils/authorization.ts — Role-checking utilities
  • Framework-specific authorization components (e.g., RequireAuth.tsx, RequireRole.tsx for React)
  • Auth button component (e.g., src/components/AuthButton.tsx for React)

Read each file and verify it contains the expected exports and functions:

  • Auth service: login, logout, getCurrentUser, isAuthenticated, fetchAntiForgeryToken
  • Authorization utils: hasRole, hasAnyRole, hasAllRoles, getUserRoles
7.2 Verify Build

Run the project build to catch any import errors, type errors, or missing dependencies:

npm run build

If the build fails, fix the issues before proceeding.

7.3 Verify Auth UI Renders

Start the dev server and verify the auth button appears in the navigation:

npm run dev

Use Playwright to navigate to the site and take a snapshot to confirm the auth button is visible:

  • Navigate to http://localhost:<port>
  • Take a browser snapshot
  • Verify the auth button (Sign In / mock user) appears in the navigation area

If the auth button is not visible or the page has rendering errors, fix the issues.

Output

  • All auth files verified (present and contain expected exports)
  • Project builds successfully
  • Auth UI renders correctly in the browser

Phase 8: Review & Deploy

Goal: Create required site settings, present a summary of all work, and prompt for deployment.

Actions

8.1 Create Site Setting

The site needs the Authentication/Registration/ProfileRedirectEnabled setting set to false to prevent Power Pages from redirecting users to a profile page after login (which doesn't exist in code sites).

Check if .powerpages-site/site-settings/ exists. If it does, create the site setting file:

node "${CLAUDE_PLUGIN_ROOT}/scripts/generate-uuid.js"

Create .powerpages-site/site-settings/authentication-registration-profileredirectenabled.yml:

id: <UUID from generate-uuid.js>
name: Authentication/Registration/ProfileRedirectEnabled
value: false
8.2 Record Skill Usage
Reference: ${CLAUDE_PLUGIN_ROOT}/references/skill-tracking-reference.md

Follow the skill tracking instructions in the reference to record this skill's usage. Use --skillName "SetupAuth".

8.3 Present Summary

Present a summary of everything created:

ComponentFile(s)Status
Type Declarationssrc/types/powerPages.d.tsCreated
Auth Servicesrc/services/authService.tsCreated
Auth Hook/Composablesrc/hooks/useAuth.ts (or framework equivalent)Created
Authorization Utilssrc/utils/authorization.tsCreated
Auth ComponentsRequireAuth, RequireRole (or framework equivalent)Created
Auth Buttonsrc/components/AuthButton.tsx (or framework equivalent)Created
Site SettingProfileRedirectEnabled = falseCreated
8.4 Ask to Deploy

Use AskUserQuestion:

QuestionOptions
Authentication and authorization are configured. To make login work, the site needs to be deployed. Would you like to deploy now?Yes, deploy now (Recommended), No, I'll deploy later

If "Yes, deploy now": Invoke /deploy-site.

If "No": Remind the user:

"Remember to deploy your site using /deploy-site when you're ready. Authentication will not work until the site is deployed with the new site settings."
8.5 Post-Deploy Notes

After deployment (or if skipped), remind the user:

  • Test on deployed site: Auth only works on the deployed Power Pages site, not on localhost
  • Entra ID configuration: The site's identity provider must be configured in the Power Pages admin center to use Microsoft Entra ID
  • Assign web roles: Users must be assigned appropriate web roles in the Power Pages admin center
  • Table permissions: Client-side auth checks are for UX only — configure server-side table permissions via /integrate-webapi for actual data security
  • Local development: The auth service includes mock data for testing on localhost — remove or disable before production

Output

  • ProfileRedirectEnabled site setting created
  • Full summary presented to user
  • Deployment prompted (or skipped with reminder)
  • Post-deploy guidance provided

Important Notes

Progress Tracking

Use TaskCreate at the start to track each phase:

TaskDescription
Phase 1Check Prerequisites — verify site, framework, deployment, web roles
Phase 2Plan — gather requirements and get user approval
Phase 3Create Auth Service — auth service, types, framework hook/composable
Phase 4Create Authorization Utils — role-checking functions and components
Phase 5Create Auth UI — AuthButton component and navigation integration
Phase 6Implement Role-Based UI — apply authorization patterns to components
Phase 7Verify Auth Setup — validate files exist, build succeeds, auth UI renders
Phase 8Review & Deploy — site setting, summary, deployment prompt

Update each task with TaskUpdate as phases are completed.

Key Decision Points

  • Phase 1.3: Deploy now or stop? (site must be deployed before auth setup)
  • Phase 1.4: Create web roles now or skip? (roles needed for authorization)
  • Phase 1.5: Overwrite or skip existing auth files?
  • Phase 2.1: Which auth features to include? (login/logout, role-based, or both)
  • Phase 2.2: Approve plan or request changes?
  • Phase 6.1: Which content areas to protect with role-based access?
  • Phase 8.3: Deploy now or later?

Begin with Phase 1: Check Prerequisites

平台分布

Codex

35.12%
按下载量换算83

Claude

30.39%
按下载量换算72

Cursor

19.4%
按下载量换算46

Gemini CLI

10.39%
按下载量换算25

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

接触敏感数据

该 Skill 可能接触密钥、Token、环境变量或敏感配置,应进入高风险复核队列,默认不自动发布。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。目前只有一个公开来源,建议同时核对源仓库。

继续浏览同类 Skills