Skip to content

make an SA an oauthclient#8878

Merged
openshift-bot merged 4 commits intoopenshift:masterfrom
deads2k:make-sa-an-oauthclient
May 19, 2016
Merged

make an SA an oauthclient#8878
openshift-bot merged 4 commits intoopenshift:masterfrom
deads2k:make-sa-an-oauthclient

Conversation

@deads2k
Copy link
Copy Markdown
Contributor

@deads2k deads2k commented May 13, 2016

Still sorting out how to find the correct redirect URIs and figuring out how I can test it, but I'd like feedback on some API changes and the UPSTREAM patch I need to handle tokens.

Only some SA tokens are valid as client secrets, so users have to opt-in and they can still share SA tokens in general for other systems and purposes without exposing themselves to impersonation like this.


// AdditionalSecrets holds other secrets that may be used to identify the client. This is useful for rotation
// and for service account token validation
AdditionalSecrets []string `json:"additionalSecrets,omitempty"`
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@openshift/api-review AdditionalSecrets allows us to rotate secrets and allows us to accept multiple SA tokens as valid client secrets.

@deads2k
Copy link
Copy Markdown
Contributor Author

deads2k commented May 13, 2016

Any suggestions for how to write an automated test to check these flows?

@deads2k
Copy link
Copy Markdown
Contributor Author

deads2k commented May 13, 2016

@sgallagher this flow works. Tested using an app from @stevekuznetsov

https://nodejs.org/en/download/package-manager/#enterprise-linux-and-fedora (use the v6 one)
git clone git@github.com:stevekuznetsov/oauth-echo.git
npm install
edit config.js
node index.js

@stevekuznetsov
Copy link
Copy Markdown
Contributor

I'm not exactly sure what needs to be done to test, but in terms of the app if it's useful, we should:

  • test the app on Node 0.10
  • S2I it into an image
  • write an extended test that deploys it as a pod

Although it would seem like a CLI OAuth client would be better.

@deads2k deads2k force-pushed the make-sa-an-oauthclient branch 2 times, most recently from 453145f to 76a0883 Compare May 16, 2016 20:36
@deads2k deads2k changed the title [WIP] make an SA an oauthclient make an SA an oauthclient May 16, 2016
@deads2k
Copy link
Copy Markdown
Contributor Author

deads2k commented May 16, 2016

@soltysh unit tests to confirm the safety of what we return, if not the complete working flow.

@openshift-bot openshift-bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label May 16, 2016
@deads2k deads2k force-pushed the make-sa-an-oauthclient branch 2 times, most recently from 539592e to 66a58ae Compare May 17, 2016 11:40
@openshift-bot openshift-bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label May 17, 2016
@deads2k deads2k force-pushed the make-sa-an-oauthclient branch 2 times, most recently from 8e40abd to 1b46039 Compare May 17, 2016 17:13

// AdditionalSecrets holds other secrets that may be used to identify the client. This is useful for rotation
// and for service account token validation
AdditionalSecrets []string
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@smarterclayton API change here.

@deads2k deads2k force-pushed the make-sa-an-oauthclient branch from 1b46039 to 25de1a1 Compare May 18, 2016 11:55
@soltysh
Copy link
Copy Markdown
Contributor

soltysh commented May 18, 2016

LGTM (including tests). Thanks @deads2k !!!

@smarterclayton
Copy link
Copy Markdown
Contributor

Oops

On Wed, May 18, 2016 at 3:35 PM, OpenShift Bot notifications@github.com
wrote:

continuous-integration/openshift-jenkins/merge FAILURE (
https://ci.openshift.redhat.com/jenkins/job/merge_pull_requests_origin/5941/
)


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
#8878 (comment)

@deads2k
Copy link
Copy Markdown
Contributor Author

deads2k commented May 18, 2016

Oops

Indeed. I think I just thought of a problem I want to solve anyway. SA clients should never get grants automatically given to them. Removing the tag until I get that sorted.

@smarterclayton
Copy link
Copy Markdown
Contributor

Yeah...

On Wed, May 18, 2016 at 4:04 PM, David Eads notifications@github.com
wrote:

Oops

Indeed. I think I just thought of a problem I want to solve anyway. SA
clients should never get grants automatically given to them. Removing the
tag until I get that sorted.


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
#8878 (comment)

@liggitt
Copy link
Copy Markdown
Contributor

liggitt commented May 18, 2016

@stevekuznetsov had a pull open to let the grant method be per client. Probably need that now

@deads2k
Copy link
Copy Markdown
Contributor Author

deads2k commented May 18, 2016

@stevekuznetsov had a pull open to let the grant method be per client. Probably need that now

Setting up a switch just for SAs makes this mergeable. Allowing configuration per oauth client later would be good, but being able to say prompt or deny now on SAs is safe.

@deads2k deads2k force-pushed the make-sa-an-oauthclient branch from a80d1b1 to 28dc558 Compare May 19, 2016 15:03
@deads2k
Copy link
Copy Markdown
Contributor Author

deads2k commented May 19, 2016

@soltysh @openshift/api-review take a look at the last commit. It provides a cluster-admin with a switch to control the grant options for SA oauth clients. I think its required for this pull.

@deads2k
Copy link
Copy Markdown
Contributor Author

deads2k commented May 19, 2016

[test]

@deads2k deads2k force-pushed the make-sa-an-oauthclient branch from 28dc558 to f1536e7 Compare May 19, 2016 15:24
"redirect_uri": []string{clusterAdminClientConfig.Host},
"approve": []string{"true"},
}).Encode())
authenticatedAuthorizeHTTPRequest3, err := http.NewRequest("POST", clusterAdminClientConfig.Host+"/oauth/approve", postBody)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Maybe use the OpenShiftApprovePrefix constant here, instead of hardcoding the /oauth/approve endpoint.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Maybe use the OpenShiftApprovePrefix constant here, instead of hardcoding the /oauth/approve endpoint.

done

@soltysh
Copy link
Copy Markdown
Contributor

soltysh commented May 19, 2016

The last commit, LGTM, just a small nit 😉

@deads2k deads2k force-pushed the make-sa-an-oauthclient branch from f1536e7 to e99d31e Compare May 19, 2016 16:33
@deads2k
Copy link
Copy Markdown
Contributor Author

deads2k commented May 19, 2016

[merge]

@openshift-bot
Copy link
Copy Markdown
Contributor

openshift-bot commented May 19, 2016

continuous-integration/openshift-jenkins/test Running (https://ci.openshift.redhat.com/jenkins/job/test_pr_origin/3927/)

@openshift-bot
Copy link
Copy Markdown
Contributor

openshift-bot commented May 19, 2016

continuous-integration/openshift-jenkins/merge SUCCESS (https://ci.openshift.redhat.com/jenkins/job/merge_pull_requests_origin/5949/) (Image: devenv-rhel7_4239)

@openshift-bot
Copy link
Copy Markdown
Contributor

Evaluated for origin test up to e99d31e

@deads2k deads2k force-pushed the make-sa-an-oauthclient branch from e99d31e to 026ba1f Compare May 19, 2016 17:18
@openshift-bot
Copy link
Copy Markdown
Contributor

Evaluated for origin merge up to 026ba1f

@openshift-bot openshift-bot merged commit 8ac876b into openshift:master May 19, 2016
@deads2k deads2k deleted the make-sa-an-oauthclient branch September 6, 2016 17:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants