-
Notifications
You must be signed in to change notification settings - Fork 22
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
Apply the changed requirement for the Admin endpoints #3294
Conversation
Codecov Report
@@ Coverage Diff @@
## v0.x.x #3294 +/- ##
==========================================
+ Coverage 87.83% 88.84% +1.00%
==========================================
Files 164 165 +1
Lines 16964 17081 +117
==========================================
+ Hits 14901 15176 +275
+ Misses 2063 1905 -158
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
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.
If I understand correctly, the login page is only used to give the user feedback if the credentials are incorrect, otherwise it will store those credentials in the session to use in the AUTH header to pass for other endpoints.
source/agora/api/Admin.d
Outdated
|
||
Log in to the admin server | ||
|
||
This is dummy endpoint for checking the username and password in |
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.
This is dummy endpoint for checking the username and password in | |
This is endpoint used only for checking the username and password in |
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.
Updated
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.
Updated in next commit btw
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, I will update, Thanks.
// GET: /login | ||
public override void login () | ||
{ | ||
} |
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 we should use the AUTH header to find out if user id and password are correct.
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.
We use AUTH header for all the requests. So I introduced the dummy endpoint. It will return an HTTP Status Code(200 or 401). But, I will find a more reasonable way to handle as you mean and the requirement is described.
bool checkPassword (string user, string password) @safe
{
return user == config.admin.username && password == config.admin.pwd;
}
auto adminrouter = new URLRouter();
adminrouter.any("*", performBasicAuth("Agora Admin", &checkPassword));
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.
After thinking more about this we should probably return a JWT which can be used on the subsequent requests to the other endpoints. But for now I think what you have is ok to proceed.
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.
LGTM
Added the new
login
endpoint and changed the name and return value for the existingvalidator
andencriptionkey
endpoints.Relates #3280