-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Make OAuth provider discoverable from within a Pod #10845
Conversation
scope.UserListAllProjects, | ||
}, | ||
ResponseTypesSupported: config.AllowedAuthorizeTypes, | ||
GrantTypesSupported: config.AllowedAccessTypes, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
only include "authorization_code"
for now. the others are included in the osin config, but the impl given to actually validate the other types (client-credentials, assertion, etc) just denies
[test] since I changed existing code. |
re[test] AWS error |
Let's keep the redirect uri stuff in a separate PR. The discovery bits are useful on their own |
cae7b06
to
184e1d8
Compare
@@ -346,37 +347,76 @@ func (c *MasterConfig) InstallProtectedAPI(container *restful.Container) ([]stri | |||
initControllerRoutes(root, "/controllers", c.Options.Controllers != configapi.ControllersDisabled, c.ControllerPlug) | |||
initHealthCheckRoute(root, "/healthz") | |||
initReadinessCheckRoute(root, "/healthz/ready", c.ProjectAuthorizationCache.ReadyForAccess) | |||
initVersionRoute(container, "/version/openshift") | |||
|
|||
if err := initVersionRoute(container, "/version/openshift"); err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why did you make this fatal?
@deads2k I'm wondering how this will fit with the oauth server split stuff we discussed |
22ec011
to
4068743
Compare
re[test] flake on #10080 |
You really want to build it like this? Even if you decide to do it like this, you should version this API. |
@deads2k I am not sure if I would call this an API since you can't really perform any actions with it. That being said, the draft has no concept of versioning. Granted I suppose they could just make a new well known URI if they ever needed to make a backwards incompatible change. The data returned by this endpoint is essentially never supposed to change structure. |
You call it externally and rely on its output to behave consistently for the purposes of deserialization so that a client can semantically interpret it. API.
That rarely works out. |
the URL and output are dictated by the rfc. curious how you would version that |
Didn't realize it was for a spec. Your link to the spec is dead. |
@enj Consider a world where the oauth server lives in a process that is separate from the API server. Because other authentication techniques exist, it could actually be in a pod. This has several repercussions:
Items 1 and 2 suggest that you could try to find this information via API inspection (magic config map or magic service/route come to mind). Item 3 could probably be punted on if we expect overall internal traffic to be low. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only two questions, the code itself looks good. As for @deads2k suggestion I'm opposed to versioning that endpoint.
|
||
// OauthAuthorizationServerMetadata holds OAuth 2.0 Authorization Server Metadata used for discovery | ||
// https://tools.ietf.org/id/draft-ietf-oauth-discovery-04.html#rfc.section.2 | ||
type OauthAuthorizationServerMetadata struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about the remaining metadata attributes? Why only those?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I focused on the REQUIRED
and RECOMMENDED
metadata. A lot of the OPTIONAL
ones are not supported by OpenShift (for example, jwks_uri
and token_endpoint_auth_signing_alg_values_supported
). Since @liggitt just added PKCE support, I could add code_challenge_methods_supported
(but that may be out of scope and could certainly be added later). token_endpoint_auth_methods_supported
, service_documentation
, ui_locales_supported
, op_policy_uri
, op_tos_uri
, protected_resources
, etc may all be valid now or in the future, but are probably out of scope as well.
Issuer: masterPublicURL, | ||
AuthorizationEndpoint: authorizeURL, | ||
TokenEndpoint: tokenURL, | ||
ScopesSupported: []string{ // Note: this list is incomplete, which is allowed per the draft spec |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why these scopes and not others?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't see an easy way for me to get any other scopes. I welcome suggestions for making this list more complete.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, the remaining role scope is varying, since it contains actual role name and namespace. Well, we're complaint with the spec, since it allows not to advertise all. Thanks for the info
4068743
to
087c823
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Issuer: masterPublicURL, | ||
AuthorizationEndpoint: authorizeURL, | ||
TokenEndpoint: tokenURL, | ||
ScopesSupported: []string{ // Note: this list is incomplete, which is allowed per the draft spec |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, the remaining role scope is varying, since it contains actual role name and namespace. Well, we're complaint with the spec, since it allows not to advertise all. Thanks for the info
I'm not sure its that simple. Sometimes you want to discover externally routable names and sometimes you want to discover internally routable names. Assuming that internal components can hit externally routable names (like this does) gets us a long way. |
Expectation is author set the route name to a resolvable one. Def add to On Oct 5, 2016, at 7:58 AM, David Eads [email protected] wrote: @deads2k https://github.com/deads2k mentioned that this should return a I'm not sure its that simple. Sometimes you want to discover externally — |
922c14f
to
ef95e46
Compare
re[test] flake #11114 |
scope.UserListAllProjects, | ||
}, | ||
ResponseTypesSupported: config.AllowedAuthorizeTypes, | ||
GrantTypesSupported: osin.AllowedAccessType{osin.AUTHORIZATION_CODE}, // TODO use config.AllowedAccessTypes once our implementation handles other grant types |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we also support implicit
ec40da1
to
53263fe
Compare
API is approved |
}, | ||
GrantTypesSupported: osin.AllowedAccessType{ | ||
"authorization_code", | ||
"__implicit", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"implicit", not "__implicit"
fix the implicit grant type, then LGTM |
https://trello.com/c/7uYQSTdR Signed-off-by: Monis Khan <[email protected]>
53263fe
to
fda7222
Compare
Evaluated for origin test up to fda7222 |
@mfojtik Ready for merge. |
[merge] |
continuous-integration/openshift-jenkins/test FAILURE (https://ci.openshift.redhat.com/jenkins/job/test_pr_origin/10108/) (Base Commit: 2142bdb) |
[merge] |
flake #11240 [merge] |
Evaluated for origin merge up to fda7222 |
continuous-integration/openshift-jenkins/merge SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pr_origin/10327/) (Base Commit: 9ef2b7f) (Image: devenv-rhel7_5210) |
I pulled down the latest origin containing this merged PR and was able to successfully access .well-known/oauth-authorization-server from the jenkins oauth plugin !! |
Implementation of https://tools.ietf.org/html/draft-ietf-oauth-discovery-04
From within a pod:
cc @gabemontero @bparees
Trello ref:
https://trello.com/c/7uYQSTdR