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

OIDC module for contour-authserver #13

Merged
merged 32 commits into from
Nov 3, 2021

Conversation

robinfoe
Copy link
Contributor

OIDC module for contour-authserver

@jpeach
Copy link
Contributor

jpeach commented Jan 17, 2021

@robinfoe for the DCO check to pass you need to sign your commits with git commit -s. Use your vmware email for this. It's fine do squash and rewrite the commit message to give an editorial overview of the change at this point.

@jpeach jpeach requested review from jpeach and youngnick January 17, 2021 21:52
Copy link
Contributor

@jpeach jpeach left a comment

Choose a reason for hiding this comment

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

Making good progress. I think after this round we can probably land this. Let's make sure we have a TODO marking where we think additional config may be needed and any other items that can be filled in later.

auth-svr-config.yaml: |
address: ":9443"
issuerURL: "http://dex.auth.app.192.168.10.134.nip.io:9080"
redirectURL: "https://echo.oidc.app.local:9443"
Copy link
Contributor

Choose a reason for hiding this comment

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

This is global config for an instance of contour-authserver, but it probably only makes sense for a single vhost. Could we use the vhost metadata to pass down this sort of configuration? WDYT?

Copy link
Member

Choose a reason for hiding this comment

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

Feels like we could TODO this one, get this in, then come back and fix. We're still in experimental territory.

Copy link
Member

Choose a reason for hiding this comment

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

I think this is okay for the first version, but it will need a TODO issue. I'll log one and update here. Once I do, @robinfoe, can you please drop a comment in here and in the docs for the command?

Copy link
Member

Choose a reason for hiding this comment

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

This is #17.

config/oidc/configmap.yaml Outdated Show resolved Hide resolved
pkg/auth/oidc_connect.go Outdated Show resolved Hide resolved
pkg/auth/oidc_connect.go Outdated Show resolved Hide resolved
return false
}

return true
Copy link
Contributor

Choose a reason for hiding this comment

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

Leave a TODO (and GitHub issue) for propagating the claims? I would guess that many apps would want to see the verified claims?

Copy link
Member

Choose a reason for hiding this comment

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

This one needs an issue for tracking as well.

Copy link
Member

Choose a reason for hiding this comment

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

#18

pkg/cli/oicd_connect.go Outdated Show resolved Hide resolved
return ExitError{EX_CONFIG, err}
}

if cfg == nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

This should be an error since a nil will make it panic later. Even better wold be for the config to be guaranteer non-nil when there is no error.

Copy link
Member

Choose a reason for hiding this comment

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

I think that in the version I'm reviewing it's not possible for this to be nil here? It will always have at least the defaults? If so, this check will never be used.

pkg/config/config.go Outdated Show resolved Hide resolved
pkg/config/config.go Show resolved Hide resolved
pkg/auth/oidc_connect.go Outdated Show resolved Hide resolved
jpeach and others added 16 commits February 11, 2021 10:55
…ojectcontour#3)

The makefile task `make lint` did not work if the `golangci-lint` binary
is not found locally on the machine. This fixes the run command for `docker`
builds as well as upgrade to latest since issues were found in the older version.

Signed-off-by: Steve Sloka <[email protected]>
Signed-off-by: robinfoe <[email protected]>
Add standard `ProjectContour` copyright information to all source code files.

Signed-off-by: Steve Sloka <[email protected]>
Signed-off-by: robinfoe <[email protected]>
Internally, the check response heaers use maps, so the header slice
ordering is not stable. Add a test helper to sort this for stable test
comparisons.

Signed-off-by: James Peach <[email protected]>
Signed-off-by: robinfoe <[email protected]>
Signed-off-by: robinfoe <[email protected]>
Labels have more restrictive value validation than annotations,
so switch to annotations for specifying the basic authentication
realm and type.  To make up for the use of annotations, add a
label selector flag so that operators can filter which Secrets
to actually use.

This fixes projectcontour#4.

Signed-off-by: James Peach <[email protected]>
Signed-off-by: robinfoe <[email protected]>
Signed-off-by: robinfoe <[email protected]>
This fixes projectcontour#5.

Signed-off-by: James Peach <[email protected]>
Signed-off-by: robinfoe <[email protected]>
Signed-off-by: robinfoe <[email protected]>
Move the common gRPC server initialization code into a helper function.

Signed-off-by: James Peach <[email protected]>
Signed-off-by: robinfoe <[email protected]>
The `testserver` subcommand was running the `Htpasswd` backend rather
than the `Testserver` backend.

Signed-off-by: James Peach <[email protected]>
Signed-off-by: robinfoe <[email protected]>
Signed-off-by: James Peach <[email protected]>
Signed-off-by: robinfoe <[email protected]>
Signed-off-by: robinfoe <[email protected]>
Signed-off-by: robin foe <[email protected]>
Signed-off-by: robinfoe <[email protected]>
Copy link
Member

