Search in sources :

Example 1 with VirtualHostIdProvidersMapping

use of com.enonic.xp.web.vhost.impl.mapping.VirtualHostIdProvidersMapping in project xp by enonic.

the class VirtualHostConfigMap method buildMapping.

private VirtualHostMapping buildMapping(final String name) {
    final String prefix = "mapping." + name + ".";
    final String hostString = getString(prefix + "host");
    final String host = hostString != null ? hostString : "localhost";
    final String source = normalizePath(getString(prefix + "source"));
    final String target = normalizePath(getString(prefix + "target"));
    final VirtualHostIdProvidersMapping idProvidersMapping = getHostIdProvidersMapping(prefix);
    final int order = getInt(prefix + "order", Integer.MAX_VALUE);
    return new VirtualHostMapping(name, host, source, target, idProvidersMapping, order);
}
Also used : VirtualHostMapping(com.enonic.xp.web.vhost.impl.mapping.VirtualHostMapping) VirtualHostIdProvidersMapping(com.enonic.xp.web.vhost.impl.mapping.VirtualHostIdProvidersMapping)

Example 2 with VirtualHostIdProvidersMapping

use of com.enonic.xp.web.vhost.impl.mapping.VirtualHostIdProvidersMapping in project xp by enonic.

the class VirtualHostConfigMap method getHostIdProvidersMapping.

private VirtualHostIdProvidersMapping getHostIdProvidersMapping(final String mappingPrefix) {
    final String idProviderPrefix = mappingPrefix + "idProvider" + ".";
    final VirtualHostIdProvidersMapping.Builder hostIdProvidersMapping = VirtualHostIdProvidersMapping.create();
    getIdProviders(idProviderPrefix).forEach((idProviderName, idProviderStatus) -> {
        final IdProviderKey idProviderKey = IdProviderKey.from(idProviderName);
        if (DEFAULT_ID_PROVIDER_VALUE.equals(idProviderStatus)) {
            hostIdProvidersMapping.setDefaultIdProvider(idProviderKey);
        }
        if (ENABLED_ID_PROVIDER_VALUE.equals(idProviderStatus)) {
            hostIdProvidersMapping.addIdProviderKey(idProviderKey);
        }
    });
    return hostIdProvidersMapping.build();
}
Also used : IdProviderKey(com.enonic.xp.security.IdProviderKey) VirtualHostIdProvidersMapping(com.enonic.xp.web.vhost.impl.mapping.VirtualHostIdProvidersMapping)

Aggregations

VirtualHostIdProvidersMapping (com.enonic.xp.web.vhost.impl.mapping.VirtualHostIdProvidersMapping)2 IdProviderKey (com.enonic.xp.security.IdProviderKey)1 VirtualHostMapping (com.enonic.xp.web.vhost.impl.mapping.VirtualHostMapping)1