-
Notifications
You must be signed in to change notification settings - Fork 4.8k
fix the rest of parallel tests working with old token format #26009
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -27,42 +27,6 @@ var _ = g.Describe("[sig-auth][Feature:OAuthServer] OAuth Authenticator", func() | |
| oc := exutil.NewCLI("oauth-access-token-e2e-test") | ||
| ctx := context.Background() | ||
|
|
||
| g.It(fmt.Sprintf("accepts classic non-prefixed access tokens"), func() { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. does this imply an inverse test when we switch over? A blocker BZ would be good not to forget.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we won't be able to e2e test that since we won't be able to create such a token, but might still be worth a unit test |
||
| user, err := oc.AdminUserClient().UserV1().Users().Create(ctx, &userv1.User{ | ||
| TypeMeta: metav1.TypeMeta{}, | ||
| ObjectMeta: metav1.ObjectMeta{ | ||
| Name: "oauth-access-token-e2e-test-user-classical", | ||
| }, | ||
| FullName: "test user", | ||
| }, metav1.CreateOptions{}) | ||
| o.Expect(err).NotTo(o.HaveOccurred()) | ||
| oc.AddResourceToDelete(userv1.GroupVersion.WithResource("users"), user) | ||
|
|
||
| g.By("creating a classic oauth access token") | ||
| token := base64.RawURLEncoding.EncodeToString([]byte(uuid.New())) | ||
| classicTokenObject, err := oc.AdminOauthClient().OauthV1().OAuthAccessTokens().Create(ctx, &oauthv1.OAuthAccessToken{ | ||
| ObjectMeta: metav1.ObjectMeta{ | ||
| Name: token, | ||
| }, | ||
| UserName: user.Name, | ||
| UserUID: string(user.UID), | ||
| ClientName: "openshift-challenging-client", | ||
| Scopes: []string{"user:info"}, | ||
| RedirectURI: "https://127.0.0.1:12000/oauth/token/implicit", | ||
| }, metav1.CreateOptions{}) | ||
| o.Expect(err).NotTo(o.HaveOccurred()) | ||
| oc.AddResourceToDelete(oauthv1.GroupVersion.WithResource("oauthaccesstokens"), classicTokenObject) | ||
|
|
||
| g.By("authenticating using the classic access token as bearer token") | ||
| gotUser, err := whoamiWithToken(token, oc) | ||
| o.Expect(err).NotTo(o.HaveOccurred()) | ||
| o.Expect(gotUser.Name).To(o.Equal(user.Name)) | ||
|
|
||
| g.By("not-authenticating using a sha256 prefixed access token as bearer token") | ||
| _, err = whoamiWithToken("sha256~"+token, oc) | ||
| o.Expect(errors.IsUnauthorized(err)).To(o.BeTrue()) | ||
| }) | ||
|
|
||
| g.It(fmt.Sprintf("accepts sha256 access tokens"), func() { | ||
| user, err := oc.AdminUserClient().UserV1().Users().Create(ctx, &userv1.User{ | ||
| TypeMeta: metav1.TypeMeta{}, | ||
|
|
||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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.
where is "to make the limit" proporty gone? Do we lose anything? Or this just does not matter anymore because we always hash?
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.
the tokens have a requirement on at least 32 characters length, that's something we're keeping even though it may not make too much sense now that we're using hashed tokens