-
Notifications
You must be signed in to change notification settings - Fork 5
Add new dependencies and enhance OAuth authorization flow with PKCE s… #91
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
base: develop
Are you sure you want to change the base?
Conversation
| let login = "http://localhost:3001/auth/sign-in" | ||
| .parse() | ||
| .expect("cannot find login url"); | ||
|
|
||
| AppResponse::builder() | ||
| .body(OAuthAuthorizeResponse) | ||
| .headers(OAuthAuthorizeResponseHeaders { | ||
| redirect_url: login, | ||
| }) | ||
| .status_code(StatusCode::FOUND) | ||
| .build() | ||
| .into_result() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Assume the user is logged in. If the user is not logged in, throw an error. This request will be sent by the frontend. So the frontend will be responsible for taking care of login and what not
|
|
||
| pub fn decode_token(token: &str, secret: &str) -> Result<AuthClaims, jsonwebtoken::errors::Error> { | ||
| info!("Decoding token: {}", token); | ||
| match decode::<AuthClaims>( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd like to manually take care of exp.
| axum-typed-websockets = { workspace = true, features = ["default"] } | ||
| base32 = { workspace = true, features = [] } | ||
| base64 = { workspace = true, features = ["default"] } | ||
| chrono = { workspace = true, features = ["default", "serde"] } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No chrono. Use the time crate instead
| pub client_id: String, | ||
| /// The redirect URI of the third-party app | ||
| #[serde(default, skip_serializing_if = "Option::is_none")] | ||
| #[serde(default, skip_serializing_if = "Option::is_none", rename = "redirect_uri")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're renaming to the same name?
| pub scope: String, | ||
| /// The state of the request, if any | ||
| pub state: Option<String>, | ||
| #[serde(rename = "code_challenge")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here
| #[serde(rename = "code_challenge")] | ||
| /// The hashed value of a code challenge (as per PKCE) | ||
| pub code_challenge: String, | ||
| #[serde(rename = "code_challenge_method")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here too
No description provided.