此範例提供有關如何透過憑證式驗證 (CBA) 強化已針對單一登入配置 ThingWorx,且將 PingFederate 作為「中央驗證伺服器」(CAS) 與「識別提供者」(IdP),並將 Windchill DS 作為「資料存放區」之 SSO 環境的詳細步驟。它可讓使用者使用其認證或憑證登入 ThingWorx。
如需詳細的 PingFederate 文件集,請參閱
配置 X.509 憑證 IdP 轉接器。
步驟 1:產生憑證
當您設定憑證式驗證時,您可以配置 PingFederate,以便可以對照儲存在 PingFederate 中的「憑證授權單位」(CA) 憑證驗證用於驗證使用者的憑證。如果您沒有 CA 與使用者憑證,可以產生自我簽署憑證並在 PingFederate 中使用該憑證。欲產生公開金鑰與用戶端憑證,請使用下列指令:
1. openssl genrsa -out ptc-sso-ca.key 4096
2. openssl req -x509 -new -nodes -key ptc-sso-ca.key -days 3650 -out ptc-sso-ca.pem
3. openssl genrsa -out ptc-sso-jsmith.key 2048
4. openssl req -new -key ptc-sso-jsmith.key -out ptc-sso-jsmith.csr
5. 建立 v3.ext 檔案:
extendedKeyUsage=clientAuth
keyUsage = digitalSignature
6. openssl x509 -req -in ptc-sso-jsmith.csr -CA ptc-sso-ca.pem -CAkey ptc-sso-ca.key -CAcreateserial -out ptc-sso-jsmith.pem -days 1024 -sha256 -extfile <path to v3.ext file>
7. openssl pkcs12 -export -out ptc-sso-jsmith.pfx -inkey ptc-sso-jsmith.key -in ptc-sso-jsmith.pem
步驟 2:新增 CA 憑證至 PingFederate
欲使用 X.509 權杖,PingFederate 需要次要 SSL 埠。欲設定次要 SSL 埠,請將 pf.secondary.https.port 的值變更為有效埠號來編輯 <pf-install>/ping federate/bin/run.properties 檔案。(在本範例中,我們會將其配置為 9032)。
步驟 3:新增受信任的 CA 憑證
1. 導覽至 > > 。
2. 選取您的 CA 授權單位憑證檔案 (pem 檔案)。
3. 在 Summary 視窗中,檢閱您的組態,視需要修改,然後按一下 Save。
步驟 4:在瀏覽器中儲存使用者憑證
現在,將使用者憑證 (pfx 檔案) 匯入到瀏覽器中。
此轉接器將用來根據使用者的憑證驗證使用者。
1. 以管理員身分登入 PingFederate。導覽至 > > > 。按一下 Create New Instance
2. 輸入 Instance Name 與 Instance ID。將類型設定為 X.509 Certificate IdP Adapter 1.3.1。按一下 Next。
3. 輸入為 pf.secondary.https.port 指定的 Client Auth Port (9032)。針對 client hostname,輸入 PingFederate 系統的 fqdn。
4. 核取 Match Issuer DN in Client X.509 certificate,然後按一下 Show Advanced Fields。
5. 使用 Policy OID 設定 Authentication Context,然後選取 Include Subject Alternative Name (SAN) 選項。按一下 Next。
6. 在 Extended Contract 標籤中,使用 Add 按鈕輸入 userPrincipalName 與 CN,然後按一下 Next。
7. 在 Adapter Attributes 標籤中,設定 userPrincipalName 屬性的 Pseudonym 選項,然後按一下 Next。
8. 在 Adapter Contract Mapping 標籤中,您可以配置資料存放區中的其他屬性與 Issuance Criteria。Issuance Criteria 會使用憑證中提供的資訊驗證使用者是否存在於 LDAP 中。
| 在 ThingWorx 中,必須針對 CBA 設定 Issuance Criteria。 |
a. 按一下 Configure Adapter Contract。
b. 在 Adapter Contract Mapping 中,按一下 ADD Attribute Source。
c. 將 LDAP 設定為 Attribute Source Id 與 Attribute Source Description。在 Active Data Store 中,選取您的 WindchillDS 資料存放區,然後按一下 Next。
d. 在 LDAP Directory Search 中,提供下列參數:
i. Base DN = cn=Windchill_11.1,o=ptc
ii. Search Scope = Subtree
iii. 新增下列使用者屬性:uid、CN 與 Subject DN
e. 按一下 Next。
f. 在 LDAP FILTER 中,設定下列篩選器:uid=${CN}。按一下 Next 與 Done。
g. 在 Adapter Contract Fulfillment 中,將 userPrincipalName 來源設定為具有 uid 值的 LDAP。將其他所有合約來源設定為 Adapter。按一下 Next。
h. 在 Issuance Criteria 中,按一下 Show Advanced Criteria。
i. 新增下列 Expression:#this.get("ds.LDAP.uid").hasValue(#this.get("CN").getValue())
ii. 提供 Error Result,即 "User was not found"
iii. 按一下「新增」。
9. 按一下 Next,然後按一下 Save
1. 以管理員身分登入 PingFederate。導覽至 > > 。選取您的連線名稱。
2. 按一下 > 。
3. 在 Adapter Instance 標籤中,選取您在「B 部份」建立的轉接器名稱。按一下 Next。
4. 將各種屬性對應至轉接器值或動態文字值。
5. 按一下 Next,然後按一下 Save。