Liberty 概要文件中的 SCIM 操作

跨域身份管理系统 (SCIM) 1.1 规范在 Liberty 中受支持。

检索资源

WebSphere Application Server Liberty 支持 SCIM 1.1 规范。有关此规范的更多信息,请参阅http://www.simplecloud.info/

要检索已知资源,必须将 GET 请求发送至所配置 HTTP 端点。例如,/Users/{id} 或 /Groups/{id}

以下示例显示针对 LDAP 注册表的操作。
    <ldapRegistry id="LDAP1" realm="SampleLdapIDSRealm" host="9.127.1.90" port="1389" ignoreCase="true"
        baseDN="o=ibm,c=us" ldapType="IBM Tivoli Directory Server" searchTimeout="8m" recursiveSearch="true"
        bindDN="xxxxxx" bindPassword="xxxxxxx">
	    <ldapEntityType name="PersonAccount">
	        <rdnProperty name="uid" objectClass="inetOrgPerson"/>
                <objectClass>inetOrgPerson</objectClass>
            </ldapEntityType>
            <ldapEntityType name="Group">
	        <objectClass>groupofnames</objectClass>
		<objectClass>ibm-nestedGroup</objectClass>
		  <rdnProperty name="cn" objectClass="groupofnames"/>
	    </ldapEntityType>
    <attributeConfiguration>
        <attribute name="title" propertyName="honorificPrefix" syntax="String" entityType="PersonAccount">
        </attribute>
	<attribute name="initials" propertyName="middleName" syntax="String" entityType="PersonAccount">
        </attribute>
	<attribute name="st" propertyName="honorificSuffix" syntax="String" entityType="PersonAccount">
        </attribute>
	<attribute name="l" propertyName="homeStateOrProvinceName" syntax="String" entityType="PersonAccount">
        </attribute>
	<attribute name="street" propertyName="homeStreet" syntax="String" entityType="PersonAccount">
        </attribute>
	<attribute name="postalAddress" propertyName="homeCity" syntax="String" entityType="PersonAccount">
        </attribute>
	<attribute name="postalCode" propertyName="homePostalCode" syntax="String" entityType="PersonAccount">
        </attribute>
       <attribute name="postOfficeBox" propertyName="homeCountryName" syntax="String" entityType="PersonAccount">
        </attribute>
        <attribute name="departmentNumber" propertyName="photoURLThumbnail" syntax="String" entityType="PersonAccount">
        </attribute>
	<attribute name="description" propertyName="photoURL" syntax="String" entityType="PersonAccount">
        </attribute>
    </attributeConfiguration>
    <groupProperties>
        <memberAttribute name="member" dummyMember="uid=dummy" objectClass="groupOfNames" scope="direct"/>
	<memberAttribute name="ibm-memberGroup" objectClass="ibm-nestedGroup" scope="direct"/>
    </groupProperties> 
</ldapRegistry>
要从 LDAP 检索资源,必须将 GET 请求作为 https://localhost:9090/ibm/api/scim/Users/uid=jsmith,o=ibm,c=us 发送。

查询资源

要查询资源,必须将 GET 请求发送至所配置 HTTP 端点并指定过滤器以进行搜索。还可指定 attributes 参数以从所返回资源返回值子集,并指定分页和排序参数以组织所返回资源。以下示例显示一些过滤器选项:
  • 指定参数以检索值子集:例如中,https://localhost:9090/ibm/api/scim/Users?filter=givenname sw "Jo" 检索名称以“Jo” 开头的所有用户。
  • 指定 attributes 参数以检索值子集:例如,https://localhost:9090/ibm/api/scim/Users?filter=givenname sw "Jo"&attributes=username,emails&filter=name.familyname eq "Smith" 检索名字以“Jo”开头并且姓氏为“Smith”的用户名的电子邮件地址。
  • 指定分页和排序参数以检索所组织资源。例如,https://localhost:9090/ibm/api/scim/Users?filter=givenname sw "Jo"&attributes=username&sortBy=username&startIndex=3&count=5 检索已排序结果的第三页,每页包含 5 个用户名,这些用户名以“Jo”开头并且姓氏为“Smith”
注释:
  • 底层联合存储库确定过滤器中指定的值是否区分大小写。对于 LDAP,这些值在缺省情况下不区分大小写,除非该属性映射至区分大小写的 LDAP 属性。
  • 不能在搜索过滤器中使用用户名。
  • 联合不支持 SCIM 属性的基本注册表、SAF 注册表或定制注册表时,将始终针对用户名搜索过滤器模式,并且仅返回用户名属性。

创建资源

要创建新资源,必须将 POST 请求发送至资源端点,即 UsersGroups。POST 内容必须包含用户 json 对象,并且 HTTP 头 content-type 必须设置为 application/json
注: application/xml 内容类型不受支持。
要创建用户,必须将以下请求发布至 https://localhost:9090/ibm/api/scim/Users Content-Type
Content-Type: application/json
Content-Length: ...

