This repository has been archived by the owner on Apr 14, 2021. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow Basic Auth by a username with no password
- Loading branch information
Showing
2 changed files
with
15 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
b4b5149
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.
can't we have the reverse case here as well? only password, no login.
b4b5149
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 don't think it's possible to specify that via the Basic Auth mechanism. If the authentication information has no colon like
https://username@...
, then the password is set tonil
. However, if you try to enter just the password withhttps://:password@...
, just having the leading colon makes the username be blank, notnil
. I think the same applies when the credentials are encoded in the Authorization header. Is there a particular user-case you're thinking of or am I mistaking on this?b4b5149
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.
at work we often do the latter, but wasn't sure if that set uri.user to
nil
or""
. I just wanted to make sure that case worked here.b4b5149
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 just checked and Ruby doesn't allow you to build a URI with a
nil
usernameb4b5149
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.
thanks for looking into this! ❤️ ❤️