8000 Draft: Support Axum 0.8 by danielblignaut · Pull Request #3603 · kanidm/kanidm · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Draft: Support Axum 0.8 #3603

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Draft: Support Axum 0.8 #3603

wants to merge 4 commits into from

Conversation

danielblignaut
Copy link

Change summary

This adds support for Axum 0.8. Main changes are:

  • bumping otel packages (which have dependency on Tonic -> which has a dependency on Axum) to support Axum 0.8. There are some breaking API changes adjusted
  • Bumping the Aksama packages which have some breaking changes to their API, most notable, dropped support for IntoResponse trait for Axum and instead the introduction of the WebTemplate derive macro
  • Bump Utoipa package to support Axum 0.8 and fix minor issues
  • Update path variable references from ":variable_name" to "{variable_name}" which creates noise

Fixes #

Checklist

  • [] This PR contains no AI generated code
  • book chapter included (if relevant)
  • design document included (if relevant)

@Firstyear
Copy link
Member

@yaleman Given I'm busy can you have an initial review of this, and I'll take a look in a few days as well?

Copy link
Member
@yaleman yaleman left a comment

Choose a reason for hiding this comment

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

This is looking awesome so far, thanks for taking the time to do this upgrade 🥳

I've got a patch here for the tracer shutdown - yaleman@2c0fbf7

Actually trying to run the server stack overflows on startup for me because it wa hitting juhaku/utoipa#1226 - as it works OK if I comment out the swagger UI route here: https://github.com/yaleman/kanidm/blob/2c0fbf7f5dc7690ed1d9880ad3889915513e0a9e/server/core/src/https/apidocs/mod.rs#L329-L333

Currently fiddling with that...

#[utoipa::path(
get,
path = "/v1/jwk/{key_id}",
responses(
(status=200, body=Jwk, content_type="application/json"),
(status=200, body=JwkResponse, content_type="application/json"),
Copy link
Member

Choose a reason for hiding this comment

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

Can we please change the import and use this pattern instead? Just from a code clarity perspective.

Suggested change
(status=200, body=JwkResponse, content_type="application/json"),
(status=200, body=response_schema::Jwk, content_type="application/json"),

) -> axum::response::Result<Response> {
let cu_session_token: CUSessionToken = get_cu_session(&jar).await?;
let swapped_handler_trigger =
HxResponseTrigger::after_swap([HxEvent::new("addPasswordSwapped".to_string())]);

let new_passwords = match opt_form {
None => {
Err(_) => {
Copy link
Member

Choose a reason for hiding this comment

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

Need to add something here to display the message or at least log the issue, rather than just silently ignore it. (or a // TODO: log/handle errors)

) -> axum::response::Result<Response> {
let cu_session_token: CUSessionToken = get_cu_session(&jar).await?;
let swapped_handler_trigger =
HxResponseTrigger::after_swap([HxEvent::new("addPasswordSwapped".to_string())]);

let new_passwords = match opt_form {
None => {
Err(_) => {
Copy link
Member

Choose a reason for hiding this comment

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

Need to add something here to display the message or at least log the issue, rather than just silently ignore it. (or a // TODO: log/handle errors)

let cu_session_token: CUSessionToken = get_cu_session(&jar).await?;

let new_key = match opt_form {
None => {
Err(_e) => {
Copy link
Member

Choose a reason for hiding this comment

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

Need to add something here to display the message or at least log the issue, rather than just silently ignore it. (or a // TODO: log/handle errors)

@@ -14,7 +14,8 @@

<hr>

(% if scim_effective_access.search.check(Attribute::Mail|as_ref) %)
<!-- TODO: issues with as_ref -->
Copy link
Member

Choose a reason for hiding this comment

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

Please use Askama comments so we don't shame ourselves too publicly 🤣

Suggested change
<!-- TODO: issues with as_ref -->
{# TODO: issues with as_ref #}

@@ -33,7 +34,8 @@
</form>
(% endif %)

(% if scim_effective_access.search.check(Attribute::DirectMemberOf|as_ref) %)
<!-- TODO: issues with as_ref -->
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
<!-- TODO: issues with as_ref -->
{# TODO: issues with as_ref #}

Copy link
Member

Choose a reason for hiding this comment

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

For what it's worth I hate having logic in the template here, can you move the scim_effective_access.search.check( out into the rust code please, or add a TODO to do so?

@github-project-automation github-project-automation bot moved this from 🆕 New to 📋 Backlog in Organising Everything May 16, 2025
@yaleman
Copy link
Member
yaleman commented May 16, 2025

Aha! Found it. yaleman@d5fbff7 fixes the recursion issue/crasher.

@yaleman
Copy link
Member
yaleman commented May 16, 2025

I've PR'd the changes into your branch here: humandi#1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 📋 Backlog
Development

Successfully merging this pull request may close these issues.

3 participants
0