Fix post_login_handler_test.go
Co-authored-by: Ryan Richard <richardry@vmware.com>
This commit is contained in:
parent
793d1c6a5d
commit
6ef9cf273e
@ -194,12 +194,14 @@ func TestPostLoginEndpoint(t *testing.T) {
|
|||||||
Build()
|
Build()
|
||||||
|
|
||||||
expectedHappyActiveDirectoryUpstreamCustomSession := &psession.CustomSessionData{
|
expectedHappyActiveDirectoryUpstreamCustomSession := &psession.CustomSessionData{
|
||||||
Username: happyLDAPUsernameFromAuthenticator,
|
Username: happyLDAPUsernameFromAuthenticator,
|
||||||
ProviderUID: activeDirectoryUpstreamResourceUID,
|
ProviderUID: activeDirectoryUpstreamResourceUID,
|
||||||
ProviderName: activeDirectoryUpstreamName,
|
ProviderName: activeDirectoryUpstreamName,
|
||||||
ProviderType: psession.ProviderTypeActiveDirectory,
|
ProviderType: psession.ProviderTypeActiveDirectory,
|
||||||
OIDC: nil,
|
UpstreamUsername: happyLDAPUsernameFromAuthenticator,
|
||||||
LDAP: nil,
|
UpstreamGroups: happyLDAPGroups,
|
||||||
|
OIDC: nil,
|
||||||
|
LDAP: nil,
|
||||||
ActiveDirectory: &psession.ActiveDirectorySessionData{
|
ActiveDirectory: &psession.ActiveDirectorySessionData{
|
||||||
UserDN: happyLDAPUserDN,
|
UserDN: happyLDAPUserDN,
|
||||||
ExtraRefreshAttributes: map[string]string{happyLDAPExtraRefreshAttribute: happyLDAPExtraRefreshValue},
|
ExtraRefreshAttributes: map[string]string{happyLDAPExtraRefreshAttribute: happyLDAPExtraRefreshValue},
|
||||||
@ -207,11 +209,13 @@ func TestPostLoginEndpoint(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
expectedHappyLDAPUpstreamCustomSession := &psession.CustomSessionData{
|
expectedHappyLDAPUpstreamCustomSession := &psession.CustomSessionData{
|
||||||
Username: happyLDAPUsernameFromAuthenticator,
|
Username: happyLDAPUsernameFromAuthenticator,
|
||||||
ProviderUID: ldapUpstreamResourceUID,
|
ProviderUID: ldapUpstreamResourceUID,
|
||||||
ProviderName: ldapUpstreamName,
|
ProviderName: ldapUpstreamName,
|
||||||
ProviderType: psession.ProviderTypeLDAP,
|
ProviderType: psession.ProviderTypeLDAP,
|
||||||
OIDC: nil,
|
UpstreamUsername: happyLDAPUsernameFromAuthenticator,
|
||||||
|
UpstreamGroups: happyLDAPGroups,
|
||||||
|
OIDC: nil,
|
||||||
LDAP: &psession.LDAPSessionData{
|
LDAP: &psession.LDAPSessionData{
|
||||||
UserDN: happyLDAPUserDN,
|
UserDN: happyLDAPUserDN,
|
||||||
ExtraRefreshAttributes: map[string]string{happyLDAPExtraRefreshAttribute: happyLDAPExtraRefreshValue},
|
ExtraRefreshAttributes: map[string]string{happyLDAPExtraRefreshAttribute: happyLDAPExtraRefreshValue},
|
||||||
@ -944,14 +948,14 @@ func TestPostLoginEndpoint(t *testing.T) {
|
|||||||
idps: oidctestutil.NewUpstreamIDPListerBuilder(), // empty
|
idps: oidctestutil.NewUpstreamIDPListerBuilder(), // empty
|
||||||
decodedState: happyLDAPDecodedState,
|
decodedState: happyLDAPDecodedState,
|
||||||
formParams: happyUsernamePasswordFormParams,
|
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",
|
name: "upstream provider cannot be found by name and type",
|
||||||
idps: oidctestutil.NewUpstreamIDPListerBuilder().WithLDAP(upstreamLDAPIdentityProvider),
|
idps: oidctestutil.NewUpstreamIDPListerBuilder().WithLDAP(upstreamLDAPIdentityProvider),
|
||||||
decodedState: happyActiveDirectoryDecodedState, // correct upstream IDP name, but wrong upstream IDP type
|
decodedState: happyActiveDirectoryDecodedState, // correct upstream IDP name, but wrong upstream IDP type
|
||||||
formParams: happyUsernamePasswordFormParams,
|
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\"",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user