[GH-ISSUE #9190] Add Enterprise IAM Plugin for Policy-Based Access Control #28629

Open
opened 2026-04-17 20:03:26 -05:00 by GiteaMirror · 2 comments
Owner

Originally created by @seanfilimon on GitHub (Apr 14, 2026).
Original GitHub issue: https://github.com/better-auth/better-auth/issues/9190

Is this suited for github?

  • Yes, this is suited for github

Is your feature request related to a problem? Please describe.

Better Auth currently lacks a built-in authorization layer beyond basic session authentication. Teams building enterprise applications need fine-grained, policy-based access control — the ability to define who can do what on which resources, with support for temporary credentials, identity federation, audit trails, and attribute-based rules. Without this, developers either roll their own authorization logic (error-prone and inconsistent) or integrate a separate external system (added operational complexity and latency).

Describe the solution you'd like

A first-party @better-auth/iam plugin that brings an AWS IAM-style authorization model to Better Auth. Specifically:

Policy engine — JSON policy documents with Allow/Deny effects, 26 condition operators, wildcard matching on actions and ARN-based resources, policy variable substitution, and multi-layer evaluation (explicit deny > permission boundaries > session policies > identity policies)
Principals — Full lifecycle management for IAM users, groups, roles, service accounts, and long-term access keys
Security Token Service (STS) — Temporary credential issuance, role assumption with trust policies, chained role assumption with transitive session tags, and HMAC-SHA256 request signing/verification
Identity federation — OIDC (JWT validation against JWKS) and SAML assertion parsing, with configurable claim-to-session-tag mapping and trust policy evaluation for assumeRoleWithWebIdentity
ABAC — Tag principals and resources, then reference iam:PrincipalTag/, iam:ResourceTag/, and iam:RequestTag/ in policy conditions for attribute-based decisions
MFA enforcement — Configurable list of protected actions that require recent multi-factor authentication, exposed as iam:MultiFactorAuthPresent and iam:MultiFactorAuthAge condition keys
Audit logging — Immutable event trail for all IAM operations with sensitive field redaction, configurable retention, external event streaming, credential reports, and access reports
Security analysis — Access analyzer (detect public/overly-permissive policies), policy validator (structural correctness + best-practice warnings), unused access detection (cross-reference grants against audit logs)
61 API endpoints across 12 route groups (policy, user, group, role, access key, service account, STS, federation, tags, audit, analysis, account settings)
15 database tables extending the core user/session models with IAM-specific schemas
Client plugin with typed route mappings for all endpoints

Describe alternatives you've considered

Casbin / CASL / Cerbos — General-purpose authorization libraries. They handle policy evaluation but don't integrate with Better Auth's session model, don't provide STS-style temporary credentials, and require separate setup for federation, audit, and principal management. A native plugin avoids the glue code and delivers a unified experience.
Manual RBAC middleware — Simple role checks on routes. This breaks down quickly when you need resource-level permissions, conditions (time-of-day, IP, tags), or cross-account role assumption. A policy engine scales to these cases without rewriting middleware.
External IAM service (AWS IAM / Keycloak / Ory) — Full-featured but introduces network latency on every authorization decision, requires separate infrastructure, and doesn't share Better Auth's database or session model. An embedded plugin keeps authorization co-located with authentication for simpler deployments.

Additional context

My Company has Already built a IAM system for Better-Auth we're looking to make it an official feature

Originally created by @seanfilimon on GitHub (Apr 14, 2026). Original GitHub issue: https://github.com/better-auth/better-auth/issues/9190 ### Is this suited for github? - [ ] Yes, this is suited for github ### Is your feature request related to a problem? Please describe. Better Auth currently lacks a built-in authorization layer beyond basic session authentication. Teams building enterprise applications need fine-grained, policy-based access control — the ability to define who can do what on which resources, with support for temporary credentials, identity federation, audit trails, and attribute-based rules. Without this, developers either roll their own authorization logic (error-prone and inconsistent) or integrate a separate external system (added operational complexity and latency). ### Describe the solution you'd like A first-party @better-auth/iam plugin that brings an AWS IAM-style authorization model to Better Auth. Specifically: Policy engine — JSON policy documents with Allow/Deny effects, 26 condition operators, wildcard matching on actions and ARN-based resources, policy variable substitution, and multi-layer evaluation (explicit deny > permission boundaries > session policies > identity policies) Principals — Full lifecycle management for IAM users, groups, roles, service accounts, and long-term access keys Security Token Service (STS) — Temporary credential issuance, role assumption with trust policies, chained role assumption with transitive session tags, and HMAC-SHA256 request signing/verification Identity federation — OIDC (JWT validation against JWKS) and SAML assertion parsing, with configurable claim-to-session-tag mapping and trust policy evaluation for assumeRoleWithWebIdentity ABAC — Tag principals and resources, then reference iam:PrincipalTag/, iam:ResourceTag/, and iam:RequestTag/ in policy conditions for attribute-based decisions MFA enforcement — Configurable list of protected actions that require recent multi-factor authentication, exposed as iam:MultiFactorAuthPresent and iam:MultiFactorAuthAge condition keys Audit logging — Immutable event trail for all IAM operations with sensitive field redaction, configurable retention, external event streaming, credential reports, and access reports Security analysis — Access analyzer (detect public/overly-permissive policies), policy validator (structural correctness + best-practice warnings), unused access detection (cross-reference grants against audit logs) 61 API endpoints across 12 route groups (policy, user, group, role, access key, service account, STS, federation, tags, audit, analysis, account settings) 15 database tables extending the core user/session models with IAM-specific schemas Client plugin with typed route mappings for all endpoints ### Describe alternatives you've considered Casbin / CASL / Cerbos — General-purpose authorization libraries. They handle policy evaluation but don't integrate with Better Auth's session model, don't provide STS-style temporary credentials, and require separate setup for federation, audit, and principal management. A native plugin avoids the glue code and delivers a unified experience. Manual RBAC middleware — Simple role checks on routes. This breaks down quickly when you need resource-level permissions, conditions (time-of-day, IP, tags), or cross-account role assumption. A policy engine scales to these cases without rewriting middleware. External IAM service (AWS IAM / Keycloak / Ory) — Full-featured but introduces network latency on every authorization decision, requires separate infrastructure, and doesn't share Better Auth's database or session model. An embedded plugin keeps authorization co-located with authentication for simpler deployments. ### Additional context My Company has Already built a IAM system for Better-Auth we're looking to make it an official feature
GiteaMirror added the enhancement label 2026-04-17 20:03:26 -05:00
Author
Owner

@joshwyant commented on GitHub (Apr 14, 2026):

would be an interesting feature

<!-- gh-comment-id:4246193119 --> @joshwyant commented on GitHub (Apr 14, 2026): would be an interesting feature
Author
Owner

@Smoke3785 commented on GitHub (Apr 15, 2026):

Are you offering to share your implementation of this feature to be folded into the main codebase, or just requesting it be added?

<!-- gh-comment-id:4253532299 --> @Smoke3785 commented on GitHub (Apr 15, 2026): Are you offering to share your implementation of this feature to be folded into the main codebase, or just requesting it be added?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#28629