wso2身份服务器中的CORS被阻止

wso2身份服务器中的CORS被阻止,wso2,wso2is,Wso2,Wso2is,我在angular 6应用程序中使用WSO2is 5.7.0,我尝试从我的应用程序调用api,但我有一个cors错误:跨源请求被阻止:同一源策略不允许在 我已经激活了oauth和authenticationendpoint中启用的cors,我编辑了两个WEB应用程序的deWEB-INF/WEB.xml,如下所示: 科尔斯 com.thetransactioncompany.cors.CORSFilter 金鸡儿 * 科尔斯 * 在authenticationendpoint中,我将cors库

我在angular 6应用程序中使用WSO2is 5.7.0,我尝试从我的应用程序调用api,但我有一个cors错误:
跨源请求被阻止:同一源策略不允许在

我已经激活了oauth和authenticationendpoint中启用的cors,我编辑了两个WEB应用程序的de
WEB-INF/WEB.xml
,如下所示:


科尔斯
com.thetransactioncompany.cors.CORSFilter
金鸡儿
*
科尔斯
*
在authenticationendpoint中,我将cors库从oauth复制到authenticationendpoint webapps In lib文件夹,并使用以下行编辑pom.xml文件:


com.thetransactioncompany.wso2
cors过滤器
1.7.0.wso2v1
在此之后,重新启动服务,我发现相同的问题
跨源请求被阻止

在我的angular应用程序服务中,我提出以下请求:

const httpHeaders = {
            headers: new HttpHeaders()
                .set('Content-Type', 'application/x-www-form-urlencoded')
                .set('Access-Control-Allow-Origin', '*')
        };

this.http.post<any>(`http://localhost:9443/commonauth`, payload, httpHeaders)
const httpHeaders={
标题:新的HttpHeaders()
.set('Content-Type','application/x-www-form-urlencoded')
.set('Access-Control-Allow-Origin','*'))
};
这是http.post(`http://localhost:9443/commonauth`,有效负载,HttpHeader)
我认为有必要从tomcat启用cors支持,但我不知道如何做到这一点,除了启用cors,我还有什么其他选择

我的资料来源:

https://docs.wso2.com/display/IS570/Invoking+一个+端点+来自+另一个+域

https://hasanthipurnima.blogspot.com/2016/05/applying-cors-filter-to-wso2-identity.html

您尝试调用的端点已在Identity Server中注册为servlet,您需要在
repository/conf/tomcat/carbon/web-INF/
中配置web.xml文件以将头应用于您的端点

您可以将
org.apache.catalina.filters.CorsFilter
添加到上述文件中,以允许使用所需的域。有关更多信息,请访问。示例配置如下所示

<filter>
  <filter-name>CorsFilter</filter-name>
  <filter-class>org.apache.catalina.filters.CorsFilter</filter-class>
  <init-param>
    <param-name>cors.allowed.origins</param-name>
    <param-value>https://www.somedomain.com</param-value>
  </init-param>
</filter>
<filter-mapping>
  <filter-name>CorsFilter</filter-name>
  <url-pattern>/commonauth</url-pattern>
</filter-mapping>

克斯菲尔特
org.apache.catalina.filters.CorsFilter
科尔斯
https://www.somedomain.com
克斯菲尔特
/普通作家