// Verify that an OIDC connector with no mappings produces no roles.
Verify that an OIDC connector with no mappings produces no roles.
// Verify that an OIDC connector with no mappings produces no roles .
func TestOIDCRoleMappingEmpty(t *testing.T) {
	oidcConnector := NewOIDCConnector("example", OIDCConnectorSpecV2{
		IssuerURL:    "https://www.exmaple.com",
		ClientID:     "example-client-id",
		ClientSecret: "example-client-secret",
		RedirectURL:  "https://localhost:3080/v1/webapi/oidc/callback",
		Display:      "sign in with example.com",
		Scope:        []string{"foo", "bar"},
	})
	var claims = make(jose.Claims)
	claims.Add("roles", "teleport-user")
	claims.Add("email", "foo@example.com")
	claims.Add("nickname", "foo")
	claims.Add("full_name", "foo bar")
	traits := OIDCClaimsToTraits(claims)
	require.Len(t, traits, 4)
	roles := TraitsToRoles(oidcConnector.GetTraitMappings(), traits)
	require.Len(t, roles, 0)
}
func TestOIDCRoleMappingEmpty ( t * testing . T ) { oidcConnector := NewOIDCConnector ( " " , OIDCConnectorSpecV2 { IssuerURL : " " , ClientID : " " , ClientSecret : " " , RedirectURL : " " , Display : " " , Scope : [ ] string { " " , " " } , } ) var claims = make ( jose . Claims ) claims . Add ( " " , " " ) claims . Add ( " " , " " ) claims . Add ( " " , " " ) claims . Add ( " " , " " ) traits := OIDCClaimsToTraits ( claims ) require . Len ( t , traits , 4 ) roles := TraitsToRoles ( oidcConnector . GetTraitMappings ( ) , traits ) require . Len ( t , roles , 0 ) }
Verify that an OIDC connector with no mappings produces no roles.
Verify that an OIDC connector with no mappings produces no roles .
// create a connector // create some claims