-
-
Notifications
You must be signed in to change notification settings - Fork 116
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
Move authentication middleware to new scope #14
Conversation
} | ||
|
||
fn readiness_path() -> String { | ||
format!("{}/readiness", base_path()) | ||
"/readiness".to_string() |
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.
How will it get the base path?
} | ||
|
||
fn liveness_path() -> String { | ||
format!("{}/liveness", base_path()) | ||
"/liveness".to_string() |
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 as above
} | ||
|
||
fn query_path() -> String { | ||
format!("{}/query", base_path()) | ||
"/query".to_string() |
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 as above
.service(ResourceFiles::new("/", generated)); | ||
cfg.service( | ||
// Base path "{url}/api/v1" | ||
web::scope(&base_path()) |
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.
@nitisht base path is used inside this web::scope thus every path grouped underneath it will share same base url i.e /api/v1. I changed the related functions to not return full path.
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.
ah okay..we need to test all the APIs then, just to make sure nothing is broken
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.
Yep
Looking forward to it... Good Job |
Description
BasicAuth middleware was wrapped around entire application causing people to authenticate twice.
This PR fixes this by moving all endpoints under base path to a new scope then wrapping it in the BasicAuth middleware
Now the static files served under root path do not require authentication.