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

storage/kubernetes: allow arbitrary client IDs #642

Merged
merged 1 commit into from
Oct 27, 2016

Conversation

ericchiang
Copy link
Contributor

Use a hash algorithm to match client IDs to Kubernetes object names.
Because cryptographic hash algorithms produce sums larger than a
Kubernetes name can fit, a non-cryptographic hash is used instead.
Hash collisions are checked and result in errors.

Closes #631

Use a hash algorithm to match client IDs to Kubernetes object names.
Because cryptographic hash algorithms produce sums larger than a
Kubernetes name can fit, a non-cryptographic hash is used instead.
Hash collisions are checked and result in errors.
@ericchiang
Copy link
Contributor Author

FYI this passes integration testing (since we don't test those on travis)

$ go test -v ./storage/kubernetes/
=== RUN   TestIDToName
--- PASS: TestIDToName (0.00s)
=== RUN   TestNamespaceFromServiceAccountJWT
--- PASS: TestNamespaceFromServiceAccountJWT (0.00s)
=== RUN   TestLoadClient
2016/10/27 16:39:06 third party resource already created "auth-code.oidc.coreos.com"
2016/10/27 16:39:06 third party resource already created "auth-request.oidc.coreos.com"
2016/10/27 16:39:06 third party resource already created "o-auth2-client.oidc.coreos.com"
2016/10/27 16:39:06 third party resource already created "signing-key.oidc.coreos.com"
2016/10/27 16:39:06 third party resource already created "refresh-token.oidc.coreos.com"
2016/10/27 16:39:06 third party resource already created "password.oidc.coreos.com"
--- PASS: TestLoadClient (0.11s)
=== RUN   TestURLFor
--- PASS: TestURLFor (0.00s)
=== RUN   TestStorage
2016/10/27 16:39:06 third party resource already created "auth-code.oidc.coreos.com"
2016/10/27 16:39:06 third party resource already created "auth-request.oidc.coreos.com"
2016/10/27 16:39:06 third party resource already created "o-auth2-client.oidc.coreos.com"
2016/10/27 16:39:06 third party resource already created "signing-key.oidc.coreos.com"
2016/10/27 16:39:06 third party resource already created "refresh-token.oidc.coreos.com"
2016/10/27 16:39:06 third party resource already created "password.oidc.coreos.com"
=== RUN   TestStorage/AuthCodeCRUD
=== RUN   TestStorage/AuthRequestCRUD
=== RUN   TestStorage/ClientCRUD
=== RUN   TestStorage/RefreshTokenCRUD
=== RUN   TestStorage/PasswordCRUD
=== RUN   TestStorage/KeysCRUD
=== RUN   TestStorage/GarbageCollection
=== RUN   TestStorage/ClientConcurrentUpdate
--- PASS: TestStorage (0.55s)
    --- PASS: TestStorage/AuthCodeCRUD (0.07s)
    --- PASS: TestStorage/AuthRequestCRUD (0.05s)
    --- PASS: TestStorage/ClientCRUD (0.09s)
    --- PASS: TestStorage/RefreshTokenCRUD (0.03s)
    --- PASS: TestStorage/PasswordCRUD (0.06s)
    --- PASS: TestStorage/KeysCRUD (0.04s)
    --- PASS: TestStorage/GarbageCollection (0.12s)
    --- PASS: TestStorage/ClientConcurrentUpdate (0.04s)
        transactions.go:48: update1: PUT https://172.15.0.21:443/apis/oidc.coreos.com/v1/namespaces/default/oauth2clients/ojqxonlkoi3gizztonzgm5tign2wczjwnb5hgzdrnxf7fhheqqrcgji Conflict: response from server "{"kind":"Status","apiVersion":"v1","metadata":{},"status":"Failure","message":"Operation cannot be fulfilled on thirdpartyresourcedatas.extensions \"ojqxonlkoi3gizztonzgm5tign2wczjwnb5hgzdrnxf7fhheqqrcgji\": the object has been modified; please apply your changes to the latest version and try again","reason":"Conflict","details":{"name":"ojqxonlkoi3gizztonzgm5tign2wczjwnb5hgzdrnxf7fhheqqrcgji","group":"extensions","kind":"thirdpartyresourcedatas"},"code":409}"
        transactions.go:49: update2: <nil>
PASS
ok      github.com/coreos/dex/storage/kubernetes    0.664s

@ericchiang ericchiang merged commit 44fec87 into dexidp:dev Oct 27, 2016
@ericchiang ericchiang deleted the k8s-client-id branch November 22, 2016 20:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants