
package de.ivu.elect.business.system.control;

import javax.enterprise.inject.Specializes;

import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import de.ivu.elect.business.system.entity.HttpSessionTracking;

@Specializes
public class NlHttpSessionKonfigurationInit extends HttpSessionKonfigurationInit {

  private static final Logger LOG = LoggerFactory.getLogger(NlHttpSessionKonfigurationInit.class);

  public NlHttpSessionKonfigurationInit() {
    super();
  }

  @Override
  protected HttpSessionTracking getDefaultSessionTrackingMode() {
    return HttpSessionTracking.COOKIE; // ELECTVAPP-364
  }

  @Override
  protected Boolean getDefaultCookieConfigHttpOnly() {
    return true; // ELECTVAPP-373
  }

  @Override
  protected String getDefaultHttpForceHostname() {
    var set = System.getProperty("nl.election.hostname"); // ELECTVAPP-1934
    LOG.info("nl.election.hostname: '" + set + "'");
    if (StringUtils.isBlank(set)) {
      return "";
    }
    return set;
  }
}
