文章
身份和安全性
作者:Ricardo Gutierrez
2017 年 3 月
Oracle 身份云服务 (IDCS) 是 Oracle 公有云 (OPC) 中提供的一种身份即服务 (IDaaS) 解决方案。其设计初衷是为了扩展企业控制,自动化 PaaS 和 SaaS 帐户供应和取消供应,通过提供与企业身份存储和身份验证服务的无缝集成来简化用户的云应用访问体验,并通过明确报告云应用的使用情况来促进合规性活动。
IDCS 基于微服务、多租户架构,包括在自己的进程上运行并公开 RESTful 服务端点的小服务。微服务可以根据其在整个组件中的角色独立地进行扩展。由于微服务仅限于特定功能,因此更易于理解、集成和维护。
IDCS 遵循云设计原则(可扩展性、灵活性、弹性、易于部署、功能敏捷性、技术采用和组织协调性),利用基于标准的 HTTP 协议执行身份验证 (OpenID Connect 1.0)、粗粒度的授权 (OAuth 2.0)、身份联合 (SAML 2.0) 和用户/角色配置文件 (SCIM)。通过利用 HTTP-only 协议,IDCS 确保了身份服务与使用者之间的恰当隔离,这样,OPC 服务和基础设施就无需感知身份服务的物理位置和内部特征。

图 1.IDCS 架构概念设计
Oracle Identity Manager (OIM) 是一种用于跨业务应用和平台管理帐户和访问权限的内部部署解决方案。它可以在混合环境(内部部署和云)中与 IDCS 轻松集成,作为一种可行的云采用途径。IDCS 与 OIM 之间固有的协同具有以下几个优点:
集成的一个重要组件是用于 IDCS 的 OIM 连接器(即 IDCS 连接器),它为身份数据管理提供供应和协调功能。使用 Oracle Identity Governance Suite(其中 OIM 是主要组件)可以进一步增强这种集成,为内部部署应用和云应用增加认证、职责分离等身份治理功能。

图 2.OIM 与 IDCS 集成
用于 IDCS 的 OIM 连接器(本文以下称作 IDCS 连接器)支持使用 IDCS 作为 Oracle Identity Manager 的托管身份数据源。IDCS 连接器基于 Identity Connector Framework (ICF),利用 REST API 与 IDCS 进行通信,作为支持供应和协调操作的 SCIM 目标。
对于熟悉 OIM 连接器架构的用户来说,IDCS 连接器几乎遵循相同部署模式,只有一个小差别:在运行之前,必须在 IDCS 中定义客户端应用才能建立通信。以下是几个亮点:
有关 IDCS 连接器的其他信息,请查看在线文档。

图 3.IDCS 连接器供应和协调
IDCS 连接器支持两种部署模型通过 IDCS 供应身份数据。
IDCS 中新增的应用模板用于定义 IDCS 与第三方云应用(如移动、客户端或服务器应用)集成所需的身份、访问和配置信息。
用户界面上提供了三种主要应用类型,可以通过易于使用的应用向导进行自定义:
除了定义之外,IDCS 还提供了访问控制功能,因此管理员可以直接(分配用户)或间接(通过组成员身份)授予对应用的访问权限。此外,还可以为用户或组授权权利,例如,启用委托管理。

图 4.IDCS 应用向导
身份管理中的联合让两个或多个合作伙伴能够协同工作,安全地跨互联网域交换身份信息,提供安全的一次性登录 (SSO)。身份提供商 (IdP) 和服务提提供商(SP) 这两个概念在 SAML 联合中很常见。IdP 是负责验证最终用户身份并向值得信赖的合作伙伴或 SP 断言该用户的可信身份的权威实体,SP 提供应用服务但不充当身份提供商。
要共享某个用户的信息,合作伙伴必须能够识别该用户,即使他们针对这个用户可能使用不同的标识符。这通常需要在服务提供商处创建用户身份,然后用户才可以实际执行联合访问服务。这正是即时 (JIT) 供应可以大显身手的地方,最终用户首次尝试访问服务提供商的服务时,在该服务提供商处供应(创建或更新)最终用户身份,而无需事先在身份提供提供商与服务提供商之间供应身份。
通过 JIT 供应,身份提供商在 SAML 断言中包括服务提供商供应最终用户所需的用户属性。当最终用户在一次性登录操作中访问服务提供商时,身份提供商向服务提供商发送 SAML 断言。如果所提供的用户名没有匹配项,服务提供商就会用 SAML 断言中包含的最终用户属性新建一个帐户。服务提供商还会立即授予这个最终用户访问所请求服务的权限。如果找到匹配项,服务提供商会根据 SAML 断言中的属性信息更新该帐户。

