Skip to content
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

feat: Support to ory hydra running in secure mode #62

Merged
merged 29 commits into from
May 10, 2021

Conversation

fjvierap
Copy link
Contributor

We have a hydra instance running in https and we cannot use hydra-maester to communicate with our hydra instance. Hence we created this extension which allows:

  • skip insecure verification in http client by adding insecure-skip-verify argument.
  • Use github.com/go-openapi/runtime/clienttls client when a certificate loaded as tls-trust-store argument.

@CLAassistant
Copy link

CLAassistant commented Dec 18, 2020

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
2 out of 3 committers have signed the CLA.

✅ fjvierap
✅ colunira
❌ ORY Continuous Integration


ORY Continuous Integration seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

@fjvierap fjvierap changed the title Support to ory hydra running in secure mode feat: Support to ory hydra running in secure mode Dec 18, 2020
@aeneasr
Copy link
Member

aeneasr commented Apr 23, 2021

Closing due to inactivity

@aeneasr aeneasr closed this Apr 23, 2021
@fjvierap
Copy link
Contributor Author

fjvierap commented Apr 23, 2021

@aeneasr for curiosity why is this closed?
It was just pending to review I think... Or is there some question not resolved or the code does not look good and I missed?

@aeneasr
Copy link
Member

aeneasr commented Apr 23, 2021

sorry my bad

@aeneasr aeneasr reopened this Apr 23, 2021
@aeneasr aeneasr self-assigned this Apr 23, 2021
@aeneasr aeneasr added the feat New feature or request. label Apr 23, 2021
@fjvierap
Copy link
Contributor Author

sorry my bad

No problem ;)

main.go Outdated Show resolved Hide resolved
main.go Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
@fjvierap
Copy link
Contributor Author

@Demonsthere I updated PR based on your comments.

@Demonsthere
Copy link
Collaborator

Hi there @fjvierap thanks for the update! I will check as soon as able :)

@Demonsthere
Copy link
Collaborator

It's looking great 👍 The only improvement I can think of is a small test maybe here to create a client with and without trustStore.

@aeneasr
Copy link
Member

aeneasr commented May 4, 2021

@Demonsthere should I wait for #62 (comment) ?

@Demonsthere
Copy link
Collaborator

TBH I'm conflicted here. After some evaluation I see that we do not have any test that verifies if the hydraClient is created correctly, which should be addressed. However, fixing that seems outside of the scope of this PR. Maybe we should accept this PR as is, and define a task with adding the missing tests?

@aeneasr
Copy link
Member

aeneasr commented May 4, 2021

According to our contribution guidelines, if it is required for you to verify that the change is doing what it is supposed to do, then asking for a test as a requirement for merging the PR is in scope :)

@fjvierap
Copy link
Contributor Author

fjvierap commented May 4, 2021

TBH I'm conflicted here. After some evaluation I see that we do not have any test that verifies if the hydraClient is created correctly, which should be addressed. However, fixing that seems outside of the scope of this PR. Maybe we should accept this PR as is, and define a task with adding the missing tests?

For that we will need to move getHydraClientMaker to a separate package... Which package name you suggest to move the function?

@Demonsthere
Copy link
Collaborator

imho, getHydraClientMaker is a wrapper for controllers.HydraClientMakerFunc, and we might even be able to get rid of it. Alternatively i'd say helpers package

@fjvierap
Copy link
Contributor Author

fjvierap commented May 5, 2021

imho, getHydraClientMaker is a wrapper for controllers.HydraClientMakerFunc, and we might even be able to get rid of it. Alternatively i'd say helpers package

Could you please check my last 2 commit and let me know if that is you expect?

Copy link
Collaborator

@Demonsthere Demonsthere left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's looking great! Just a few little improvements ;)

helpers/http_client_test.go Outdated Show resolved Hide resolved
helpers/http_client.go Outdated Show resolved Hide resolved
helpers/http_client_test.go Show resolved Hide resolved
helpers/http_client_test.go Outdated Show resolved Hide resolved
helpers/http_client_test.go Outdated Show resolved Hide resolved
helpers/http_client_test.go Outdated Show resolved Hide resolved
helpers/http_client_test.go Outdated Show resolved Hide resolved
@fjvierap
Copy link
Contributor Author

It's looking great! Just a few little improvements ;)

Hi I added the improvements you suggested ;)

t.Run("should not create client with and wrong tlsTrustStore", func(t *testing.T) {
client, err := helpers.CreateHttpClient(true, "/somefile")
require.NotNil(t, client)
require.NotNil(t, err)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we control what error will be returned here, maybe we could check not only if the err is not nil, but if it the one we expect?

Copy link
Collaborator

@Demonsthere Demonsthere left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just noticed that the new package is not by default included in the makefile target so the tests for it won't run. Could you please add it there? Then we will see if the test are correct :)

Copy link
Collaborator

@Demonsthere Demonsthere left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM :)

@aeneasr
Copy link
Member

aeneasr commented May 10, 2021

Thank you! Could you please rebase/merge with master? Then we can merge it right away!

@aeneasr aeneasr merged commit 0ac5779 into ory:master May 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat New feature or request.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants