Skip to content

Comments

Convert auth accessors to configuration object#3418

Merged
tvdeyen merged 3 commits intoAlchemyCMS:mainfrom
mamhoff:auth-configuration
Jan 27, 2026
Merged

Convert auth accessors to configuration object#3418
tvdeyen merged 3 commits intoAlchemyCMS:mainfrom
mamhoff:auth-configuration

Conversation

@mamhoff
Copy link
Contributor

@mamhoff mamhoff commented Oct 11, 2025

What is this pull request for?

This converts the auth_accessors.rb module, which is purely configuration, to a configuration object.

All methods are still there, but deprecated, and a few accessors stay in lib/alchemy.rb as shortcuts.

Notable changes (remove if none)

We can now configure Alchemy's auth system entirely outside of a config.to_prepare block.

Checklist

  • I have followed Pull Request guidelines
  • I have added a detailed description into each commit message
  • I have added tests to cover this change

@mamhoff mamhoff requested a review from a team as a code owner October 11, 2025 09:22
@mamhoff mamhoff force-pushed the auth-configuration branch 3 times, most recently from d5c9603 to 954e985 Compare October 11, 2025 09:56
@codecov
Copy link

codecov bot commented Oct 11, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.46%. Comparing base (192921b) to head (afb581f).
⚠️ Report is 4 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3418      +/-   ##
==========================================
+ Coverage   97.44%   97.46%   +0.01%     
==========================================
  Files         314      314              
  Lines        8194     8218      +24     
==========================================
+ Hits         7985     8010      +25     
+ Misses        209      208       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@tvdeyen tvdeyen force-pushed the auth-configuration branch from 954e985 to 8645785 Compare October 11, 2025 11:42
@mamhoff mamhoff force-pushed the auth-configuration branch 2 times, most recently from c6d73b9 to 74d6166 Compare October 15, 2025 12:03
@mamhoff
Copy link
Contributor Author

mamhoff commented Oct 15, 2025

Rebased on #3424 in order to get the raw_user_class reader.

@mamhoff mamhoff force-pushed the auth-configuration branch from 74d6166 to a85e1b4 Compare October 15, 2025 12:10
@mamhoff mamhoff force-pushed the auth-configuration branch 2 times, most recently from e1adfda to 43681c3 Compare October 16, 2025 12:41
@github-actions
Copy link

This pull request has not seen any activiy in a long time.
Probably because of missing tests or a necessary rebase.
This PR will be closed in 7 days if no further activity happens.

@github-actions github-actions bot added the Stale label Dec 16, 2025
@tvdeyen tvdeyen added this to the 8.1 milestone Dec 23, 2025
@tvdeyen
Copy link
Member

tvdeyen commented Dec 23, 2025

@mamhoff this needs a rebase and conflict resolution.

@github-actions github-actions bot removed the Stale label Dec 24, 2025
@mamhoff mamhoff force-pushed the auth-configuration branch 2 times, most recently from d13264a to 20a4bdb Compare December 28, 2025 17:20
Copy link
Member

@tvdeyen tvdeyen left a comment

Choose a reason for hiding this comment

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

Thanks for rebasing. I think we should get rid of the extra auth class. It is unnecessary imo.

@mamhoff mamhoff force-pushed the auth-configuration branch 4 times, most recently from e80ebb2 to 1b0afb4 Compare January 2, 2026 13:16
If `Alchemy.user_class` is `nil`, which it is in case of an invalid
configuration, it's not a class, and we can't use the `<` operator.
Let's use duck typing instead.
This allows us to do

```
Alchemy.configure do |config|
  config.user_class = "Spree::User"
end
```
@mamhoff mamhoff force-pushed the auth-configuration branch from 1b0afb4 to 1ff562b Compare January 27, 2026 11:25
Creates a configuration object for authentication that can be
initialized outside of a `config.to_prepare` block.

Configuration is now in `Alchemy.config`.
@mamhoff mamhoff force-pushed the auth-configuration branch from 1ff562b to afb581f Compare January 27, 2026 11:27
Copy link
Member

@tvdeyen tvdeyen left a comment

Choose a reason for hiding this comment

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

Amazing work. Would be great to update the alchemy.rb.tt install file to the new configurations.

@tvdeyen tvdeyen merged commit bddb4cd into AlchemyCMS:main Jan 27, 2026
22 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.

2 participants