为会话用户配置工作指示构建基块 (Windchill 身份验证)
“会话用户”身份验证选项使用 WindchillThingWorx 进行身份验证。当用户访问 ThingWorx 时,将被转到 Windchill 进行身份验证。身份验证完成后,用户将被转回 ThingWorx。此配置要求同一用户同时存在于 WindchillThingWorx 中。
ThingWorx 包括一个配置选项,可以为 Windchill 中完成身份验证的用户自动在 ThingWorx 中创建用户。如果未选择此配置选项,则用户必须在 WindchillThingWorx 中同时独立存在。ThingWorx 用户只有被添加到相应的 ThingWorx 用户组后,才能访问工作指示构建基块实体和服务。如果您选择在 ThingWorx 中自动创建用户的选项,则可以指定自动添加到的用户组。
配置工作指示构建基块以使用“会话用户”身份验证选项时,需要进行 WindchillThingWorx 和工作指示构建基块配置。
Windchill 身份验证的先决条件
必须配置 Windchill 以使用 SSL。
必须配置 ThingWorx 以使用 SSL。
配置工作指示构建基块和 ThingWorx 以使用 Windchill 身份验证
完成以下步骤,可将工作指示构建基块和 ThingWorx 配置为使用 Windchill 进行身份验证:
1. 使 ThingWorx Java 实例识别 Windchill 服务器的证书。将 (根) 证书导入到 ThingWorx 所使用的 Java 密钥库。
2. 如果 EnableSSO 出现在 ThingWorxplatform-settings.json 文件中,请将其设置为 false,然后重新启动 ThingWorx 服务器。否则,请继续执行步骤 3。
3. ThingWorx 中创建名为 CustomHeadersDataShape 的新数据形状。在“字段定义”下,创建“基本类型”=String 的以下两个字段定义:
Accept-Language
Authorization
4. 由于必须针对副本执行自定义操作,例如覆盖某一服务,因此请为您的配置创建 PTC.SCA.SCO.MPMLink_ODataConnector 事物的副本。有关详细信息,请参阅配置 MPMLink OData 连接器重复构建基块实体
a. “配置”下,设置以下值:
“通用连接器连接设置”下,为“身份验证类型”选择“无”
“CSRF 设置”下,对“CSRF Get 请求相对 URL”输入 /servlet/odata
“HTTP 连接器连接设置”下:
“用户名”“密码”留空
对于“基本 URL”,输入 https://<Windchill 主机名>:<端口>/Windchill/sslClientAuth,其中 <Windchill 主机名><端口>Windchill 系统的相应值
对于“相对 URL”,输入 /servlet/odata
对于“连接 URL”,输入 /servlet/WindchillGW/wt.httpgw.HTTPServer/ping
单击“保存”
b. “服务”下,覆盖 GetCustomHeaderParameters 服务。将以下代码添加到服务:
var Language = Resources["CurrentSessionInfo"].GetCurrentUserLanguage();
var params = {
infoTableName: "InfoTable",
dataShapeName: "CustomHeadersDataShape"
};
var result = Resources["InfoTableFunctions"].CreateInfoTableFromDataShape(params);
params = {
tableName: "GenericConnectorConnectionSettings" /* STRING */
};
var configTable = me.GetConfigurationTable(params);
var row = configTable.getRow(0);
var authType = row.getStringValue("AuthenticationType");
if ("None".equals(authType)) {
var CurrentUser = Resources["CurrentSessionInfo"].GetCurrentUser();
var baseEncodedStr = base64EncodeString(CurrentUser + ':');
var authHeaderValue = "Basic " + baseEncodedStr;
row = {
"Accept-Language": Language,
"Authorization": authHeaderValue
};
} else {
row = {
"Accept-Language": Language
};
}
result.AddRow(row);
c. 单击“完成”
d. 单击“保存”
5. 打开 PTC.SCA.SCO.MPMLinkWorkDefinitionConverter 事物进行编辑。确保“连接器”字段引用了步骤 4 中配置的副本连接器。
6. 打开 PTC.SCA.SCO.OperatorAdvisorContentProxyMediaEntity 事物进行编辑。在“配置”下,设置以下值:
“内容源连接信息”下:
选择“动态内容”复选框
对于 URL,输入 https://<Windchill 主机名>:<端口>,其中 <Windchill 主机名><端口>Windchill 系统的相应值
选中“忽略 SSL 错误”复选框
对于“身份验证类型”,选择“会话用户”
“用户名”“密码”留空
对于“测试连接 URL”,输入 https://<Windchill 主机名>:<端口>/Windchill/sslClientAuth/servlet/odata,其中 <Windchill 主机名><端口>Windchill 系统的相应值
“SSL 连接配置”下,设置以下值:
对于“SSL 密钥存储路径”,输入 ThingWorx 密钥库的路径
对于“SSL 密钥存储密码”,输入 ThingWorx 密钥库的密码
对于“SSL 信任存储路径”,输入信任库的路径
对于“SSL 信任存储密码”,输入信任库的密码
“会话用户配置”下,为“会话用户查询参数”输入 wt.effectiveUid
7. 单击“保存”
8. 设置 Integration Runtime。有关详细信息,请参阅配置 Integration Runtime
9. 测试 ThingWorx 配置:
a. 导航至步骤 4 中的 PTC.SCA.SCO.MPMlink_ODataConnector 事物。
b. “服务”下,执行 ValidateConnection 服务。以下结果确认连接成功:
ValidateConnection 服务的输出。
配置 PTC 标识提供工具身份验证器
* 
在配置 PTC 标识提供工具身份验证器之前,请确保将最新的 ptc-windchill-extension-[ReleaseVersion] 扩展导入 ThingWorx。要访问最新扩展:
1. 下载并解压缩以下文件:PTC-Windchill-Extension-for-ThingWorx。要找到下载文件,请前往 PTC 软件下载页面并展开以下文件夹:PTC Smart Connected Applications > Release Apps > PTC Windchill Extension for ThingWorx
2. 打开 ptc-windchill-extension-<版本>.zip 文件,然后删除 ptc-thingview-extension.zip 文件。ptc-thingview-extension.zip 的最新版本已作为工作指示构建基块的一部分导入。
3. 导入 ptc-windchill-extension-<版本>.zip 文件。
要配置 PTC 标识提供者身份验证器,请完成以下步骤:
1. ThingWorx Composer 中,前往导航窗格内的“安全” > “身份验证器”
2. 打开 ptc-identity-provider-authenticator
3. “常规信息”下:
选中“已启用”复选框。
对于“优先级”,输入相应的值。默认情况下,该值为 1,表示此身份验证器是要运行的第一个身份验证器。如果要通过多个身份验证器执行检查,则“优先级”值很重要。如果优先级为 1 的身份验证器失败,则下一个身份验证器将执行身份验证检查,依此类推。
4. “配置”下:
“身份验证器配置”下,有两个选项可用于配置:CreateUserDynamicallyHomeMashup
CreateUserDynamically - 当选择此选项时,如果用户尚不存在且已通过 Windchill 进行了身份验证,则身份验证器会在 ThingWorx 中自动创建用户。如果未选择该复选框,则浏览器仍将路由到 Windchill 进行身份验证,但如果用户在 ThingWorx 中不存在,则无法打开 ThingWorx
HomeMashup - 将主混搭分配给新创建的用户。如果未指定主混搭,则 ThingWorx 会将浏览器路由到 ThingWorx 搜索页面。
User Configuration 下,添加 UserGroup。此为动态创建的 ThingWorx 用户自动添加到的用户组。选择用户组,以通过其访问工作指示构建基块实体和服务。
5. 单击“保存”
将 Servlet 筛选器添加到 Tomcat 配置
Windchill 标识提供工具身份验证筛选器可用于将未经身份验证的 ThingWorx 用户重定向至 Windchill 登录表单以进行身份验证。身份验证成功后,ThingWorx 应用程序将收到一个密钥和一个用户名。
筛选器的 ThingWorx 端在 ThingWorx Tomcat 安装目录中的 web.xml 文件中进行配置:
1. 停止 Tomcat 和 Integration Runtime。
2. 打开先前下载的 PTC-Windchill-Extension-for-ThingWorx 文件,并将 ptc-identity-provider-authentication-filter-<版本>.jar 文件从 idp 目录复制到 ThingWorx Tomcat 安装的 WEB-INF/lib 目录。
3. 导航至 <ThingWorx Tomcat>\webapps\Thingworx\WEB-INF\web.xml 文件。
4. 复制 web.xml 文件,并将副本保存到一个已知位置。
5. <ThingWorx Tomcat>\webapps\Thingworx\WEB-INF\web.xml 文件替换为先前下载的 PTC-Windchill-Extension-for-ThingWorx 文件中 \idp\twx-8.x.x 目录内的 web.xml 文件。
6. 打开该 web.xml 文件,并将您的 Windchill 服务器详细信息添加到 IdentityProviderAuthenticationFilterIdentityProviderKeyValidatorFilter 条目中,格式如下:
[http or https]://[Windchill-host]:[Windchill-port]/[Windchill WebApp name]
要查找 [Windchill WebApp 名称],可在 <Windchill>\codebase\wt.properties 中搜索 wt.webapp.name
7. 启动 Tomcat 和 Integration Runtime。
其他 Windchill 配置
1. <HTTPSERVER_HOME>\conf\ 中创建 ca-bundle.crt 文件。
2. 编辑 ca-bundle.crt 文件:
附加 Windchill 服务器 SSL 证书的内容
附加 ThingWorx SSL 证书的内容
* 
如果 Windchill 配置了第三方 SSL 链证书,则向 ca-bundle.crt 添加或复制 WindchillThingWorx 证书的内容,顺序如下:
a. Windchill 根证书
b. Windchill 中间证书
c. Windchill 服务器证书
d. ThingWorx 证书
3. 保存 ca-bundle.crt 文件。
4. <HTTPSERVER_HOME>\conf\sslvhostconf.d 中创建 sslclientauth.conf 文件。
5. 编辑 sslclientauth.conf 以添加以下行:
SSLCACertificateFile <PATH_TO>\ca-bundle.crt
<PATH_TO> 替换为 ca-bundle.crt 文件的路径。
6. 保存 sslclientauth.conf 文件。
7. 编辑 <HTTPSERVER_HOME>\conf\conf.d\20-mod_ssl.conf 文件:
取消注释包含以下内容的行 (删除行开头的井字符 (#)):
SSLOptions +FakeBasicAuth +ExportCertData +StrictRequire
取消注释包含以下内容的行:
SSLVerifyDepth
8. 保存 20-mod_ssl.conf 文件。
9. 编辑 <HTTPSERVER_HOME>\conf\httpd.conf 文件。确保未注释以下行 (删除这些行开头的井字符 (#)):
LoadModule log_config_module modules/mod_log_config.so
LoadModule setenvif_module modules/mod_setenvif.so
LoadModule ssl_module modules/mod_ssl.so
LoadModule socache_shmcb_module modules/mod_socache_shmcb.so
10. 保存 httpd.conf 文件。
11. 打开 <HTTPSERVER_HOME>\conf\conf.d\30-app-Windchill-Auth.conf 文件。确认存在类似于以下内容的 sslClientAuth 条目:
# SSL client certificate authenticated resources
<IfModule ssl_module>
<LocationMatch ^/+Windchill/+sslClientAuth(;.*)?>
Require all granted
SSLVerifyClient require
SSLOptions +ExportCertData
</LocationMatch>
</IfModule>
12. -DSSL 选项重新启动 PTC HTTP 服务器,激活 SSL。
13. 编辑 <Windchill>\codebase\WEB-INF\web.xml 文件。
a. 查找 <filter-name>TrustedSSLAuthFilter</filter-name>
b. 在现有项之后添加新的 init-param
<init-param>
<param-name>trustedSubjectPattern.1</param-name>
<param-value>.*[hostname].* </param-value>
</init-param>
将证书主题中的主机名用于 [hostname]。例如,如果主题为 CN=mycompany.domain.com,则将 mycompany 用于 [hostname]
14. 保存 web.xml 文件。
15. 重新启动 Windchill
验证配置
WindchillThingWorx 必须就管理员用户名达成一致。请考虑以下选项:
如果未在 Windchill 中进行更改,则会在安装 Windchill 时创建名为 Administrator 的管理员用户。使用已配置的 ThingWorx 系统,您可以作为该用户进行身份验证,并且具有 ThingWorx 中管理员用户的完全访问权限。
如果已对 Windchill 进行了修改,使其没有名为 Administrator 的用户,则必须确定一个 WindchillThingWorx 共有的用户名,并将该用户添加到 ThingWorx 的管理员用户组中。
要验证 Windchill 身份验证配置,请打开浏览器并转至 ThingWorx URL。浏览器将路由到 Windchill 以进行身份验证。为 Administrator (或配置为 ThingWorx 管理员的其他用户) 提供 Windchill 登录凭据。浏览器将转回 ThingWorx Composer。验证您当前是否正在以该用户身份运行 ThingWorx。这将验证 ThingWorx 是否已正确配置为使用 Windchill 身份验证。
如果已选择让身份验证器自动创建用户,请测试下一步。要进行验证,请打开浏览器并转至 ThingWorx URL。您将被转到 Windchill 进行身份验证。为 ThingWorx 中不存在的用户提供 Windchill 登录凭据。浏览器将转回 ThingWorx,转至针对动态创建用户指定为主混搭的页面。验证您当前是否正在以该用户身份运行 ThingWorx
这对您有帮助吗?