From 6ef9cf273eb44d0d240a8e000c3a99e58b3f9c1e Mon Sep 17 00:00:00 2001 From: "Benjamin A. Petersen" Date: Thu, 15 Jun 2023 16:26:51 -0400 Subject: [PATCH] Fix post_login_handler_test.go Co-authored-by: Ryan Richard --- .../oidc/login/post_login_handler_test.go | 30 +++++++++++-------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/internal/oidc/login/post_login_handler_test.go b/internal/oidc/login/post_login_handler_test.go index 0ac3fe51..be448218 100644 --- a/internal/oidc/login/post_login_handler_test.go +++ b/internal/oidc/login/post_login_handler_test.go @@ -194,12 +194,14 @@ func TestPostLoginEndpoint(t *testing.T) { Build() expectedHappyActiveDirectoryUpstreamCustomSession := &psession.CustomSessionData{ - Username: happyLDAPUsernameFromAuthenticator, - ProviderUID: activeDirectoryUpstreamResourceUID, - ProviderName: activeDirectoryUpstreamName, - ProviderType: psession.ProviderTypeActiveDirectory, - OIDC: nil, - LDAP: nil, + Username: happyLDAPUsernameFromAuthenticator, + ProviderUID: activeDirectoryUpstreamResourceUID, + ProviderName: activeDirectoryUpstreamName, + ProviderType: psession.ProviderTypeActiveDirectory, + UpstreamUsername: happyLDAPUsernameFromAuthenticator, + UpstreamGroups: happyLDAPGroups, + OIDC: nil, + LDAP: nil, ActiveDirectory: &psession.ActiveDirectorySessionData{ UserDN: happyLDAPUserDN, ExtraRefreshAttributes: map[string]string{happyLDAPExtraRefreshAttribute: happyLDAPExtraRefreshValue}, @@ -207,11 +209,13 @@ func TestPostLoginEndpoint(t *testing.T) { } expectedHappyLDAPUpstreamCustomSession := &psession.CustomSessionData{ - Username: happyLDAPUsernameFromAuthenticator, - ProviderUID: ldapUpstreamResourceUID, - ProviderName: ldapUpstreamName, - ProviderType: psession.ProviderTypeLDAP, - OIDC: nil, + Username: happyLDAPUsernameFromAuthenticator, + ProviderUID: ldapUpstreamResourceUID, + ProviderName: ldapUpstreamName, + ProviderType: psession.ProviderTypeLDAP, + UpstreamUsername: happyLDAPUsernameFromAuthenticator, + UpstreamGroups: happyLDAPGroups, + OIDC: nil, LDAP: &psession.LDAPSessionData{ UserDN: happyLDAPUserDN, ExtraRefreshAttributes: map[string]string{happyLDAPExtraRefreshAttribute: happyLDAPExtraRefreshValue}, @@ -944,14 +948,14 @@ func TestPostLoginEndpoint(t *testing.T) { idps: oidctestutil.NewUpstreamIDPListerBuilder(), // empty decodedState: happyLDAPDecodedState, formParams: happyUsernamePasswordFormParams, - wantErr: "error finding upstream provider: provider not found", + wantErr: "error finding upstream provider: did not find IDP with name \"some-ldap-idp\"", }, { name: "upstream provider cannot be found by name and type", idps: oidctestutil.NewUpstreamIDPListerBuilder().WithLDAP(upstreamLDAPIdentityProvider), decodedState: happyActiveDirectoryDecodedState, // correct upstream IDP name, but wrong upstream IDP type formParams: happyUsernamePasswordFormParams, - wantErr: "error finding upstream provider: provider not found", + wantErr: "error finding upstream provider: did not find IDP with name \"some-active-directory-idp\"", }, }