Search in sources :

Example 1 with CubaAuthProvider

use of com.haulmont.cuba.web.auth.CubaAuthProvider in project cuba by cuba-platform.

the class CubaHttpFilter method init.

@Override
public void init(FilterConfig filterConfig) throws ServletException {
    try {
        Configuration configuration = AppBeans.get(Configuration.NAME);
        // Fill bypassUrls
        WebConfig webConfig = configuration.getConfig(WebConfig.class);
        bypassUrls.addAll(webConfig.getCubaHttpFilterBypassUrls());
        List<Filter> filters = new ArrayList<>();
        if (configuration.getConfig(WebAuthConfig.class).getExternalAuthentication()) {
            try {
                CubaAuthProvider authProvider = AppBeans.get(CubaAuthProvider.NAME);
                filters.add(authProvider);
            } catch (Exception e) {
                throw new ServletException(e);
            }
        }
        filters.addAll(getHttpRequestFilterBeans());
        setFilters(filters);
        super.init(filterConfig);
        log.debug("CubaHttpFilter initialized");
    } catch (RuntimeException e) {
        log.error("Error initializing CubaHttpFilter", e);
        throw e;
    }
}
Also used : Configuration(com.haulmont.cuba.core.global.Configuration) HttpRequestFilter(com.haulmont.cuba.web.security.HttpRequestFilter) CompositeFilter(org.springframework.web.filter.CompositeFilter) WebAuthConfig(com.haulmont.cuba.web.auth.WebAuthConfig) ArrayList(java.util.ArrayList) WebConfig(com.haulmont.cuba.web.WebConfig) CubaAuthProvider(com.haulmont.cuba.web.auth.CubaAuthProvider) IOException(java.io.IOException)

Aggregations

Configuration (com.haulmont.cuba.core.global.Configuration)1 WebConfig (com.haulmont.cuba.web.WebConfig)1 CubaAuthProvider (com.haulmont.cuba.web.auth.CubaAuthProvider)1 WebAuthConfig (com.haulmont.cuba.web.auth.WebAuthConfig)1 HttpRequestFilter (com.haulmont.cuba.web.security.HttpRequestFilter)1 IOException (java.io.IOException)1 ArrayList (java.util.ArrayList)1 CompositeFilter (org.springframework.web.filter.CompositeFilter)1