@youngnick youngnick left a comment

Choose a reason for hiding this comment

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

Quick edit pass over the initial docs, I need to review the oauth flow before I can review properly, sorry.

README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
auth-svr-config.yaml: |
address: ":9443"
issuerURL: "http://dex.auth.app.192.168.10.134.nip.io:9080"
redirectURL: "https://echo.oidc.app.local:9443"
Copy link
Member

Choose a reason for hiding this comment

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

Feels like we could TODO this one, get this in, then come back and fix. We're still in experimental territory.

robinfoe and others added 2 commits March 2, 2021 10:16
Co-authored-by: Nick Young <[email protected]>
Co-authored-by: Nick Young <[email protected]>
@youngnick youngnick changed the title Contour ext auth OIDC module for contour-authserver Mar 2, 2021
@youngnick youngnick self-requested a review March 2, 2021 03:06
Copy link
Member

@youngnick youngnick left a comment

Choose a reason for hiding this comment

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

Sorry, hit approve by mistake. Still need to review the OIDC flow stuff.

Sorry again @robinfoe.

Copy link
Member

@sunjayBhatia sunjayBhatia left a comment

Choose a reason for hiding this comment

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

@robinfoe could you rebase on main so the set of changed files is smaller?

surajssd and others added 2 commits April 6, 2021 10:30
The pod was OOMKilled with 30 Mi, so increase the limit to 90 Mi.

Signed-off-by: Suraj Deshmukh <[email protected]>
@stevesloka
Copy link
Member

Hey, @robinfoe do you think you'd like to finish this PR up? Happy to help out getting this pushed through, or if not, could we pick up where you left off to get this complete?

robinfoe and others added 10 commits August 20, 2021 23:14
Signed-off-by: robinfoe <[email protected]>
Signed-off-by: robinfoe <[email protected]>
Signed-off-by: robinfoe <[email protected]>
Signed-off-by: robinfoe <[email protected]>
Signed-off-by: robin foe <[email protected]>
Signed-off-by: robinfoe <[email protected]>
Co-authored-by: Nick Young <[email protected]>
Co-authored-by: Nick Young <[email protected]>
@robinfoe
Copy link
Contributor Author

hi @stevesloka I did the rebase on this, do you mind checking and see if it's good to go?

Copy link
Member

@youngnick youngnick left a comment

Choose a reason for hiding this comment

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

Sorry to take so long to review this @robinfoe.

I think this is looking pretty good, but needs a couple of tracking issues for TODOs (which I will add).

For those, can you put a comment that looks like:

// TODO(robinfoe) #issuenumber : description

That tells us what issue to check, who has the most context, and a rough idea of what to do.

auth-svr-config.yaml: |
address: ":9443"
issuerURL: "http://dex.auth.app.192.168.10.134.nip.io:9080"
redirectURL: "https://echo.oidc.app.local:9443"
Copy link
Member

Choose a reason for hiding this comment

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

I think this is okay for the first version, but it will need a TODO issue. I'll log one and update here. Once I do, @robinfoe, can you please drop a comment in here and in the docs for the command?

pkg/auth/oidc_connect.go Outdated Show resolved Hide resolved
return false
}

return true
Copy link
Member

Choose a reason for hiding this comment

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

This one needs an issue for tracking as well.

return ExitError{EX_CONFIG, err}
}

if cfg == nil {
Copy link
Member

Choose a reason for hiding this comment

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

I think that in the version I'm reviewing it's not possible for this to be nil here? It will always have at least the defaults? If so, this check will never be used.

StatusTokenReady
)

// NewState .... create new state to store token for OIDC
Copy link
Member

Choose a reason for hiding this comment

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

Can you please update these comments to be of the following form?

// XFunc does the thing that it does.

I agree that a bunch of them are pretty simple, but it doesn't hurt to explain what they do and are used for regardless.

@stevesloka
Copy link
Member

Hey @robin-mbg thanks for the work on this! Going to merge and add some more PRs to follow-up, but this a great start! 🎉

@stevesloka stevesloka merged commit 1ee7415 into projectcontour:main Nov 3, 2021
@robin-mbg
Copy link

@stevesloka I think the thanks belongs to @robinfoe as I have honestly never heard of this project, nor have I actively contributed, despite the commit history. It seems like @robinfoe is using an email address for his commits that GitHub attributes to my account. Looks quite interesting though and will definitely take a closer look at this project from now on.

@stevesloka
Copy link
Member

Huh? Sorry for the mixup @robin-mbg. I assumed @robinfoe starting using a new github handle for some reason. 🙃

@robinfoe
Copy link
Contributor Author

@stevesloka , thx for the merge, not too sure what's going on with my Github account but thx for spotting that , will get it fixed :)

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.

7 participants