配置 OSLC 服务器
Windchill 支持以下 OSLC 规范:
Configuration Management 1.0 (用于显示 Windchill 部件)
Change Management 3.0 (用于显示 Windchill 变更对象)
Windchill OSLC 服务将 Windchill 对象映射到相应的 OSLC 资源,并以请求的格式提供响应。以下是受支持的格式:
RDF/XML (默认格式)
JSON-LD
Turtle
Windchill OSLC 目录
可在以下位置访问 Windchill OSLC 目录:https://<WINDCHILL-SERVER-URL>/Windchill/oslc/catalog
配置 OAuth 授权
默认情况下,Windchill OSLC 服务使用基本授权。要启用 OAuth 授权,还需要完成附加配置步骤。有关将 Windchill 配置为使用 OAuth 的步骤,请参阅 Configure OAuth Delegated Authorization
配置 OSLC OAuth 特性时,Windchill OSLC 目录中将包含 OAuthConfiguration 特性,该特性能够让 OSLC 客户端发现它们应该使用 OAuth 授权。
Windchill OAuth 配置完成后,请设置以下 Windchill 特性:
特性名称
说明
oslc.authorizationURI
用于获取 OAuth 授权的 URI
oslc.oauthAccessTokenURI
用于获取 OAuth 访问令牌的 URI
oslc.oauthRequestTokenURI
用于获取 OAuth 请求令牌的 URI
* 
使用 OAuth 授权时,请确保对 OSLC 端点的所有请求都以配置的 SpringSecurityFilterChain url 模式作为前缀。例如,如果 SpringSecurityFilterChain 配置为 /oauth/* url 模式,所有 OSLC 端点都必须具有 /oauth/oslc/* url 模式。
启用 Windchill OSLC 服务所需的配置
要启用 Windchill OSLC 服务,请执行以下步骤:
1. 将以下条目添加到 %WT_HOME%/codebase/WEB_INF/web.xml
<servlet-mapping>
<servlet-name>OSLCServlet</servlet-name>
<url-pattern>/oslc/*</url-pattern>
</servlet-mapping>
2. 要将 OSLC 路径添加到 Apache 配置,请将以下条目添加至 HTTPServer/conf/conf.d/30-app-Windchill-AJP.conf
JkMount /Windchill/oslc/* ajpWorker
3. 要在 Apache 配置中配置可供匿名访问的 OSLC 目录,请将以下条目添加至 HTTPServer/conf/conf.d/30-app-Windchill-Auth.conf
<LocationMatch ^/+Windchill/+oslc/catalog(;.*)?>
Require all granted
</LocationMatch>
内容安全策略的配置
要允许其他站点的客户端站点查看 OSLC 预览,请更新 web.xml 文件以包括以下 OSLC 内容安全 servlet 筛选器配置:
<filter>
<filter-name>OSLCContentSecurityFilter</filter-name>
<description>Servlet request filter to set the Content Security Policy for previews</description>
<filter-class>com.ptc.oslc.windchill.filter.OSLCHttpHeaderSecurityFilter</filter-class>
<init-param>
<param-name>allowedOrigins</param-name>
<param-value>https://site1.domain.com,https://site2.domain.com </param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>OSLCContentSecurityFilter</filter-name>
<url-pattern>/oslc/*</url-pattern>
</filter-mapping>
OSLC 跨域资源共享 (CORS) 的配置
* 
为了获得更安全的配置,请仅对跨域 OSLC 配置使用 CORS 筛选器。
* 
在配置 Windchill 以与其他 OSLC 产品共享 OSLC 内容时,请在同一域中本地安装这些应用程序。
要允许其他站点的客户端站点查看 OSLC 服务,请更新 web.xml 文件以包括以下 servlet 筛选器配置:
<filter>
<filter-name>ContentCorsFilter</filter-name>
<filter-class>org.apache.catalina.filters.CorsFilter</filter-class>
<init-param>
<param-name>cors.allowed.origins</param-name>
<param-value>[ALLOWED_ORIGINS]</param-value>
</init-param>
<init-param>
<param-name>cors.support.credentials</param-name>
<param-value>true</param-value>
</init-param>
<init-param>
<param-name>cors.allowed.methods</param-name>
<param-value>GET,POST,OPTIONS,HEAD</param-value>
</init-param>
<init-param>
<param-name>cors.allowed.headers</param-name>
<param-value>Content-Type,X-Requested-With</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>ContentCorsFilter</filter-name>
<url-pattern>/oslc/preview/*</url-pattern>
<url-pattern>/oslc/config/*</url-pattern>
<url-pattern>/oslc/cm/*</url-pattern>
</filter-mapping>
配置 Apache 以支持跨站点部署内的 Windchill 预览框架
如果 Windchill 与外部 OSLC 服务器 (例如 Codebeamer) 集成,且两者均跨站点部署,必须将 Apache 配置为支持在集成的 OSLC 服务器中构建 Windchill 预览框架。跨站点部署是指部署到不同顶层 Internet 域 (如 windchill.foo.comcodebeamer.bar.com) 的服务器。
* 
为了实现与新版浏览器的兼容性,必须进行此配置。
要配置 Apache,请执行以下步骤:
1. app-Windchill.properties 文件中设置以下特性:
特性
说明
trustedAncestorSites
指定跨站点 OSLC 服务器的 URL,以便能够构建 OSLC 预览页面的框架。
此值应与 web.xml 文件中 OSLCContentSecurityFilterallowedOrigins 值相匹配。
例如,跨站点 Codebeamer 服务器 的 URL:https\://ppumsv-ipfc408d.almrd.example.com\:8573
authCookieNameRegexp
身份验证 Cookie 名称的正则表达式 (可以与身份验证 Cookie 的名称相同)。
例如:_shibsession_.*
要查找身份验证 Cookie,请登录 Windchill 并转至浏览器中的 Developer Tools > Application > Cookies
enableOslcPreviewRewrite
如果将此值设置为 true,可以启用基于 Apache 的跳转页面流。
enableRefererChecking
如果将此值设置为 true,可以启用引用网址标头检查作为附加安全措施。此字段是可选的。
originBaseUrl
如果将 enableRefererChecking 设置为 true,指定 Windchill 服务器的基本 URL。
例如:https\://pwrdcsv-wcqa576d.ptcnet.ptc.com
setReferrerPolicy
如果将 enableRefererChecking 设置为 true,会将此值设置为 true,以将引用网站策略响应标头配置为 strict-origin
2. 执行 Ant 命令 ant -f webAppConfig.xml regenAllWebApps
或者,也可以执行 Ant 命令 ant -f webAppConfig.xml regenWebAppConf -DappName=Windchill
3. 重新启动 Apache 服务器以应用变更。
4. 验证您是否可以在集成的 OSLC 服务器中查看 Windchill 预览。
这对您有帮助吗?