-
Notifications
You must be signed in to change notification settings - Fork 1
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
Fix/device login #344
Fix/device login #344
Conversation
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.
Looks good!
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.
Looks reasonable, some comments and questions though.
Codecov ReportAll modified and coverable lines are covered by tests ✅
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## main #344 +/- ##
=======================================
Coverage 52.66% 52.66%
=======================================
Files 9 9
Lines 1183 1183
=======================================
Hits 623 623
Misses 481 481
Partials 79 79
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
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.
It works great when I tested locally with the instructions provided!
I have one minor comment though
When the URL has a trailing character /
, which may happen when a user copies the URL from the address bar, the error message reported is not meaningful. For example,
running the command
./sda-cli login https://login.test.bp.nbis.se/
will return
Error: invalid character 'N' looking for beginning of value
One can either sanitize the trailing /
from the URL or provide a more understandable error message.
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.
Looks good!
I left one minor question/comment. Also, I needed to run go mod tidy
before being able to run go build
.
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 agree with Malin's comment. Easier to debug when one is logging their own error messages as well
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.
(see comments, but I don't object to merging.)
119ea2f
fixed |
- so that we get the error msg from server
86db45b
to
e7a1214
Compare
Apparently |
f5cfa55
to
e064f4d
Compare
- also rename url var to something more informative
Related issue(s) and PR(s)
This PR closes #329.
Description
The reason why
sda-cli login
didnot seem to work is because it tried to connect to a/token
that was behind a basic authentication method.As a public app,
sda-cli
cannot leverage traditional methods to authenticate to the/token
endpoint of LS-AAI.To mitigate this issue, this PR adds to the device flow a PKCE flow so that the
sda-cli
can connect securely to LS-AAI token endpoints that do not require authentication through sending secrets.Additionally, a
mock-oidc
server configured for device-flow andsda-auth
configured only for serving the/info
endpoint are added to the docker-compose.yml of the local dev environment for local testing. These additions can be the starting point for work inAdd tests for cases when
sda-cli
calls the /info endpoint ofsda-auth
#314and
Add tests for login module #252.
along the way go was updated to 1.21 (crypt4gh v1.8.11 required this)
How to test
Configure an OIDC service with device flow enabled, token_authentication_method=none and PKCE enabled with method=S256.
OR locally:
under
/testing
folder run:and from another terminal:
and after the login succeeds
ls .sda-cli-session
.