图 5.IDCS 和 JIT 供应云应用
本节重点介绍一个用例示例,其中演示了使用 IDCS 连接器实现的多租户供应,以及使用 IDCS 自定义应用模板实现的联合一次性登录和 JIT 供应。
Acme Corp(一家虚构的公司)有两个子公司:Wanderlust 和 Greenenergy。每个子公司在 Oracle 身份云服务 (IDCS) 中都有自己的租户服务。该公司最近安装了内部部署的 Oracle Identity Manager (OIM),并希望配置 OIM 来整合所有 IDCS 租户。在整合中,他们希望:

图 6.Acme Corp 期望的状态配置
以下是组成该解决方案的各个功能的摘要:

图 7.解决方案概述
以下配置步骤假设 Acme Corp 已经在 Linux 服务器上安装了内部部署的 Oracle Identity Manager 或 Oracle Identity Governance Suite 11gR2 PS3,并且在 Oracle 身份云服务中存在针对 Wanderlust 和 Greenenergy 的两个租户服务。此外,还配置了租户域(wanderlust.com 和 greenenergy.com)的电子邮件基础设施,因此 Wanderlust 和 Greenenergy 子公司的用户可以收到电子邮件通知。此演示中使用的 SaaS 应用版本为 Salesforce(开发人员版)和 ServiceNow(Fuji 版)。切记,这些版本中某些配置选项可能略有不同。

图 8.Acme Corp 子组织

图 9.Acme Corp 管理角色
Employees,然后单击 Finish(图 10)。

图 10.创建组
Contractors 创建一个组。Employees 和 Contractors 创建组例如,为 Wanderlust 连接器应用输入以下值:
Name : IDCS-Connector
Description : My IDCS Connector Application Configure this application as a client now。Resource Owner 作为 Allowed Grant Types。Grant the client access to Identity Cloud Service Admin APIs 复选框并选择 Identity Domain Administrator 和 Me 角色。Client ID 和 Client Secret 值,然后单击 Close。稍后在 OIM 中配置连接器时将需要这些值。

图 11.激活连接器应用
例如,为新用户帐户输入以下值:
First Name : idcs
Last Name : connector
User Name/Email : idcs@wanderlust.comidcs。选择该用户,单击 Add 将它添加到角色。Oracle123)。稍后在 OIM 中配置连接器时将需要此值。注意:当通过 Admin Console 创建新的用户帐户时,IDCS 会向用户电子邮件地址发送电子邮件通知以激活帐户。例如:在 OIM 服务器中以拥有 OIM 安装文件的用户身份运行以下命令:
unzip /tmp/IDCS-11.1.1.5.0.zip /home/oracle/oim-oam-omss/products/identity/
iam/server/ConnectorDefaultDirectory
注:在以上目录中解压缩连接器文件将让连接器显示在用户界面 (OIM Admin Console) 中以供安装。

