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

Updated API to remove unused token claim properties #878

Merged
merged 23 commits into from
Feb 7, 2024
Merged
Show file tree
Hide file tree
Changes from 21 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -121,3 +121,7 @@ require (
)

go 1.20

replace github.com/codeready-toolchain/api => github.com/sbryzak/api v0.0.0-20240204045223-0c2f53dbc8f6

replace github.com/codeready-toolchain/toolchain-common => github.com/sbryzak/toolchain-common v0.0.0-20240201055525-d57dc5ee80f5
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,6 @@ github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa/go.mod h1:z
github.com/cockroachdb/datadriven v0.0.0-20200714090401-bf6692d28da5/go.mod h1:h6jFvWxBdQXxjopDMZyH2UVceIRfR84bdzbkoKrsWNo=
github.com/cockroachdb/errors v1.2.4/go.mod h1:rQD95gz6FARkaKkQXUksEje/d9a6wBJoCr5oaCLELYA=
github.com/cockroachdb/logtags v0.0.0-20190617123548-eb05cc24525f/go.mod h1:i/u985jwjWRlyHXQbwatDASoW0RMlZ/3i9yJHE2xLkI=
github.com/codeready-toolchain/api v0.0.0-20240116164228-8d18c9262420 h1:rxbURSqAgiMCsyKDRwsHMjw7bIktK0IUU/OXpxwu0Zk=
github.com/codeready-toolchain/api v0.0.0-20240116164228-8d18c9262420/go.mod h1:FO7kgXH1x1LqkF327D5a36u0WIrwjVCbeijPkzgwaZc=
github.com/codeready-toolchain/toolchain-common v0.0.0-20240130202956-94befa4c786c h1:83NTlxL6LkpKyu39QxyheGV1tWRXSPOmFyu9fC0qUAA=
github.com/codeready-toolchain/toolchain-common v0.0.0-20240130202956-94befa4c786c/go.mod h1:f+h8e03UjCldtgI1NsZm/yXq2b/uZv2jsz5p8OK9Z+c=
github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk=
github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE=
github.com/coreos/etcd v3.3.13+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE=
Expand Down Expand Up @@ -595,6 +591,10 @@ github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR
github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts=
github.com/sbryzak/api v0.0.0-20240204045223-0c2f53dbc8f6 h1:bRkGN6Jj2M47Nu9q+mCebbwvipnaTkXq+2qM0J9a+bQ=
github.com/sbryzak/api v0.0.0-20240204045223-0c2f53dbc8f6/go.mod h1:FO7kgXH1x1LqkF327D5a36u0WIrwjVCbeijPkzgwaZc=
github.com/sbryzak/toolchain-common v0.0.0-20240201055525-d57dc5ee80f5 h1:wDSLLwumk1CwMpSp36cKcAft8bxHb7IEovdCxabHHnU=
github.com/sbryzak/toolchain-common v0.0.0-20240201055525-d57dc5ee80f5/go.mod h1:oZhXFgrGmPd77Z3vorZMO2vdAC1FEfXsaXOivs0KG5U=
github.com/scylladb/go-set v1.0.2/go.mod h1:DkpGd78rljTxKAnTDPFqXSGxvETQnJyuSOQwsHycqfs=
github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc=
github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM=
Expand Down
6 changes: 4 additions & 2 deletions test/e2e/parallel/registration_service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,8 @@ func TestSignupOK(t *testing.T) {
// Signup a new user
userSignup := signupUser(token, emailAddress, identity.Username, identity)

t.Logf("Signed up new user %+v", userSignup)

// Deactivate the usersignup
userSignup, err = hostAwait.UpdateUserSignup(t, userSignup.Name,
func(us *toolchainv1alpha1.UserSignup) {
Expand Down Expand Up @@ -435,7 +437,7 @@ func TestUserSignupFoundWhenNamedWithEncodedUsername(t *testing.T) {
require.NoError(t, err)
mp, mpStatus := ParseSignupResponse(t, NewHTTPRequest(t).InvokeEndpoint("GET", route+"/api/v1/signup", token0, "", http.StatusOK).UnmarshalMap())
assert.Equal(t, "", mp["compliantUsername"])
assert.Equal(t, "arnold", mp["username"])
assert.Equal(t, "arnold", mp["username"], "got response %+v", mp)
require.IsType(t, false, mpStatus["ready"])
assert.False(t, mpStatus["ready"].(bool))
assert.Equal(t, "PendingApproval", mpStatus["reason"])
Expand Down Expand Up @@ -875,7 +877,7 @@ func assertGetSignupStatusProvisioned(t *testing.T, await wait.Awaitilities, use
func assertGetSignupStatusPendingApproval(t *testing.T, await wait.Awaitilities, username, bearerToken string) {
route := await.Host().RegistrationServiceURL
mp, mpStatus := ParseSignupResponse(t, NewHTTPRequest(t).InvokeEndpoint("GET", route+"/api/v1/signup", bearerToken, "", http.StatusOK).UnmarshalMap())
assert.Equal(t, username, mp["username"])
assert.Equal(t, username, mp["username"], "unexpected username in response", mp, mpStatus)
assert.Empty(t, mp["defaultUserNamespace"])
assert.Empty(t, mp["rhodsMemberURL"])
require.IsType(t, false, mpStatus["ready"])
Expand Down
2 changes: 1 addition & 1 deletion testsupport/signup_request.go
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ func (r *SignupRequest) Execute(t *testing.T) *SignupRequest {
require.NoError(t, err)
}

t.Logf("user signup '%s' created", userSignup.Name)
t.Logf("user signup created: %+v", userSignup)

// If any required conditions have been specified, confirm the UserSignup has them
if len(r.conditions) > 0 {
Expand Down
10 changes: 5 additions & 5 deletions testsupport/user_assertions.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,22 +144,22 @@ func verifyUserAccount(t *testing.T, awaitilities wait.Awaitilities, userSignup
user, err := memberAwait.WaitForUser(t, userAccount.Name,
wait.UntilUserHasLabel(toolchainv1alpha1.ProviderLabelKey, toolchainv1alpha1.ProviderLabelValue),
wait.UntilUserHasLabel(toolchainv1alpha1.OwnerLabelKey, userAccount.Name),
wait.UntilUserHasAnnotation(toolchainv1alpha1.UserSignupUserEmailAnnotationKey,
wait.UntilUserHasAnnotation(toolchainv1alpha1.EmailUserAnnotationKey,
userSignup.Spec.IdentityClaims.Email))
assert.NoError(t, err, fmt.Sprintf("no user with name '%s' found", userAccount.Name))

userID := userSignup.Spec.IdentityClaims.UserID
if userID != "" {
accountID := userSignup.Spec.IdentityClaims.AccountID
if accountID != "" {
require.Equal(t, userID, user.Annotations[toolchainv1alpha1.SSOUserIDAnnotationKey])
require.Equal(t, accountID, user.Annotations[toolchainv1alpha1.SSOAccountIDAnnotationKey])
require.Equal(t, userID, user.Annotations[toolchainv1alpha1.UserIDUserAnnotationKey])
require.Equal(t, accountID, user.Annotations[toolchainv1alpha1.AccountIDUserAnnotationKey])
}
}

if userID == "" {
require.NotContains(t, user.Annotations, toolchainv1alpha1.SSOUserIDAnnotationKey)
require.NotContains(t, user.Annotations, toolchainv1alpha1.SSOAccountIDAnnotationKey)
require.NotContains(t, user.Annotations, toolchainv1alpha1.UserIDUserAnnotationKey)
require.NotContains(t, user.Annotations, toolchainv1alpha1.AccountIDUserAnnotationKey)
}

// Verify provisioned Identity
Expand Down
Loading