{
  "schemas":["urn:scim:schemas:core:1.0"],
  "userName":"bjensen",
  "externalId": "uid=bjensen,o=ibm,c=us",
  "name":{
    "familyName":"Jensen",
    "givenName":"Barbara"
  }
}

请求必须包含在用户注册表中成功创建用户或组所需的全部属性。例如,在后端 Tivoli Directory Server LDAP 中,创建用户所需的基本 LDAP 属性集将为 uid、sn 和 cn;所以,任何创建用户的请求必须包含 userNamegivenNamefamilyName。如果用户注册表中存在任何模式违例,那么创建操作将失败。

externalId 属性将充当标识,并且必须指定。属性格式依赖于后端用户注册表的规范。在先前示例中,后端为 LDAP 服务器,且其 baseEntry 设置为 o=ibm,c=us,用户的 RDN 属性设置为 UID,所以 externalId 变为 uid=bjensen,o=ibm,c=us

根据创建请求,将返回所创建用户对象。
{
    "schemas":["urn:scim:schemas:core:1.0"],
    "id":"uid=bjensen,o=ibm,c=us",
    "userName":"bjensen",
    "externalId":"uid=bjensen,o=ibm,c=us",
    "name":{
          "formatted":"Barbara Jensen",
          "familyName":"Jensen",
          "givenName":"Barbara"
    },
    "meta":{
         "lastModified":"2015-09-15T14:30:11",        "location":"https:\\localhost:9090\ibm\api\scim\Users\uid=bjensen,o=ibm,c=us",
         "created":"2015-09-15T14:30:11"
    }
}
如果配置了多个 LDAP 并且需要调用创建操作,那么必须对实体定义缺省父代。所定义父代指定将在其下创建新实体的基本条目。以下示例显示 PersonAccount 的缺省父代的配置。
<federatedRepository>
    <primaryRealm name="WIMRegistry">
        <participatingBaseEntry name="o=ibm,c=us"/>
        <participatingBaseEntry name="o=ldap"/>
    	</primaryRealm>
    <supportedEntityType>
        <defaultParent>o=ldap</defaultParent>
        <name>PersonAccount</name>
    </supportedEntityType>
</federatedRepository>

修改资源

要修改资源,您需要将 PUT 请求发送至资源端点,即 /Users/Groups。PUT 请求执行资源的完整更新。输入中未指定的任何属性将被删除。
注: 使用 PATCH 进行的部分更新不受支持。
要修改先前创建的资源,必须将以下请求发布至 https://localhost:9090/ibm/api/scim/Users/uid=bjensen,o=ibm,c=us
Content-Type: application/json
Content-Length: ...

{
  "schemas":["urn:scim:schemas:core:1.0"],
  "userName":"bjensen",
  "externalId":"uid=bjensen,o=ibm,c=us",
  "name":{
    "familyName":"Jensen",
    "givenName":"Barb"
  }
}
此请求将对象的给定名称从 Barbara 修改为 Barb。URL 中指定的标识必须与用户对象中指定的 externalId 匹配。
要修改组 cn=employeeGroup,o=ibm,c=us 并更改组成员资格,需要指定成员属性。
Content-Type: application/json
Content-Length: ...
{
    "id":"cn=employeeGroup,o=ibm,c=us",
    "schemas":["urn:scim:schemas:core:1.0"],
    "displayName":"employeeGroup",
    "externalId":"cn=employeeGroup,o=ibm,c=us",
    "members":[{"value":"uid=bjensen,o=ibm,c=us", "type":"User"},{"value":"cn=consultants,o=ibm,c=us", "type":"Group"}]
}
要修改组 cn=employeeGroup,o=ibm,c=us 并移除组中的所有成员,需要指定空成员属性。
Content-Type: application/json
Content-Length: ...
{
    "id":"cn=employeeGroup,o=ibm,c=us",
    "schemas":["urn:scim:schemas:core:1.0"],
    "displayName":"employeeGroup",
    "externalId":"cn=employeeGroup,o=ibm,c=us",
    "members":[]
}

删除资源

要删除资源,需要将 DELETE 请求发送至资源端点,即 /Users/Groups。例如,要删除先前示例中创建的用户 uid=bjensen,o=ibm,c=us,请将请求发送至 https://localhost:9090/ibm/api/scim/Users/uid=bjensen,o=ibm,c=us
注: SCIM 仅在 Java 7 或更高版本上运行。

用于指示主题类型的图标 参考主题



时间戳记图标 最近一次更新时间: Monday, 5 December 2016
http://www14.software.ibm.com/webapp/wsbroker/redirect?version=cord&product=was-libcore-mp&topic=rwlp_sec_scim_operations
文件名:rwlp_sec_scim_operations.html