图 12.安装 IDCS 连接器
例如:在 OIM 服务器中打开一个终端会话,运行以下命令:
export CLASSPATH=$MW_HOME/oracle_common/modules/oracle.jrf_11.1.1/jrf-api.jar:
$MW_HOME/oracle_common/modules/oracle.odl_11.1.1/ojdl.jar
export JAVA_HOME=/usr/java/jdk1.7.0_80
export OIM_ORACLE_HOME=/home/oracle/oim-oam-omss/products/identity/iam
export MW_HOME=/home/oracle/oim-oam-omss/products/identity
export WL_HOME=/home/oracle/oim-oam-omss/products/identity/wlserver_10.3
export APP_SERVER=weblogic
export DOMAIN_HOME=/home/oracle/oim-oam-omss/config/domains/IAMGovernanceDomain
cd $OIM_ORACLE_HOME/server/bin
./PurgeCache.sh All
注:PurgeCache.sh 脚本将提示输入 OIM 管理员用户/密码和服务器 URL(例如 t3://ora-iambox.local:14000)
例如:使用 Wanderlust 租户中生成的 Client ID 和 Client Secret 运行以下命令:
echo -n "6939393047e241b08269d2c475a0e90c:39d89f20-76b6-4cdf-b4b8-989afca446bf" | base64
注:在上述命令中,双引号之间的值必须用冒号分隔:“<client_id>:<client_secret>”。在后续步骤中将使用结果值。
例如:输入以下值:
IT Resource Name : Wanderlust IDCS
IT Resource Type : Identity Cloud Services 例如,为 Wanderlust 租户输入以下值:
acceptType = application/json
authenticationServerUrl = https://wanderlust.idcs.internal.oracle.com:8943/oauth2/v1/token
baseURI = /admin/v1
Configuration Lookup = Lookup.IDCS.Configuration
Connector Server Name = [empty]
contentType = application/json
customAuthHeaders = Authorization=Basic <base64_string_for_connector_app_wanderlust>
grantType = password
host = wanderlust.idcs.internal.oracle.com
password = Oracle123
port = 8943
scope = urn:opc:idm:__myscopes__
sslEnable = true
username = idcs@wanderlust.com注:customAuthHeaders 参数的值是一个字符串,包含值“Authorization=Basic”和一个使用连接器应用的 Client ID 和 Client Secret 创建的 Base64 编码的字符串。username 和 password 参数对应于在 IDCS 中为目标租户创建的用户帐户。

图 13.IT 资源详细信息
例如:使用以下值作为 IT 资源信息:
IT Resource Name : Greenenergy IDCS
IT Resource Type : Identity Cloud Services
例如,使用以下值作为资源参数:
acceptType = application/json
authenticationServerUrl = https://greenenergy.idcs.internal.oracle.com:8943/oauth2/v1/token
baseURI = /admin/v1
Configuration Lookup = Lookup.IDCS.Configuration
Connector Server Name = [empty]
contentType = application/json
customAuthHeaders = Authorization=Basic <base64_string_for_connector_app_greenenergy>
grantType = password
host = greenenergy.idcs.internal.oracle.com
password = Oracle123
port = 8943
scope = urn:opc:idm:__myscopes__
sslEnable = true
username = idcs@greenenergy.comIDCS,单击 Save and Close,然后单击 OK 确认。例如:输入以下值为 Wanderlust 创建用户表单:
Resource Type : IDCS User
Name : WanderlustUserForm例如:使用以下值:
Resource Type : IDCS User
Name : GreenenergyUserForm例如:输入以下值为 Wanderlust 创建应用实例:
Name : WanderlustIDCS
Display Name : Wanderlust Identity Cloud Service
Description : Wanderlust Application Instance for Identity Cloud Service
Resource Object : IDCS User
IT Resource Instance : Wanderlust IDCS
Form : WanderlustUserForm例如,使用以下值作为实例详细信息:
Name : GreenenergyIDCS
Display Name : Greenenergy Identity Cloud Service
Description : Greenenergy Application Instance for Identity Cloud Service
Resource Object : IDCS User
IT Resource Instance : Greenenergy IDCS
Form : GreenenergyUserFormIDCS)并单击 Publish Sandbox,如果系统提示您确认操作,请单击 OK。IDCS Group Lookup Reconciliation。编辑作业,并根据目标租户的需要更新相应的参数。 例如,为 Wanderlust 输入以下值:
IT Resource Name : Wanderlust IDCS

图 14.计划作业
例如,对 Greenenergy 使用以下值:
IT Resource Name : Greenenergy IDCSIDCS Manager Lookup Reconciliation。和以上步骤一样,对每个目标租户运行此作业,相应地更新 IT Resource Name 参数。Entitlement List 和 Catalog Synchronization Job,对于这些作业,无需更新参数。例如,为 Wanderlust 员工策略输入以下值:
Access Policy Name : Wanderlust Employees
Access Policy Description : Access Policy for Employees
Policy Owner : User
Policy Owner's Value : XELSYSADMINIDCS User 并单击 Add 将其移至所选窗口,然后单击 Continue。IDCS User,然后再次单击 Continue。IDCS Server 域中搜索并选择 Wanderlust IDCS,然后单击 Set Additional Data。IDCS User 选中 Revoke if not longer applies 并单击 Continue,然后再次单击 Continue。

