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

Verify distributed claim endpoints #173

Merged
merged 2 commits into from Jun 4, 2018
Merged

Conversation

seanqsun
Copy link
Contributor

Updates #171

verify_test.go Outdated
@@ -358,10 +452,45 @@ type verificationTest struct {
// testing invalid signatures.
verificationKey *signingKey

config Config
config Config

Copy link
Collaborator

Choose a reason for hiding this comment

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

please remove this whitespace

verify_test.go Outdated
{
test: resolverTest{
name: "noAccessToken",
payload: `{"iss":"","aud":"client1","email":"janedoe@email.com"}`,
Copy link
Collaborator

Choose a reason for hiding this comment

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

include an issuer in these tests

verify_test.go Outdated
@@ -342,6 +345,97 @@ func TestDistributedClaims(t *testing.T) {
}
}

func TestDistClaimResolver(t *testing.T) {
tests := []struct {
Copy link
Collaborator

Choose a reason for hiding this comment

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

This should just be

tests := []resolverTest{
  // ...
}

We had the test.test in the other ones as a hack :)

verify_test.go Outdated

t.Run(test.test.name, func(t *testing.T) {

endpoint, err := test.test.testEndpoint(t)
Copy link
Collaborator

Choose a reason for hiding this comment

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

this doesn't return an endpoint? does it? Need to rename it as "claims"

Also please remove the whitespace in the two lines above.

verify.go Outdated
@@ -118,6 +120,54 @@ func contains(sli []string, ele string) bool {
return false
}

// Returns the Claims from the distributed JWT token
func resolveDistributedClaim(ctx context.Context, verifier *IDTokenVerifier, src claimSource) ([]byte, error) {

Copy link
Collaborator

Choose a reason for hiding this comment

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

no whitespace to start an indented block.

verify.go Outdated

req, err := http.NewRequest("GET", src.Endpoint, nil)
if err != nil {
return nil, fmt.Errorf("oidc: malformed request: %v", err)
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: this function isn't exported, so something else in the package going to prefix these errors with oidc:, we can remove this here.

return token.claims, nil
}

func parseClaim(raw []byte, name string, v interface{}) error {
Copy link
Collaborator

Choose a reason for hiding this comment

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

add a test for this method?

@ericchiang ericchiang changed the title [WIP] Verify distributed claim endpoints Verify distributed claim endpoints Jun 4, 2018
Copy link
Collaborator

@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.

lgtm

@ericchiang ericchiang merged commit 8ae1da5 into coreos:v2 Jun 4, 2018
@seanqsun seanqsun deleted the verifyEndpoints branch June 4, 2018 23:27
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