配置 OSLC 伺服器
Windchill 支援下列 OSLC 規格:
Configuration Management 1.0 (用於顯露 Windchill 零件)
Change Management 3.0 (用於顯露 Windchill 變更物件)
Windchill OSLC 服務會將 Windchill 物件對應至相應的 OSLC 資源,並以請求的格式提供回應。支援的格式如下:
RDF/XML (預設)
JSON-LD
Turtle
Windchill OSLC 型錄
您可在 https://<WINDCHILL-SERVER-URL>/Windchill/oslc/catalog 存取 Windchill OSLC 型錄。
配置 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. 欲配置使 OSLC 型錄能夠匿名存取 Apache 組態,請將下列項目新增至 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 預覽進行框架設定。跨網站部署是指部署到不同頂層網際網路網域 (例如 windchill.foo.comcodebeamer.bar.com) 的伺服器。
* 
必須進行此組態才能確保與較新的瀏覽器版本相容。
欲配置 Apache,請遵循下列步驟:
1. app-Windchill.properties 檔案中設定下列內容:
內容
描述
trustedAncestorSites
指定跨網站 OSLC 伺服器的 URL,以啟用 OSLC 預覽頁的框架設定。
此值應與 web.xml 檔案中 OSLCContentSecurityFilterallowedOrigins 的值相符。
例如,跨網站 Codebeamer 伺服器 https\://ppumsv-ipfc408d.almrd.example.com\:8573 的 URL
authCookieNameRegexp
驗證 Cookie 名稱的規則運算式,可與驗證 Cookie 的名稱相同。
例如:_shibsession_.*
欲尋找驗證 Cookie,請登入 Windchill,然後前往瀏覽器中的「開發者工具」 > 「應用程式」 > Cookie」
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 預覽。
這是否有幫助?