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

[Go][Client] Secret key content string in http signing support #8570

Merged
merged 16 commits into from
Feb 4, 2021

Conversation

code-lucidal58
Copy link
Contributor

Fix #8569
Accept privateKey content string along with the current option of privateKey file path

PR checklist

  • Read the contribution guidelines.
  • Pull Request title clearly describes the work in the pull request and Pull Request description provides details about how to validate the work. Missing information here may result in delayed response from the community.
  • Run the following to build the project and update samples:
    ./mvnw clean package 
    ./bin/generate-samples.sh
    ./bin/utils/export_docs_generators.sh
    
    Commit all changed files.
    This is important, as CI jobs will verify all generator outputs of your HEAD commit as it would merge with master.
    These must match the expectations made by your contribution.
    You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example ./bin/generate-samples.sh bin/configs/java*.
    For Windows users, please run the script in Git BASH.
  • File the PR against the correct branch: master, 5.1.x, 6.0.x
  • If your PR is targeting a particular programming language, @mention the technical committee members, so they are more likely to review the pull request.

@antihax (2017/11) @grokify (2018/07) @kemokemo (2018/09) @jirikuncar (2021/01)

@vvb
Copy link
Contributor

vvb commented Jan 29, 2021

vvb and others added 2 commits February 1, 2021 14:03
Co-authored-by: Sebastien Rosset <serosset@cisco.com>
Co-authored-by: Sebastien Rosset <serosset@cisco.com>
@vvb
Copy link
Contributor

vvb commented Feb 1, 2021

Is this good to merge? If so, please merge.

@wing328
Copy link
Member

wing328 commented Feb 2, 2021

Looks like the Go tests (TestInvalidHttpSignatureConfiguration) didn't pass:

--- PASS: TestHttpSignaturePrivateKeys (36.88s)
=== RUN   TestHttpSignatureAuth
Request with HTTP signature. Scheme: 'hs2019'. Algorithm: ''. MaxValidity: 0s. Headers: '[(request-target) (created) Host Date Content-Type Digest]'
REQUEST:
GET /v2/pet/12992 HTTP/1.1
Host: petstore.swagger.io:80
Accept: application/json
Authorization: Signature keyId="my-key-id",algorithm="hs2019",created=1612171314,headers="(request-target) (created) host date content-type digest",signature="cjUWqH4V/cNGMCRGw6x8RQlkJ1YUCkD1wwkIdfr1PlVRJsfvmWOeyPP6z65lkg49nZh+1ayXy2CAPyCEVhAgiVijKGDu+f5eNlpeBd7JoCbN9a9ION0FGQcOidrivqN+4Vf4kFt2t0BxjzEKDr4u4WNS2S7YxsnpPzjcn+G10XU="
Content-Type: application/json
Date: Mon, 01 Feb 2021 09:21:54 GMT
Digest: SHA-512=z4PhNX7vuL3xVChQ1m2AB9Yg5AULVxXcg/SpIdNs6c5H0NE8XYXysP+DGNKHfuwvY7kxvUdBeoGlODJ6+SfaPg==
Testheader: testvalue
User-Agent: OpenAPI-Generator/1.0.0/go


Algorithm: 'hs2019' Headers: '(request-target) (created) host date content-type digest' b64signature: 'cjUWqH4V/cNGMCRGw6x8RQlkJ1YUCkD1wwkIdfr1PlVRJsfvmWOeyPP6z65lkg49nZh+1ayXy2CAPyCEVhAgiVijKGDu+f5eNlpeBd7JoCbN9a9ION0FGQcOidrivqN+4Vf4kFt2t0BxjzEKDr4u4WNS2S7YxsnpPzjcn+G10XU='
Request with HTTP signature. Scheme: 'hs2019'. Algorithm: ''. MaxValidity: 0s. Headers: '[Host Date Garbage-HeaderDoesNotExist]'
Request with HTTP signature. Scheme: 'hs2019'. Algorithm: ''. MaxValidity: 7m0s. Headers: '[]'
Request with HTTP signature. Scheme: 'hs2019'. Algorithm: ''. MaxValidity: 1m0s. Headers: '[(request-target) (created) (expires)]'
REQUEST:
GET /v2/pet/12992 HTTP/1.1
Host: petstore.swagger.io:80
Accept: application/json
Authorization: Signature keyId="my-key-id",algorithm="hs2019",created=1612171314,expires=1612171374.643,headers="(request-target) (created) (expires)",signature="eH1W4OHR/RFBaweN2Bqyttox8Mjy0oYRncpJcO8YdsQXrbQmd7XRmOWLgpYTc4DeUAjlXRRXulqgJZNga3QqqWc47fDz/ogytQVjxfFU7xzdnO2qwWsew/1xvy1hZToJh8mT4i0o6JgXhiNgz1Re5X6U5DEMMIKbKRfM5RWIXSo="
Content-Type: application/json
Testheader: testvalue
User-Agent: OpenAPI-Generator/1.0.0/go


