Coding Workflows Workflow Advanced

AI Auth & Identity Workflow

Design access control before you build it, not after a breach — choose the authentication approach, model the roles and permissions, review the design for gaps, then document the identity model.

The problem

Access control is the part of a system you cannot retrofit safely — bolt authorization on after the fact and you get the leaked record, the privilege escalation, the role that can do more than anyone intended. The decisions are upfront and they compound: how users prove who they are, what each role may do, where the identity boundaries sit, how sessions behave. 'Ask AI to add auth' produces a login form and stops, skipping the authorization model that actually keeps data safe. This workflow designs the whole access-control strategy — authentication, roles, permissions, sessions — and reviews it for gaps before a single check ships.

Recommended workflow

Each step uses an existing NewPrompt tool, pre-filled by a matching resource. Open the resource to read it, or jump straight into the tool with the inputs ready.

  1. Choose the authentication approach

    Anchor the model as a security engineer and decide how users prove who they are — sessions versus tokens, password versus passwordless, SSO, MFA — on the trade-offs your system actually faces, not the default.

    Outcome An authentication approach chosen on its trade-offs.
  2. Model the roles and permissions

    Design the authorization model one decision at a time: the roles, what each may do, how permissions compose (RBAC and beyond), and how sessions carry identity. This is the layer that actually controls access.

    Outcome Roles, permissions, and session strategy modeled.
  3. Review the access-control design for gaps

    Turn a security lens on the design before it's code: missing checks, privilege escalation, roles that can do too much, identity boundaries that leak. Find the holes while they're still cheap to close.

    Outcome The access-control design reviewed for escalation and missing checks.
  4. Document the identity model

    Capture the decisions — auth method, role-and-permission matrix, session rules, identity boundaries — in a document the build follows and the next security review starts from.

    Outcome The auth and identity model documented for the build.

Expected outcome

An access-control strategy designed before implementation — authentication chosen on trade-offs, roles and permissions modeled, the design reviewed for escalation and gaps, and the identity model documented — so security is built into the structure instead of patched in after the first leak.

Best for

  • Designing authentication and authorization before building it
  • Modeling roles, RBAC, and permissions deliberately
  • Reviewing an access-control design for gaps before it ships

Not for

  • Reviewing existing code for vulnerabilities — use the AI Security Review Workflow
  • Designing the API surface — use the AI API Design Workflow
  • Designing the data model — use the AI Database Design Workflow

FAQ

AI auth workflow vs API design workflow: which do I use?

Use this one for who may call your endpoints and what they can do; use API Design for the endpoints and contracts themselves. This workflow designs authentication, roles, permissions, and sessions — the access layer over the API surface. They inform each other, but the role-and-permission model is a separate artifact you design here.

What does the AI auth and identity workflow produce?

A documented identity model: the chosen authentication approach with its trade-offs, a role-and-permission matrix, session rules, and identity boundaries — plus notes from the gap review. Step 4 captures it in Markdown so your build follows it and the next security review starts from it. You write the prompts' outputs into that document yourself.

How do I run the AI auth and identity workflow?

Work the four steps in order in your own AI tool: choose the authentication approach, model roles and permissions, review the design for escalation and missing checks, then document it. NewPrompt gives you the prompt for each step plus the tool and resource links; you run each prompt and carry its output into the next step.

Does AI auth design replace a security audit?

No. This workflow designs access control up front and pressure-tests it for gaps, but it does not certify the result or replace a security audit or penetration test. The AI assists your reasoning; it does not sign off. High-stakes systems still need a real audit of the implemented code, and the final call is yours.

What do I need before starting the auth and identity workflow?

Know your system's real constraints: who the users are, what data needs protecting, any compliance or SSO requirements, and the trade-offs you actually face — so step 1 chooses authentication on those, not a default. Vague inputs produce a generic login form; the more concrete the context, the sharper the role-and-permission model.

Does the AI decide my security model?

No. It structures the auth and authorization decisions, surfaces the trade-offs, and pressure-tests the design for gaps — but the access-control calls, and owning their consequences, stay with you. High-stakes systems still warrant a real security audit.

Part of these projects

Complete build journeys that include this workflow as a stage.

Guides for this workflow

Recommended next workflow

Tip: Each step's resource opens its tool pre-filled — start at step one and carry the output forward.