图 15.访问策略
例如,对其余策略使用以下值:
Access Policy Name : Wanderlust Contractors
Access Policy Description : Access Policy for Contractors
IDCS Server : Wanderlust IDCS
Group : Wanderlust IDCS~Contractors
Access Policy Name : Greenenergy Employees
Access Policy Description : Access Policy for Employees
IDCS Server : Greenenergy IDCS
Group : Greenenergy IDCS~Employees
Access Policy Name : Greenenergy Contractors
Access Policy Description : Access Policy for Contractors
IDCS Server : Greenenergy IDCS
Group : Greenenergy IDCS~Contractors例如,为 Wanderlust 员工角色输入以下值:
Name : Wanderlust Employees
Display Name : Wanderlust Employees
Role Description : Employees role for all Wanderlust users
Risk Level : Low Risk

图 16.成员规则
例如,对其余角色使用以下值:
Name : Wanderlust Contractors
Role Description : Contractors role for all Wanderlust users
Risk Level : Low Risk
Access Policy : Wanderlust Contractors
Membership Rule : ((User Type = "Contractor") AND (Organization = "Wanderlust"))
Organization : Wanderlust
Name : Greenenergy Employees
Role Description : Employees role for all Greenenergy users
Risk Level : Low Risk
Access Policy : Greenenergy Employees
Membership Rule : ((User Type = "Emp") AND (Organization = "Greenenergy"))
Organization : Greenenergy
Name : Greenenergy Contractors
Role Description : Contractors role for all Greenenergy users
Risk Level : Low Risk
Access Policy : Greenenergy Contractors
Membership Rule : (User Type = "Contractor") AND (Organization = "Greenenergy"))
Organization : Greenenergy 例如,为 Salesforce 应用输入以下值:
Name : Salesforce
Description : Federated SSO and JIT Provisioning with Salesforce Application
Upload icon : [optional]
Application URL : https://login.salesforce.com?so=00D41670000ePKP
Display in My Apps : [checked]
注:Application URL 参数的值是在 Salesforce 应用中配置 Single Sign-On Settings 期间生成的 Salesforce Login URL。您可以为此参数输入一个临时值,稍后在 Salesforce 中配置完成时更新此值。
例如,输入以下一般详细信息:
Entity ID : https://saml.salesforce.com
Assertion Consumer URL : https://login.salesforce.com?so=00D41670000ePKP
NameID format : Unspecified
NameID Value : Primary Email 注:Assertion Consumer URL 参数的值与 Application URL 相同。
例如,输入以下高级设置:
Signed SSO : Assertion
Include Signing Certificate in Signature : [unchecked]
Signature Hashing Algorithm : SHA-1
Enable Single Logout : [checked]
Logout Binding : Redirect
Single Logout URL : https://na35.salesforce.com/secur/logout.jsp
Logout Response URL : https://na35.salesforce.com/secur/logout.jsp
Encrypt Assertion : [unchecked]
注:Single Logout URL 和 Logout Response URL 参数的值可以从 Salesforce 应用中的 URL 地址获取。仅替换主机名部分(例如 na35.salesforce.com)。
例如,添加以下用户属性:
Name Format User Attribute (IDCS)
-------------------------- -------------- ---------------------
User.FirstName Unspecified First Name
User.LastName Unspecified Last Name
User.Email Unspecified Primary Email
User.Username Unspecified Primary Email
User.FederationIdentifier Unspecified User Name
federationId Unspecified User Name
注:这些属性是最低要求,将包含在 SAML 断言中,以对 Salesforce 启用 JIT 供应。
IDCS-Wanderlust-Certificate.pem