Algorithm: 'hs2019' Headers: '(request-target) (created) (expires)' b64signature: 'eH1W4OHR/RFBaweN2Bqyttox8Mjy0oYRncpJcO8YdsQXrbQmd7XRmOWLgpYTc4DeUAjlXRRXulqgJZNga3QqqWc47fDz/ogytQVjxfFU7xzdnO2qwWsew/1xvy1hZToJh8mT4i0o6JgXhiNgz1Re5X6U5DEMMIKbKRfM5RWIXSo='
Request with HTTP signature. Scheme: 'hs2019'. Algorithm: ''. MaxValidity: 0s. Headers: '[(request-target) (created) (expires)]'
Request with HTTP signature. Scheme: 'hs2019'. Algorithm: ''. MaxValidity: 0s. Headers: '[]'
REQUEST:
GET /v2/pet/12992 HTTP/1.1
Host: petstore.swagger.io:80
Accept: application/json
Authorization: Signature keyId="my-key-id",algorithm="hs2019",created=1612171314,headers="(created)",signature="Iidxnr8CR4iXLhvh3tlGuXrcdch2IB87qnpIBe+ZW9IbMhMeQTn/40KeKE74j3eMKiNNkvzFTH8sgqWqurCE8gqyBIGlFvJ5j8frEOnfEuL/kVQ9YWwW99Lx7Hq/WiowIUGh95zTgu5z9zB/L99GT3p0C9NI79wGyPoRi0PF5Zw="
Content-Type: application/json
Testheader: testvalue
User-Agent: OpenAPI-Generator/1.0.0/go


Algorithm: 'hs2019' Headers: '(created)' b64signature: 'Iidxnr8CR4iXLhvh3tlGuXrcdch2IB87qnpIBe+ZW9IbMhMeQTn/40KeKE74j3eMKiNNkvzFTH8sgqWqurCE8gqyBIGlFvJ5j8frEOnfEuL/kVQ9YWwW99Lx7Hq/WiowIUGh95zTgu5z9zB/L99GT3p0C9NI79wGyPoRi0PF5Zw='
Request with HTTP signature. Scheme: 'rsa-sha512'. Algorithm: ''. MaxValidity: 0s. Headers: '[(request-target) (created) Host Date Content-Type Digest]'
REQUEST:
GET /v2/pet/12992 HTTP/1.1
Host: petstore.swagger.io:80
Accept: application/json
Authorization: Signature keyId="my-key-id",algorithm="rsa-sha512",created=1612171314,headers="(request-target) (created) host date content-type digest",signature="R5zKmwh21EldCkG9I8z+aUAwV2Xsbvm8f2aVBFFdq/2w831ruCRJQN3FDWdspai3hZJVq9VHPIUnuLVidEkQUDrKm/kqSRSpUn3K/DWRP8+QWOFVAjzL572kpo6EbJQN9KUj5f+2Z5+MTVU8CTU1PWbbMIB6wN19LVKs/pKbeQE="
Content-Type: application/json
Date: Mon, 01 Feb 2021 09:21:54 GMT
Digest: SHA-512=z4PhNX7vuL3xVChQ1m2AB9Yg5AULVxXcg/SpIdNs6c5H0NE8XYXysP+DGNKHfuwvY7kxvUdBeoGlODJ6+SfaPg==
Testheader: testvalue
User-Agent: OpenAPI-Generator/1.0.0/go


