Skip to content

Extract auth into Authable base class - #333

Merged
techmahedy merged 4 commits into
doppar:4.xfrom
sanzgrapher:332-authenticatable-contract
Sep 24, 2026
Merged

techmahedy merged 4 commits into
doppar:4.xfrom
sanzgrapher:332-authenticatable-contract

Conversation

@sanzgrapher

@sanzgrapher sanzgrapher commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor
  • Add Phaseolies\Auth\Authable base class extending Model, with auth helpers (key name, identifier, password, remember token, two-factor)
  • Remove getAuthKeyName() from generic Model
  • Type Auth facade + Authenticate as Authable; Auth uses those helpers instead of raw auth attributes
  • getModel() requires an Authable subclass; per-actor model check kept for multi-actor
  • BREAKING: auth models must extend Authable

Closes #332

@techmahedy

techmahedy commented Sep 24, 2026 •

Copy link
Copy Markdown
Member

@sanzgrapher please change the contract name Authenticatable to Authable or any name that is relevant in this context but not Authenticatable please.

@sanzgrapher sanzgrapher changed the title Add Authenticatable contract for auth models Add Authable contract for auth models Sep 24, 2026
sanzgrapher pushed a commit to sanzgrapher/doppar that referenced this pull request Sep 24, 2026
@techmahedy

Copy link
Copy Markdown
Member

@sanzgrapher done from your end?

@techmahedy
techmahedy requested a review from rrr63 September 24, 2026 10:42

@xentixar xentixar left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sanzgrapher hey, looked at the PR. the Authable typing on Auth is good, but we want to push it a bit further.

right now Authable is just an interface and getAuthKeyName() still lives on Model. since Model is generic, auth stuff shouldn’t be there. can you make Authable a base class that extends Model, move the auth methods onto it (getAuthKeyName and the other auth helpers Auth actually uses), and have app models like User extend that instead of implementing a contract?

@techmahedy

Copy link
Copy Markdown
Member

@xentixar

@sanzgrapher hey, looked at the PR. the Authable typing on Auth is good, but we want to push it a bit further.

right now Authable is just an interface and getAuthKeyName() still lives on Model. since Model is generic, auth stuff shouldn’t be there. can you make Authable a base class that extends Model, move the auth methods onto it (getAuthKeyName and the other auth helpers Auth actually uses), and have app models like User extend that instead of implementing a contract?

You are right

Expand contract with Model-backed props/methods and rewrite Auth
@method tags so analysis accepts multi-actor auth models.
Avoid Laravel-homonym; Authable is the Doppar auth-model contract.
Auth models must extend Authable; move auth helpers off Model and drop the dead PHP <7.3 CookieJar path.
@sanzgrapher
sanzgrapher force-pushed the 332-authenticatable-contract branch from b36c66b to 282eac2 Compare September 24, 2026 14:09
sanzgrapher added a commit to sanzgrapher/doppar that referenced this pull request Sep 24, 2026
Companion to doppar/framework#333. User implements the contract;
auth.php docs note multi-actor models must as well.
sanzgrapher added a commit to sanzgrapher/doppar that referenced this pull request Sep 24, 2026

@techmahedy techmahedy left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good now

@sanzgrapher sanzgrapher changed the title Add Authable contract for auth models Extract auth into Authable base class Sep 24, 2026
@techmahedy
techmahedy merged commit f483b0f into doppar:4.x Sep 24, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Extract auth concerns from Model into an Authable base class

3 participants