图 17.激活 Salesforce 应用
例如,输入以下详细信息为 Wanderlust 租户定义 IdP:
Name : WANDERLUST
SAML Version : 2.0
Issuer : https://wanderlust.idcs.internal.oracle.com:8943/fed
Identity Provider Certificate : IDCS-Wanderlust-Certificate.pem
Request Signing Certificate : [SelfSignedCert...]
Request Signature Method : [RSA-SHA1]
Assertion Decryption Certificate : [Assertion not encrypted]
SAML Identity Type : [Assertion contains the User's Salesforce username]
SAML Identity Location : [Identity is in the NameIdentifier element of the
Subject statement]
Identity Provider Login URL : [empty]
Identity Provider Logout URL : https://wanderlust.idcs.internal.oracle.com:8943/oauth2/v1/
userlogout
API Name : WANDERLUST
Entity ID : https://saml.salesforce.com
注:提供在前面配置中下载的 IDCS 证书的文件名作为 Identity Provider Certificate 参数值。

图 18.Salesforce SAML SSO 设置
WANDERLUST)显示配置设置。Salesforce Login URL 值。在 IDCS 租户中配置 Salesforce 应用时将需要此值。例如,为 ServiceNow 应用输入以下值:
Name : ServiceNow
Description : Federated SSO and JIT Provisioning with ServiceNow Application
Upload icon : [optional]
Application URL : https://dev16759.service-now.com
Display in My Apps : [checked]
注:Application URL 参数的值可以从 ServiceNow 应用中的 URL 地址获取。
例如,输入以下一般详细信息:
Entity ID : https://dev16759.service-now.com
Assertion Consumer URL : https://dev16759.service-now.com/navpage.do
NameID format : Unspecified
NameID Value : User Name
注:用从 ServiceNow 应用中的 URL 地址获取的值替换 Entity ID 和 Assertion Consumer URL 参数中的主机名。
例如,输入以下高级设置:
Signed SSO : Assertion
Include Signing Certificate in Signature : [unchecked]
Signature Hashing Algorithm : SHA-1
Enable Single Logout : [checked]
Logout Binding : Redirect
Single Logout URL : https://dev16759.service-now.com/logout.do
Logout Response URL : https://dev16759.service-now.com/logout.do
Encrypt Assertion : [unchecked]
注:用从 ServiceNow 应用中的 URL 地址获取的值替换 Single Logout URL 和 Logout Response URL 参数中的主机名。
例如,添加以下用户属性:
Name Format User Attribute (IDCS)
----------------- ---------- ---------------------
First Name Basic First Name
Last Name Basic Last Name
Email Basic Primary Email
User Name Basic User Name
注:这些属性只是最低要求,将包含在 SAML 断言中,以对 ServiceNow 启用 JIT 供应。
IDCS-Wanderlust-Metadata.xml

图 19.激活 ServiceNow 应用
SAML2 Update1IDCS-Wanderlust-Metadata.xml 文件的内容。例如,更新以下属性:
Name : WANDERLUST
Active : [checked]
Default : [checked]
User field : user_name
Protocol Binding for the IDP's
SingleLogoutRequest : urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect
NameID Policy : urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified 注:仅当定义多个提供商之后,才能选中 Default 参数。
例如,查看其余属性:
Identity Provider URL : https://wanderlust.idcs.internal.oracle.com:8943/fed
Identity Provider's AuthnRequest : https://wanderlust.idcs.internal.oracle.com:8943/fed/
v1/idp/sso
Identity Provider's SingleLogoutRequest : https://wanderlust.idcs.internal.oracle.com:8943/oauth2/
v1/userlogout
Failed Requirement Redirect : [empty]
ServiceNow Homepage : https://dev16759.service-now.com/navpage.do
Entity ID / Issuer : https://dev16759.service-now.com
Audience URI : https://dev16759.service-now.com
Protocol Binding for the IDP's
SingleLogoutRequest : urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect
NameID Policy : urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified
NameID Attribute : [empty]
Create AuthnContextClass : [unchecked]
AuthnContextClassRef Method : urn:oasis:names:tc:SAML:2.0:ac:classes:
PasswordProtectedTransport
External logout redirect : https://wanderlust.idcs.internal.oracle.com:8943/ui/
v1/myconsole
...
Signing Signature Algorithm : http://www.w3.org/2000/09/xmldsig#rsa-sha1
Single Sign-On Script : MultiSSO_SAML2_Update1
x509 Certificate : https://wanderlust.idcs.internal.oracle.com:8943/fed_1
注:ServiceNow Homepage、Entity ID / Issuer 和 Audience URI 是 ServiceNow 应用特定的,由 ServiceNow 自动填充。
x509 Certificate,以便自动导入证书。