Algorithm: 'rsa-sha512' Headers: '(request-target) (created) host date content-type digest' b64signature: 'R5zKmwh21EldCkG9I8z+aUAwV2Xsbvm8f2aVBFFdq/2w831ruCRJQN3FDWdspai3hZJVq9VHPIUnuLVidEkQUDrKm/kqSRSpUn3K/DWRP8+QWOFVAjzL572kpo6EbJQN9KUj5f+2Z5+MTVU8CTU1PWbbMIB6wN19LVKs/pKbeQE='
Request with HTTP signature. Scheme: 'rsa-sha256'. Algorithm: ''. MaxValidity: 0s. Headers: '[(request-target) (created) Host Date Content-Type Digest]'
REQUEST:
GET /v2/pet/12992 HTTP/1.1
Host: petstore.swagger.io:80
Accept: application/json
Authorization: Signature keyId="my-key-id",algorithm="rsa-sha256",created=1612171314,headers="(request-target) (created) host date content-type digest",signature="j+V/a4/926UJgIUsnmQIGa+OEBPbeMjWS08Djbod0yGHqyd1APjv+lpCgO3WJHq8aHl+PMtVEMck10c7TdZuM3hgZbJYLviQMpBQRWMDMZuHaLvo+Kx53Y0iOMIl15eYunAOkoqZWcvaL5N4WLUkV/G/Z2Kg5kzmEu/NewtwFZc="
Content-Type: application/json
Date: Mon, 01 Feb 2021 09:21:54 GMT
Digest: SHA-256=47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU=
Testheader: testvalue
User-Agent: OpenAPI-Generator/1.0.0/go


Algorithm: 'rsa-sha256' Headers: '(request-target) (created) host date content-type digest' b64signature: 'j+V/a4/926UJgIUsnmQIGa+OEBPbeMjWS08Djbod0yGHqyd1APjv+lpCgO3WJHq8aHl+PMtVEMck10c7TdZuM3hgZbJYLviQMpBQRWMDMZuHaLvo+Kx53Y0iOMIl15eYunAOkoqZWcvaL5N4WLUkV/G/Z2Kg5kzmEu/NewtwFZc='
Request with HTTP signature. Scheme: 'hs2019'. Algorithm: 'RSASSA-PKCS1-v1_5'. MaxValidity: 0s. Headers: '[(request-target) Host Content-Type Digest]'
REQUEST:
GET /v2/pet/12992 HTTP/1.1
Host: petstore.swagger.io:80
Accept: application/json
Authorization: Signature keyId="my-key-id",algorithm="hs2019",headers="(request-target) host content-type digest",signature="sXE2MDeW8os6ywv1oUWaFEPFcSPCEb/msQ/NZGKNA9Emm/e42axaAPojzfkZ9Hacyw/iS/5nH4YIkczMgXu3z5fAwFjumxtf3OxbqvUcQ80wvw2/7B5aQmsF6ZwrCFHZ+L/cj9/bg7L1EGUGtdyDzoRKti4zf9QF/03OsP7QljI="
Content-Type: application/json
Digest: SHA-512=z4PhNX7vuL3xVChQ1m2AB9Yg5AULVxXcg/SpIdNs6c5H0NE8XYXysP+DGNKHfuwvY7kxvUdBeoGlODJ6+SfaPg==
Testheader: testvalue
User-Agent: OpenAPI-Generator/1.0.0/go


Algorithm: 'hs2019' Headers: '(request-target) host content-type digest' b64signature: 'sXE2MDeW8os6ywv1oUWaFEPFcSPCEb/msQ/NZGKNA9Emm/e42axaAPojzfkZ9Hacyw/iS/5nH4YIkczMgXu3z5fAwFjumxtf3OxbqvUcQ80wvw2/7B5aQmsF6ZwrCFHZ+L/cj9/bg7L1EGUGtdyDzoRKti4zf9QF/03OsP7QljI='
Request with HTTP signature. Scheme: 'hs2019'. Algorithm: 'RSASSA-PSS'. MaxValidity: 0s. Headers: '[(request-target) Host Content-Type Digest]'
REQUEST:
GET /v2/pet/12992 HTTP/1.1
Host: petstore.swagger.io:80
Accept: application/json
Authorization: Signature keyId="my-key-id",algorithm="hs2019",headers="(request-target) host content-type digest",signature="kdDU1UghLQEZHPTIypcr6Ul1wtuUuRT+AIdKNnfzQ455k/THd9P65JExltkpA069jC0tsg0PVaMpamVqbCbAVdIWvJHTxnoOdAkStg38gB+UnChIIXxAUz6ULWp4iVjtNQT/YIvdxqcBCwnbBTqqAc6oIviT0yj7plGIPdjWrmc="
Content-Type: application/json
Digest: SHA-512=z4PhNX7vuL3xVChQ1m2AB9Yg5AULVxXcg/SpIdNs6c5H0NE8XYXysP+DGNKHfuwvY7kxvUdBeoGlODJ6+SfaPg==
Testheader: testvalue
User-Agent: OpenAPI-Generator/1.0.0/go


