-
-
Notifications
You must be signed in to change notification settings - Fork 55
(#99) Implemented basic authentication and HttpClient decorator to inject authentication header #110
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
Conversation
…ator to inject authentication header
Job #110 is now in scope, role is |
Pull Request Test Coverage Report for Build 193
💛 - Coveralls |
@amihaiemil FYI, coverage drops due to all those unused |
This pull request #110 is assigned to @amihaiemil/z, here is why; the budget is 15 minutes, see §4; please, read §27 and when you decide to accept the changes, inform @amihaiemil/z (the architect) right in this ticket; if you decide that this PR should not be accepted ever, also inform the architect; this blog post will help you understand what is expected from a code reviewer |
Manual assignment of issues is discouraged, see §19: -5 point(s) just awarded to @amihaiemil/z |
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.
@llorllale Really nice, I like it. Just a few questions. And let me know how much you worked (was it really 30min?) so I can boost the task :)
/** | ||
* The base64-encoded JSON structure holding the credentials. | ||
*/ | ||
private final Supplier<String> encoded; |
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.
@llorllale Why did you make this a Supplier
? As it is now, it doesn't make much sense. Maybe you wanted to add another ctor and let the clients specify a Supplier
?
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.
@amihaiemil just wanted to coalesce all those parameters into one single instance attribute
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.
@llorllale I see, ok
/** | ||
* An http client that does nothing. | ||
*/ | ||
private static class NoOpHttpClient implements HttpClient { |
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.
@llorllale Do we need this class? Can't we just use Mockito.mock(HttpClient.class)
?
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.
@amihaiemil we can use Mockito, yes, although I don't like it because the mocking introduces too much noise in tests. Do you want mockito?
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.
@llorllale Well, yes, if the mock is not supposed to do anything, I would rather use Mockito. I understand that mocks can get really complex, but it's not the case here.
* @version $Id$ | ||
* @see <a href="https://docs.docker.com/engine/api/v1.35/#section/Authentication">Authentication</a> | ||
* @since 0.0.1 | ||
* @todo #99:30min Implement a new auth named 'Token' that will hold the user's |
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.
@llorllale Why do we need the Token
implementation and how would it be used?
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.
@amihaiemil the token would be for the identity token alternative described here
@amihaiemil unfortunately I lost track of time because I kept getting interrupted |
@llorllale I see. Just use mockito for that NoOp client and we're good here. Do you think 90min are ok? You don't have even a rough idea how much did this take? |
@amihaiemil definitely not 90min. Let's agree on 45min. |
@amihaiemil/z this job was assigned to you 5days ago. It will be taken away from you soon, unless you close it, see §8. Read this and this, please. |
@llorllale Can you use mockito instead of that |
…ator to inject authentication header As per PR review: * AuthHttpClientTestCase: now mocking HttpClient by using Mockito
@amihaiemil please check now |
@llorllale looks ok, thanks :) |
@rultor merge it |
@amihaiemil OK, I'll try to merge now. You can check the progress of the merge here |
@0crat extra 90min @llorllale |
@amihaiemil Done! FYI, the full log is here (took me 3min) |
@amihaiemil The user @llorllale/z works for free in this project, see §49 |
@llorllale Can you open an Issue in |
Order was finished: +15 point(s) just awarded to @amihaiemil/z |
The job #110 is now out of scope |
@amihaiemil according to this, the command is Or maybe you should try boost? |
@llorllale I think boost is used for tasks which are assigned and in scope. This one is out of scope already. |
@0crat pay 90min @llorllale |
@amihaiemil The user @llorllale/z works for free in this project, see §49 |
This PR:
Auth
interface. TheCredentials
implementation is for basic user credentialsAuthHttpClient
to decorate other http clients by automatically injecting the required auth header in requests