图 20.ServiceNow SAML2 配置
IDCS-Greenenergy-Metadata.xml。Employees 组,然后单击 OK。WANDERLUST),更新 JIT 供应所需属性。 例如,更新以下属性:
SAML Identity Type : [Assertion contains the Federation ID from the User object]
SAML Identity Location : [Identity is in an Attribute element]
Attribute Name : federationId User Provisioning Enabled 复选框。Custom SAML JIT with Apex handler 并单击 Automatically create a SAML JIT handler template,选择以具有管理员权限的 Salesforce 用户身份执行处理程序。AutocreatedRegHandler1485929908670。例如,找到以下代码段:
if(attributes.containsKey('User.ProfileId')) {
String profileId = attributes.get('User.ProfileId');
Profile p = [SELECT Id FROM Profile WHERE Id=:profileId];
u.ProfileId = p.Id;
}
替换为以下代码:
/*** My changes begin here***/
if(attributes.containsKey('User.ProfileId')) {
String profileId = attributes.get('User.ProfileId');
Profile p = [SELECT Id FROM Profile WHERE Id=:profileId];
u.ProfileId = p.Id;
} else {
String profileName = 'Standard User';
Profile p = [SELECT Id, Name FROM Profile WHERE Name=:profileName];
String licenseName = 'Salesforce';
p.UserLicense = [SELECT Id, Name FROM UserLicense WHERE Name=:licenseName];
u.Profile = p;
u.ProfileId = p.Id;
}
/*** My changes end here***/
注:注意,Salesforce 开发人员版的一个 Salesforce 许可证仅允许一个标准用户,因此尝试创建多个标准用户时将触发错误。非开发人员版的 Salesforce 不应出现这种情况。您还可以使用 Chatter Free User 作为 profile name 值,使用 Chatter Free 作为 license 值。
例如,使用以下值作为脚本名称和作用域:
Name : MultiSSO_SAML2_UserProvisioning
Scope : All application scopes
Name : MultiSSO_SAML2_ImportSetUtilExtended
Scope : All application scopes
例如,复制以下代码作为 MultiSSO_SAML2_UserProvisioning 脚本:
var MultiSSO_SAML2_UserProvisioning = Class.create();
MultiSSO_SAML2_UserProvisioning.prototype = {
initialize: function(samlResponse) {
this.saml = new XMLDocument(samlResponse, false);
this.tableName = "u_imp_saml_user";
//hardcoded since import set table and transform are already pointing to this table
this.attributeStatementNode = "//Response/Assertion/AttributeStatement";
this.attributeNodeName = gs.getProperty
("glide.authenticate.sso.saml2.attribute_node_name", "Name");
//XML doc used for building XML as expected
//format for loading into Import Set
this.xmldoc = new XMLDocument();
this.xmldoc.setCurrent(this.xmldoc.createElement(this.tableName));
},
//Process the XML and extract/prepare the attribute-value pairs
//in the right format to be able to load into import set
process: function() {
var attributes = this.saml.getNodes(this.attributeStatementNode + "/*");
for (i=0; i < attributes.getLength(); i++) {
var attributeNum = i + 1;
//Default position where the "Name" attribute is normally found, just in case...
var attributeNamePosition = 0;
var AttributeStatement =
this.attributeStatementNode + "/Attribute[" + attributeNum +
"]";
//Some IdPs provide the AttributeStatement in a different non-standard format
//use this line instead of the above.
//var AttributeStatement = attributeStatementNode + "[" + attributeNum +
"]/Attribute";
//Lookup the attribute name and get its position in the element, if found
var attributeNode = this.saml.getNode(AttributeStatement).getAttributes();
for (j=0; j < attributeNode.getLength(); j++) {
if(attributeNode.item(j).getNodeName() == this.attributeNodeName) {
attributeNamePosition = j;
break;
}
}
var attributeName = this.saml.getNode(AttributeStatement).getAttributes().item
(attributeNamePosition).getNodeValue() + "";
var attributeValue = this.saml.getNodeText(AttributeStatement +
"/AttributeValue");
//Build elements
this.xmldoc.createElement("u_" + this._escapeAttribute(attributeName),
attributeValue);
}
//Use the saml:issuer element to set the source
this.xmldoc.createElement("source", "saml:" + this.saml.getNodeText
("//Response/Issuer"));
},
//Load the XML into an Import Set
loadImportSet: function() {
var isetUtil = new MultiSSO_SAML2_ImportSetUtilExtended();
var recordID = isetUtil.loadImportSetFromXML("//" + this.tableName +
"/*", this.xmldoc,
this.tableName);
return recordID;
},
//Return the value for a given Attribute found in the AttributeStatement
getAttributeValue: function(attributeName) {
return this.xmldoc.getNodeText("//" + this.tableName + "/u_" +
this._escapeAttribute(attributeName));
},
//Escape the attributes in a format that ServiceNow can
//create columns - some attributes contain space, colons and dots
_escapeAttribute : function (attribute) {
var _attribute = attribute;
//if using claims, sometimes the name may contain a url
//example: http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress
if(_attribute.indexOf("/")) {
var name = _attribute.split("/");
_attribute = name.pop() + '';
}
return _attribute.replace(/[ :.]/g,"_");
},
type: 'MultiSSO_SAML2_UserProvisioning' };
例如,复制以下代码作为 MultiSSO_SAML2_ImportSetUtilExtended 脚本:
var MultiSSO_SAML2_ImportSetUtilExtended = Class.create();
MultiSSO_SAML2_ImportSetUtilExtended.prototype = Object.extendsObject(ImportSetUtil, {
initialize : function() {
},
loadImportSetFromXML : function (xpath_root_node, xmlDoc, tableName) {
var attrs = new Packages.java.util.HashMap();
var nodeList = xmlDoc.getNodes(xpath_root_node);
this._iterateNodeList(nodeList, null, attrs);
// create or update the table schema
var tc = new GlideTableCreator(tableName, tableName);
tc.setExtends("sys_import_set_row");
tc.setColumnAttributes(attrs);
tc.update();
// second pass insert row
var gr = new GlideRecord(tableName);
gr.initialize();
var nodeList = xmlDoc.getNodes(xpath_root_node);
this._iterateNodeList(nodeList, null, null, gr);
gr.setWorkflow(true); //Important, otherwise Import SET will not be created!
return gr.insert();
},
type: 'MultiSSO_SAML2_ImportSetUtilExtended'
}); 例如,第 1 部分:找到以下代码段:
initialize: function() {
},
替换为以下代码:
initialize: function() {
/*Auto Provisioning changes */
this.nameIdOverride =
gs.getProperty("glide.authenticate.sso.saml2.nameid_policy_override", "");
/*Auto Provisioning changes */
},
例如,第 2 部分:找到以下代码段:
SNC.SecurityEventSender.sendSAMLRedirectReceivedEventData("", eventLogParm2);
if (!this.SAML2.validateLoginResponse(samlResponseObject, inResponseTo)) {
this.logError("Could not validate SAMLResponse");
SNC.SecurityEventSender.sendSAMLLoginFailureEventData("", eventLogParm2);
return "failed_authentication";
}
替换为以下代码:
SNC.SecurityEventSender.sendSAMLRedirectReceivedEventData("", eventLogParm2);
if (!this.SAML2.validateLoginResponse(samlResponseObject, inResponseTo)) {
this.logError("Could not validate SAMLResponse");
SNC.SecurityEventSender.sendSAMLLoginFailureEventData("", eventLogParm2);
return "failed_authentication";
}
/*Auto Provisioning changes */
var sup = new MultiSSO_SAML2_UserProvisioning
(this.SAML2.getDecodedSAMLResponse(request) + "");
//If NameID override is set, then use it
var nameId = this.nameIdOverride == "" ? this.SAML2.getSubjectNameID() :
sup.getAttributeValue(this.nameIdOverride);
/*Auto Provisioning changes */
例如,第 3 部分:找到以下代码段:
if(!SSO_Helper.isTestSAMLConnection()) { request.getSession().setAttribute
("glide.saml2.session_index", sessionIndex);
request.getSession().setAttribute("glide.saml2.session_id", nameId);
request.getSession().setAttribute("glide.multiSSO.logout_url", this.logoutURL);
request.getSession().setAttribute("glide.multiSSO.service_url", this.serviceURL);
}
替换为以下代码:
if(!SSO_Helper.isTestSAMLConnection()) {
request.getSession().setAttribute("glide.saml2.session_index", sessionIndex);
request.getSession().setAttribute("glide.saml2.session_id", nameId);
request.getSession().setAttribute("glide.multiSSO.logout_url", this.logoutURL);
request.getSession().setAttribute("glide.multiSSO.service_url", this.serviceURL);
}
/*Auto Provisioning changes */
this._action = action;
sup.loadImportSet(); action = this._action;
/*Auto Provisioning changes */ 例如,对每个用户使用以下值:
Wanderlust tenant
First Name : John
Last Name : Thomas
User Name : JTHOMAS
Email : john.thomas@wanderlust.com
ServiceNow
User ID : JTHOMAS
First name : John
Last name : Thomas
Email : john.thomas@wanderlust.com john.thomas@wanderlust.com 的电子邮件通知中的说明激活 Wanderlust 用户帐户。John Thomas。例如,输入以下值:
Name : Import SAML User
Source Table : Imp Saml User (u_imp_saml_user)
Active : [checked]
Run Business Rules : [unchecked]
Enforce Man Field : No
Copy Empty Fields : [unchecked]
Target Table : User (sys_user)
Order : 100
Run Script : [checked]
注:对于参数 Source Table,您应该可以选择 Imp Saml User 表,该表是导入集表。
例如,在 Script 域中复制以下代码:
//This is important for the first ever login, otherwise an empty user may be created until
//a Field Map is defined below
//It's recommended to use the same field for coalescing
//as defined in System Property: glide.authenticate.sso.saml2.user_field
if(action == "insert") {
//if no coalesce is set, then ignore insert
if(!coalesceIsSet()) {
ignore = true;
} else {
//Set random password for new users
var newPass = Math.random().toString(36).substr(2,16);
target.user_password = newPass;
}
}
//Returns true is coalesce field has been set for this transform map, false otherwise
function coalesceIsSet() {
var fieldMap = new GlideRecord("sys_transform_entry");
fieldMap.addQuery("map.name", "Import SAML User");
fieldMap.addQuery("coalesce", true);
fieldMap.query();
return fieldMap.hasNext();
}Import SAML User)添加字段映射。 例如,添加以下字段映射:
Source Field Target Field Coalesce
-------------- -------------- ------------
u_First_Name First Name
u_Last_Name Last Name
u_Email Email
u_User_Name User ID [checked]为了测试解决方案,我们将办理两个新 Acme 用户入职,一个是在 Wanderlust 子公司工作的员工,另一个是分配给 Greenenergy 的合同工。稍后,这些新用户将登录 IDCS,测试能否通过联合一次性登录访问相应的云应用。
例如,输入以下值办理一个新员工入职:
First Name : Peter
Last Name : Collins
Email : peter.collins@wanderlust.com
Organization : Wanderlust
User Type : Employee
Display Name : Peter Collins
User Login : PCOLLINS
Password : Oracle123