Algorithm: 'hs2019' Headers: '(request-target) host content-type digest' b64signature: 'kdDU1UghLQEZHPTIypcr6Ul1wtuUuRT+AIdKNnfzQ455k/THd9P65JExltkpA069jC0tsg0PVaMpamVqbCbAVdIWvJHTxnoOdAkStg38gB+UnChIIXxAUz6ULWp4iVjtNQT/YIvdxqcBCwnbBTqqAc6oIviT0yj7plGIPdjWrmc='
--- PASS: TestHttpSignatureAuth (0.05s)
=== RUN   TestInvalidHttpSignatureConfiguration
    TestInvalidHttpSignatureConfiguration: http_signature_test.go:662: Invalid configuration: Invalid signing scheme: ''
--- FAIL: TestInvalidHttpSignatureConfiguration (0.00s)
=== RUN   TestBanana
--- PASS: TestBanana (0.00s)
=== RUN   TestDog
--- PASS: TestDog (0.00s)
=== RUN   TestNullableMarshalling
--- PASS: TestNullableMarshalling (0.00s)
=== RUN   TestAddPet
--- PASS: TestAddPet (0.00s)
=== RUN   TestFindPetsByStatusWithMissingParam
--- PASS: TestFindPetsByStatusWithMissingParam (0.00s)
=== RUN   TestGetPetById
--- PASS: TestGetPetById (0.00s)
=== RUN   TestGetPetByIdWithInvalidID
--- PASS: TestGetPetByIdWithInvalidID (0.00s)
=== RUN   TestUpdatePetWithForm
--- PASS: TestUpdatePetWithForm (0.00s)
=== RUN   TestFindPetsByTag
--- PASS: TestFindPetsByTag (0.00s)
=== RUN   TestFindPetsByStatus
--- PASS: TestFindPetsByStatus (0.00s)
=== RUN   TestUploadFile
--- PASS: TestUploadFile (0.00s)
=== RUN   TestUploadFileRequired
--- PASS: TestUploadFileRequired (0.00s)
=== RUN   TestDeletePet
--- PASS: TestDeletePet (0.00s)
=== RUN   TestPlaceOrder
--- PASS: TestPlaceOrder (0.00s)
=== RUN   TestCreateUser
--- PASS: TestCreateUser (0.00s)
=== RUN   TestCreateUsersWithArrayInput
--- PASS: TestCreateUsersWithArrayInput (0.00s)
=== RUN   TestGetUserByName
--- PASS: TestGetUserByName (0.00s)
=== RUN   TestGetUserByNameWithInvalidID
--- PASS: TestGetUserByNameWithInvalidID (0.00s)
=== RUN   TestUpdateUser
--- PASS: TestUpdateUser (0.00s)
FAIL
exit status 1
FAIL	_/home/circleci/OpenAPITools/openapi-generator/samples/openapi3/client/petstore/go	37.001s
[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:exec (go-test) on project GoOAS3Petstore: Command execution failed. Process exited with an error: 1 (Exit value: 1) -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
[ERROR] 
[ERROR] After correcting the problems, you can resume the build with the command

@code-lucidal58
Copy link
Contributor Author

Failure in the go testcase is fixed.

@wing328
Copy link
Member

wing328 commented Feb 4, 2021

Travis CI failure already fixed in the master.

@wing328 wing328 merged commit d869544 into OpenAPITools:master Feb 4, 2021
@wing328 wing328 added this to the 5.0.1 milestone Feb 6, 2021
@vvb vvb deleted the string-private-key branch October 11, 2023 08:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[REQ] [Go][Client]Accept privateKey content as string in http-signing
5 participants