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

Cross clients improvement - requesting client ID always added to the audience claim #1088

Merged

Conversation

dpacierpnik
Copy link

@dpacierpnik dpacierpnik commented Sep 27, 2017

See #1087

.travis.yml Outdated
@@ -1,4 +1,5 @@
language: go
go_import_path: github.com/coreos/dex
Copy link
Contributor

Choose a reason for hiding this comment

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

please remove this, it doesn't have anything to do with the change.

Copy link
Author

Choose a reason for hiding this comment

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

Removed. I added go_import_path in travis.yaml because I was not able to run tests for my fork in Travis. With go_import_path Travis should work for your project as well as for all forks

@@ -21,12 +21,12 @@ import (
"testing"
"time"

oidc "github.com/coreos/go-oidc"
"github.com/coreos/go-oidc"
Copy link
Contributor

Choose a reason for hiding this comment

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

please don't rewrite these imports.

Copy link
Author

Choose a reason for hiding this comment

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

Fixed

oauth2Server *httptest.Server
}

type crossClientsTestDeferred struct {
Copy link
Contributor

Choose a reason for hiding this comment

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

What are these new types? I'm confused by the naming here. Can you add some explanations or not refactor the tests?

Copy link
Author

Choose a reason for hiding this comment

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

I introduced new types because there were cyclic dependencies in this code, and I wanted to somehow refactor it. But I will remove this refactoring as you suggested in overall comment, and I will just duplicate this test for the new case.

@@ -690,10 +690,14 @@ func TestOAuth2ImplicitFlow(t *testing.T) {
}
}

func TestCrossClientScopes(t *testing.T) {
func setupCrossClientsFixture(t *testing.T, crossClientsTest func(*crossClientsFixture, *crossClientsTestDeferred) (reqDump, respDump []byte)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

What does crossClientsTest do? What should it perform? Why does it return reqDump and respDump? Can we just avoid this re-factor in this PR?

Endpoint: p.Endpoint(),
Scopes: []string{
oidc.ScopeOpenID, "profile", "email",
"audience:server:client_id:" + client.ID,
Copy link
Contributor

Choose a reason for hiding this comment

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

Why don't we just remove this claim for the test?

Copy link
Author

Choose a reason for hiding this comment

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

I wanted to ensure backward-compatibility so I left an old test (if clientID is explicitly requested, issued ID token should still contain only one occurrence of clientID in audience claim)

@ericchiang
Copy link
Contributor

Thanks. Overall I think I'd rather avoid doing any test refactoring in this PR. They need refactoring but that's a bigger job than just changing the claim behavior.

Can you squash your commits before you push again?

@ericchiang
Copy link
Contributor

lgtm! Please squash

@dpacierpnik dpacierpnik force-pushed the cross-clients-audience-claim-fix branch from 933c351 to e3c9b49 Compare September 28, 2017 16:37
@dpacierpnik
Copy link
Author

Squashed

Copy link
Contributor

@ericchiang ericchiang left a comment

Choose a reason for hiding this comment

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

fyi @rithujohn191

lgtm

Copy link
Contributor

@rithujohn191 rithujohn191 left a comment

Choose a reason for hiding this comment

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

lgtm. Thanks

@rithujohn191 rithujohn191 merged commit fe15163 into dexidp:master Sep 29, 2017
@dpacierpnik dpacierpnik deleted the cross-clients-audience-claim-fix branch October 20, 2018 15:00
droid42 pushed a commit to droid42/k8s-auth-example that referenced this pull request Mar 6, 2019
…lue is an array of case sensitive strings." (https://openid.net/specs/openid-connect-core-1_0.html#IDToken)

If one specifies "cross-client trust" (https://github.com/dexidp/dex/blob/master/Documentation/custom-scopes-claims-clients.md#cross-client-trust-and-authorized-party  - I think the example in the Dex-Doc where the "ID token claims" are shown is not correct any more), an array is returned for "Aud" (due to dexidp/dex#1088).
mmrath pushed a commit to mmrath/dex that referenced this pull request Sep 2, 2019
…e-claim-fix

Cross clients improvement - requesting client ID always added to the audience claim
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

3 participants