图 21.办理新用户入职
例如,输入以下值办理一个新的合同工入职:
First Name : Olivia
Last Name : Jackson
Email : olivia.jackson@greenenergy.com
Organization : Greenenergy
User Type : Contractor
Display Name : Olivia Jackson
User Login : OJACKSON
Password : Oracle123

图 22.通知和帐户激活

图 23.应用访问

图 24.访问 Salesforce 应用

图 25.访问 ServiceNow 应用
Oracle 身份云服务是基于多租户、微服务架构的解决方案,使用 OpenID Connect、OAuth 2.0、SAML 和 SCIM 等开放标准实现以云身份服务形式提供的核心身份和访问管理功能。在本文中,我们了解了混合环境中的一些供应功能以及与云应用的集成。
在未来几篇文章中,我将介绍 IDCS 的其他特性。这些特性让 IDCS 成为强大的多功能身份解决方案,面向希望实现可扩展业务、同时还在采用云的道路上支持创新的客户。
有关本文中所提到的产品和特性的其他参考资料,请参见以下链接:
Ricardo Gutierrez 是 Oracle 的资深 IT 顾问,致力于 IDaaS、CASB、身份和访问管理、身份分析、身份治理、企业 SSO、联合、特权帐户管理、数据库和应用安全。Ricardo 拥有超过 25 年使用多种技术的经验,最近 12 年从事 IBM、Microsoft 和 Oracle 的全套安全产品的工作。他还是 PMP、CCSP 和 VMware 认证专业人员,发表了一些有关安全和云计算的白皮书、文章和培训材料。