Search in sources :

Example 1 with PluginRiskConsent

use of org.sonar.core.extension.PluginRiskConsent in project sonarqube by SonarSource.

the class PluginsRiskConsentFilter method doFilter.

@Override
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain chain) throws IOException, ServletException {
    HttpServletRequest request = (HttpServletRequest) servletRequest;
    HttpServletResponse response = (HttpServletResponse) servletResponse;
    PluginRiskConsent riskConsent = PluginRiskConsent.valueOf(config.get(PLUGINS_RISK_CONSENT).orElse(NOT_ACCEPTED.name()));
    if (userSession.hasSession() && userSession.isLoggedIn() && userSession.isSystemAdministrator() && riskConsent == REQUIRED) {
        redirectTo(response, request.getContextPath() + PLUGINS_RISK_CONSENT_PATH);
    }
    chain.doFilter(request, response);
}
Also used : HttpServletRequest(javax.servlet.http.HttpServletRequest) HttpServletResponse(javax.servlet.http.HttpServletResponse) PluginRiskConsent(org.sonar.core.extension.PluginRiskConsent)

Aggregations

HttpServletRequest (javax.servlet.http.HttpServletRequest)1 HttpServletResponse (javax.servlet.http.HttpServletResponse)1 PluginRiskConsent (org.sonar.core.extension.PluginRiskConsent)1