@Override
    public AuthorityRuleConfiguration swapToObject(final YamlAuthorityRuleConfiguration yamlConfig) {
        Collection<ShardingSphereUser> users = yamlConfig.getUsers().stream().map(userSwapper::swapToObject).collect(Collectors.toList());
        AlgorithmConfiguration provider = algorithmSwapper.swapToObject(yamlConfig.getPrivilege());
        if (null == provider) {
            provider = new DefaultAuthorityRuleConfigurationBuilder().build().getPrivilegeProvider();
        }
        Map<String, AlgorithmConfiguration> authenticators = yamlConfig.getAuthenticators().entrySet().stream()
                .collect(Collectors.toMap(Entry::getKey, entry -> algorithmSwapper.swapToObject(entry.getValue())));
        return new AuthorityRuleConfiguration(users, provider, authenticators, yamlConfig.getDefaultAuthenticator());
    }
@Test
    void assertSwapToObjectWithDefaultProvider() {
        YamlAuthorityRuleConfiguration authorityRuleConfig = new YamlAuthorityRuleConfiguration();
        authorityRuleConfig.setUsers(Collections.singletonList(getYamlUser()));
        AuthorityRuleConfiguration actual = swapper.swapToObject(authorityRuleConfig);
        assertThat(actual.getUsers().size(), is(1));
        assertThat(actual.getPrivilegeProvider().getType(), is("ALL_PERMITTED"));
        assertThat(actual.getUsers().size(), is(1));
        assertNull(actual.getDefaultAuthenticator());
        assertTrue(actual.getAuthenticators().isEmpty());
    }