Skip to content
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

Add new endpoint to get ssh keys from other user #277

Merged
merged 6 commits into from
Jul 28, 2024
Merged

Conversation

xerbalind
Copy link
Member

When updating your user profile it also validates now.
Also updated the ssh_keys regex to include new key types.

@xerbalind
Copy link
Member Author

xerbalind commented Jun 2, 2024

workflow fails because version of time crate is outdated, we should update the dependencies.

Copy link
Collaborator

@rien rien left a comment

Choose a reason for hiding this comment

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

You can rebase with main now as well

@@ -58,6 +59,24 @@ pub async fn show_user<'r>(
}
}

#[get("/users/keys/<username>")]
Copy link
Collaborator

Choose a reason for hiding this comment

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

This would feel more conform to how a REST API is usually implemented:

Suggested change
#[get("/users/keys/<username>")]
#[get("/users/<username>/keys")]

Copy link
Member Author

Choose a reason for hiding this comment

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

Sadly leads to routing collisions, but fixable with route ranking.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I prefer using ranking to have a cleaner API

@xerbalind xerbalind force-pushed the ssh_keys_endpoint branch from dc4a6ca to cad46a3 Compare June 19, 2024 18:35
@xerbalind xerbalind requested a review from rien June 25, 2024 19:49
@rien
Copy link
Collaborator

rien commented Jun 28, 2024

The ssh keys are currently returned in a JSON. Is this on purpose for a specific goal?

I think it would make more sense to just return them in plain text format as you would find them in an authorized_keys file (separated by newlines).

We could do some content negotiation and tweak the https://github.com/ZeusWPI/zauth/blob/main/src/views/accepter.rs to also allow for responding to txt requests. But that would make it quite complex.

@xerbalind xerbalind merged commit 5187cc2 into main Jul 28, 2024
3 checks passed
@xerbalind xerbalind deleted the ssh_keys_endpoint branch July 28, 2024 16:07
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