<commit_before>/*
 * oxAuth is available under the MIT License (2008). See http://opensource.org/licenses/MIT for full text.
 *
 * Copyright (c) 2014, Gluu
 */

package org.xdi.oxauth.filter;

import org.gluu.oxserver.filters.AbstractCorsFilter;
import org.xdi.oxauth.model.configuration.AppConfiguration;

import javax.inject.Inject;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebFilter;
import javax.servlet.annotation.WebInitParam;

/**
 * CORS wrapper to support both Tomcat and Jetty
 *
 * @author <NAME>
 * @author <NAME>
 * @version March 9, 2017
 */
@WebFilter(asyncSupported = true, initParams = { @WebInitParam(name = "cors.allowed.origins", value = "*") }, urlPatterns = { "/.well-known/*",
		"/seam/resource/restv1/oxauth/*", "/opiframe" })
public class CorsFilter extends AbstractCorsFilter {

	@Inject
	private AppConfiguration appConfiguration;

	@Override
	public void init(FilterConfig filterConfig) throws ServletException {
		this.filter = getServerCorsFilter();

		if (this.filter != null) {
			String filterName = filterConfig.getFilterName();

			CorsFilterConfig corsFilterConfig = new CorsFilterConfig(filterName, appConfiguration);

			filter.init(corsFilterConfig);
		}
	}
}<commit_msg>oxAuth #529 Security error thrown using implicit flow when request the userinfo endpoint<commit_after>/*
 * oxAuth is available under the MIT License (2008). See http://opensource.org/licenses/MIT for full text.
 *
 * Copyright (c) 2014, Gluu
 */

package org.xdi.oxauth.filter;

import org.gluu.oxserver.filters.AbstractCorsFilter;
import org.xdi.oxauth.model.config.ConfigurationFactory;
import org.xdi.oxauth.model.configuration.AppConfiguration;

import javax.inject.Inject;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebFilter;

/**
 * CORS wrapper to support both Tomcat and Jetty
 *
 * @author <NAME>
 * @author <NAME>
 * @version May 16, 2017
 */
@WebFilter(
        filterName = "CorsFilter",
        asyncSupported = true,
        urlPatterns = {"/.well-known/*", "/seam/resource/restv1/oxauth/*", "/opiframe"})
public class CorsFilter extends AbstractCorsFilter {

    @Inject
    private ConfigurationFactory configurationFactory;

    @Override
    public void init(FilterConfig filterConfig) throws ServletException {
        AppConfiguration appConfiguration = configurationFactory.getAppConfiguration();
        this.filter = getServerCorsFilter();

        if (this.filter != null) {
            String filterName = filterConfig.getFilterName();

            CorsFilterConfig corsFilterConfig = new CorsFilterConfig(filterName, appConfiguration);

            filter.init(corsFilterConfig);
        }
    }
}
{'fraction_non_alphanumeric': 0.10893955845095911, 'fraction_numerical': 0.01158161418747738, 'mean_word_length': 4.2748091603053435, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5448779', 'n_tokens_mistral': 833, 'n_tokens_neox': 780, 'n_words': 194}