Search in sources :

Example 1 with StandardSessionIdGenerator

use of org.apache.catalina.util.StandardSessionIdGenerator in project tomcat by apache.

the class AuthenticatorBase method startInternal.

/**
     * Start this component and implement the requirements of
     * {@link org.apache.catalina.util.LifecycleBase#startInternal()}.
     *
     * @exception LifecycleException
     *                if this component detects a fatal error that prevents this
     *                component from being used
     */
@Override
protected synchronized void startInternal() throws LifecycleException {
    ServletContext servletContext = context.getServletContext();
    jaspicAppContextID = servletContext.getVirtualServerName() + " " + servletContext.getContextPath();
    // Look up the SingleSignOn implementation in our request processing
    // path, if there is one
    Container parent = context.getParent();
    while ((sso == null) && (parent != null)) {
        Valve[] valves = parent.getPipeline().getValves();
        for (int i = 0; i < valves.length; i++) {
            if (valves[i] instanceof SingleSignOn) {
                sso = (SingleSignOn) valves[i];
                break;
            }
        }
        if (sso == null) {
            parent = parent.getParent();
        }
    }
    if (log.isDebugEnabled()) {
        if (sso != null) {
            log.debug("Found SingleSignOn Valve at " + sso);
        } else {
            log.debug("No SingleSignOn Valve is present");
        }
    }
    sessionIdGenerator = new StandardSessionIdGenerator();
    sessionIdGenerator.setSecureRandomAlgorithm(getSecureRandomAlgorithm());
    sessionIdGenerator.setSecureRandomClass(getSecureRandomClass());
    sessionIdGenerator.setSecureRandomProvider(getSecureRandomProvider());
    super.startInternal();
}
Also used : Container(org.apache.catalina.Container) StandardSessionIdGenerator(org.apache.catalina.util.StandardSessionIdGenerator) ServletContext(javax.servlet.ServletContext) Valve(org.apache.catalina.Valve) SecurityConstraint(org.apache.tomcat.util.descriptor.web.SecurityConstraint)

Example 2 with StandardSessionIdGenerator

use of org.apache.catalina.util.StandardSessionIdGenerator in project tomcat by apache.

the class ManagerBase method startInternal.

@Override
protected void startInternal() throws LifecycleException {
    // nulls.
    while (sessionCreationTiming.size() < TIMING_STATS_CACHE_SIZE) {
        sessionCreationTiming.add(null);
    }
    while (sessionExpirationTiming.size() < TIMING_STATS_CACHE_SIZE) {
        sessionExpirationTiming.add(null);
    }
    /* Create sessionIdGenerator if not explicitly configured */
    SessionIdGenerator sessionIdGenerator = getSessionIdGenerator();
    if (sessionIdGenerator == null) {
        sessionIdGenerator = new StandardSessionIdGenerator();
        setSessionIdGenerator(sessionIdGenerator);
    }
    sessionIdGenerator.setJvmRoute(getJvmRoute());
    if (sessionIdGenerator instanceof SessionIdGeneratorBase) {
        SessionIdGeneratorBase sig = (SessionIdGeneratorBase) sessionIdGenerator;
        sig.setSecureRandomAlgorithm(getSecureRandomAlgorithm());
        sig.setSecureRandomClass(getSecureRandomClass());
        sig.setSecureRandomProvider(getSecureRandomProvider());
    }
    if (sessionIdGenerator instanceof Lifecycle) {
        ((Lifecycle) sessionIdGenerator).start();
    } else {
        // Force initialization of the random number generator
        if (log.isDebugEnabled())
            log.debug("Force random number initialization starting");
        sessionIdGenerator.generateSessionId();
        if (log.isDebugEnabled())
            log.debug("Force random number initialization completed");
    }
}
Also used : StandardSessionIdGenerator(org.apache.catalina.util.StandardSessionIdGenerator) Lifecycle(org.apache.catalina.Lifecycle) SessionIdGenerator(org.apache.catalina.SessionIdGenerator) StandardSessionIdGenerator(org.apache.catalina.util.StandardSessionIdGenerator) SessionIdGeneratorBase(org.apache.catalina.util.SessionIdGeneratorBase)

Aggregations

StandardSessionIdGenerator (org.apache.catalina.util.StandardSessionIdGenerator)2 ServletContext (javax.servlet.ServletContext)1 Container (org.apache.catalina.Container)1 Lifecycle (org.apache.catalina.Lifecycle)1 SessionIdGenerator (org.apache.catalina.SessionIdGenerator)1 Valve (org.apache.catalina.Valve)1 SessionIdGeneratorBase (org.apache.catalina.util.SessionIdGeneratorBase)1 SecurityConstraint (org.apache.tomcat.util.descriptor.web.SecurityConstraint)1