v1.31.0
conocimientopostman-collectionpatterns/

auth-detection.md

Referencia que postman-collection carga bajo demanda desde su SKILL.md.

postman-collectionskill
patternscarpeta
4402 Btamaño
2026-09-08último cambio del pack

Purpose: Detect the authentication mode of a .NET project and configure Postman collections accordingly. Version: 1.0.0


3-Step Detection Algorithm

Step 1: SCAN - Files to Inspect

Claude MUST scan these files in order:

  1. Program.cs / Startup.cs - Primary source of auth configuration
  2. appsettings.json - Configuration sections (AzureAd, Authentication)
  3. *.csproj - NuGet packages that indicate auth libraries
  4. **Controllers/.cs* - [Authorize] attributes, auth schemes

Step 2: RESOLVE - Signal-to-Mode Mapping

SignalAuth ModeConfidence
AddMicrosoftIdentityWebApi + section AzureAdAzure ADHigh
AddAuthentication(JwtBearerDefaults) without Azure AD sectionOAuth2/JWTHigh
ApiKeyMiddleware or X-API-Key header checkAPI KeyHigh
BasicAuthenticationHandler or AddScheme<BasicAuth>Basic AuthHigh
HmacAuthenticationHandler or HttpSignatureHttpSignatureHigh
AddCertificateForwarding or ClientCertificatemTLSMedium
AddAuthentication().AddCookie() onlyCookieMedium
No auth middleware detectedNo AuthHigh
Priority Resolution (when multiple signals present)
  1. Azure AD takes precedence over generic JWT
  2. HttpSignature takes precedence if HttpSignatureClient tables exist
  3. API Key is additive (often combined with Azure AD for external clients)
  4. mTLS is typically infrastructure-level (not collection-level)

Step 3: CONFIGURE - Template Selection per Mode

Auth ModeCollection AuthPre-Request ScriptEnvironment Variables
Azure AD"type": "bearer"auth-prerequest-azuread.js.templatetenantId, clientId, clientSecret, scope, azureAdTokenUrl
OAuth2/JWT"type": "bearer"Token request to /auth/tokentokenUrl, clientId, clientSecret, scope
API Key"type": "apikey"auth-prerequest-apikey.js.templateapiKey, apiKeyHeader
Basic Auth"type": "basic"auth-prerequest-basic.js.templatebasicUsername, basicPassword
HttpSignature"type": "bearer"Custom (see http-signature-mtls.md)httpSignaturePrivateKey, httpSignatureAlgorithm
mTLSCertificate-basedN/A (Postman Settings)pfxPath, pfxPassword
No Auth"type": "noauth"NoneN/A

Detection Code Patterns

Azure AD Detection

// Signal: AddMicrosoftIdentityWebApi in Program.cs/Startup.cs
builder.Services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)
    .AddMicrosoftIdentityWebApi(builder.Configuration.GetSection("AzureAd"));

// Confirm: AzureAd section in appsettings.json
"AzureAd": {
    "Instance": "https://login.microsoftonline.com/",
    "TenantId": "...",
    "ClientId": "...",
    "Audience": "api://..."
}

API Key Detection

// Signal: Custom middleware or attribute
[ApiKeyAuth]
public class MyController { }

// Or in Program.cs
app.UseMiddleware<ApiKeyMiddleware>();

// Or header check in code
var apiKey = context.Request.Headers["X-API-Key"];

Basic Auth Detection

// Signal: Basic auth handler registration
builder.Services.AddAuthentication("BasicAuthentication")
    .AddScheme<AuthenticationSchemeOptions, BasicAuthenticationHandler>(
        "BasicAuthentication", null);

HttpSignature Detection

// Signal: Custom handler with signature verification
builder.Services.AddAuthentication()
    .AddScheme<HmacAuthenticationOptions, HmacAuthenticationHandler>(...);

// Or table with HttpSignatureClient keys
// HttpSignatureClientPublic / HttpSignatureClientPrivate

Applying to Collection

After detection, Claude should:

  1. Set collection-level auth object matching the detected mode
  2. Add the appropriate pre-request script at collection level
  3. Generate environment files with all required auth variables per environment (Dev/Pre/Pro)
  4. Document the auth mode in the collection description
  5. Add a "Health Check" request WITHOUT auth as the first request in the collection
  6. Add an "Auth Test" folder with requests that validate the auth configuration

Pattern v1.0.0 - Auth Detection for Postman Collections

← Volver a la ficha de postman-collection

Ovillo v1.31.0tag v1.31.0 (2026-10-06) · sin decisiones posteriores69 skills · 19 agents · 22 hooks · 3 reglas · 15 tools · 103 decisionesfuente: ovillo/.claude/skills/postman-collection/patterns/auth-detection.mdCopyright 2026 Hugo Valer Rojas · Apache-2.0