All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.wildfly.clustering.web.undertow.UndertowIdentifierSerializerProvider Maven / Gradle / Ivy

Go to download

This module adapts an implementation of wildfly-clustering-web-spi to the Undertow servlet container.

There is a newer version: 34.0.0.Final
Show newest version
/*
 * Copyright The WildFly Authors
 * SPDX-License-Identifier: Apache-2.0
 */

package org.wildfly.clustering.web.undertow;

import java.security.PrivilegedAction;

import org.kohsuke.MetaInfServices;
import org.wildfly.clustering.web.IdentifierMarshaller;
import org.wildfly.clustering.web.IdentifierMarshallerProvider;
import org.wildfly.security.manager.WildFlySecurityManager;

/**
 * @author Paul Ferraro
 */
@MetaInfServices(IdentifierMarshallerProvider.class)
public class UndertowIdentifierSerializerProvider implements IdentifierMarshallerProvider, PrivilegedAction {

    @Override
    public IdentifierMarshaller getMarshaller() {
        // Disable session ID marshalling optimization for custom alphabets
        String customAlphabet = WildFlySecurityManager.doUnchecked(this);
        return (customAlphabet == null) ? IdentifierMarshaller.BASE64 : IdentifierMarshaller.ISO_LATIN_1;
    }

    @Override
    public String run() {
        return System.getProperty("io.undertow.server.session.SecureRandomSessionIdGenerator.ALPHABET");
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy