diff --git a/pkg/authn/methods_test.go b/pkg/authn/methods_test.go index 2f3467a3c..483bc2fba 100644 --- a/pkg/authn/methods_test.go +++ b/pkg/authn/methods_test.go @@ -46,6 +46,7 @@ func TestMethodType_NotEqual(t *testing.T) { func TestMethod(t *testing.T) { assert.Equal(t, MethodDefault, Method("default")) assert.Equal(t, MethodDefault, Method("")) + assert.Equal(t, MethodDefault, Method("access_token")) assert.Equal(t, MethodOAuth2, Method("oauth2")) assert.Equal(t, MethodOIDC, Method("oidc")) assert.Equal(t, MethodOIDC, Method("sso")) @@ -53,3 +54,13 @@ func TestMethod(t *testing.T) { assert.Equal(t, MethodTOTP, Method("totp")) assert.Equal(t, MethodTOTP, Method("TOTP/2FA")) } + +func TestMethodType_IsUnknown(t *testing.T) { + assert.True(t, MethodUnknown.IsUnknown()) + assert.False(t, MethodTOTP.IsUnknown()) +} + +func TestMethodType_IsSession(t *testing.T) { + assert.True(t, MethodSession.IsSession()) + assert.False(t, MethodTOTP.IsSession()) +} diff --git a/pkg/authn/providers_test.go b/pkg/authn/providers_test.go index d78d35e35..d3c413aef 100644 --- a/pkg/authn/providers_test.go +++ b/pkg/authn/providers_test.go @@ -13,6 +13,8 @@ func TestProviderType_String(t *testing.T) { assert.Equal(t, "local", ProviderLocal.String()) assert.Equal(t, "ldap", ProviderLDAP.String()) assert.Equal(t, "link", ProviderLink.String()) + assert.Equal(t, "access_token", ProviderAccessToken.String()) + assert.Equal(t, "client_credentials", ProviderClientCredentials.String()) } func TestProviderType_IsRemote(t *testing.T) { @@ -65,6 +67,8 @@ func TestProviderType_Pretty(t *testing.T) { assert.Equal(t, "Default", ProviderDefault.Pretty()) assert.Equal(t, "Default", ProviderUnknown.Pretty()) assert.Equal(t, "Client", ProviderClient.Pretty()) + assert.Equal(t, "Access Token", ProviderAccessToken.Pretty()) + assert.Equal(t, "Client Credentials", ProviderClientCredentials.Pretty()) } func TestProvider(t *testing.T) { @@ -73,4 +77,15 @@ func TestProvider(t *testing.T) { assert.Equal(t, ProviderDefault, Provider("")) assert.Equal(t, ProviderLink, Provider("url")) assert.Equal(t, ProviderDefault, Provider("default")) + assert.Equal(t, ProviderClientCredentials, Provider("oauth2")) +} + +func TestProviderType_IsUnknown(t *testing.T) { + assert.True(t, ProviderUnknown.IsUnknown()) + assert.False(t, ProviderLocal.IsUnknown()) +} + +func TestProviderType_IsApplication(t *testing.T) { + assert.True(t, ProviderApplication.IsApplication()) + assert.False(t, ProviderLocal.IsApplication()) }