Add AuthkestraIntegration derive macro for simplified state integration#3
Open
onelrian wants to merge 2 commits intomarcjazz:mainfrom
Open
Add AuthkestraIntegration derive macro for simplified state integration#3onelrian wants to merge 2 commits intomarcjazz:mainfrom
onelrian wants to merge 2 commits intomarcjazz:mainfrom
Conversation
marcjazz
requested changes
Feb 14, 2026
Owner
There was a problem hiding this comment.
- Rename the new crate from
authkestra-axum-macrostoauthkestra-macros: This will help support other integrations macros in the features. - Add the renamed
authkestra-macroswithaxumfeature to theauthkestra-axumcargo.toml. Make it available by default. - Rename
AuthkestraIntegrationtoAuthkestraFromRef
authkestra-axum/src/lib.rs
Outdated
Comment on lines
19
to
58
Owner
There was a problem hiding this comment.
This code is now irrelevant and should be deleted.
Author
There was a problem hiding this comment.
The AuthkestraState struct and its FromRef implementations serve a different purpose than the new AuthkestraFromRef macro:
AuthkestraState: Simple wrapper for users who only need Authkestra with no custom state fieldsAuthkestraFromRefmacro: For custom state structs with additional fields (e.g., db_pool, custom services)
They're complementary patterns, not replacements. Removing AuthkestraState would:
- Break 3 existing examples (
axum_oauth.rs,oidc_generic.rs,axum_spa_jwt.rs) - Force all users to use the macro even for simple cases
- Be a breaking change
So , should I still delete it ?
Owner
There was a problem hiding this comment.
Use the macros crate to implement the AuthkestraState internal and existing example shall remain untouched.
marcjazz
requested changes
Feb 16, 2026
authkestra-axum/src/lib.rs
Outdated
Comment on lines
19
to
58
Owner
There was a problem hiding this comment.
Use the macros crate to implement the AuthkestraState internal and existing example shall remain untouched.
Author
|
Fixed the requested changes:
|
c28ed75 to
67d25fa
Compare
67d25fa to
94dae9f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Introduces
#[derive(AuthkestraIntegration)]macro to eliminateFromRefboilerplate when integrating Authkestra with custom Axum application state.Problem
Integrating Authkestra with custom Axum
AppStatecurrently requires implementing 4 manualFromReftraits, creating approximately 30 lines of boilerplate code per integration.Solution
Created
authkestra-axum-macroscrate providing a derive macro that automatically generates all requiredFromRefimplementations.Before
After
Changes
authkestra-axum-macrosproc-macro crateAuthkestraIntegrationderive macro with compile-time validationmacrosfeature toauthkestra-axumaxum_credentialsexample demonstrating simplified integrationImpact
AuthkestraStateusageTesting
Closes #2