AWS SSO のユーザをSCIMでプロビジョニングする。

事前準備

SSOのための ENDPOINTとTOKENを取得しておく。

ユーザ作成

<Endpoint>/Users
 -H"Authorization: Bearer <Token>"
 -H"Content-type: application/json" -d'
    {  "schemas": [
        "urn:ietf:params:scim:schemas:core:2.0:User"
      ],
"userName": "EmailAddress",
"displayName": "displayName",
      "name": {
        "familyName": "familyName",
        "givenName": "givenName"
      },
    "active": true
}'

グループ作成

<Endpoint>/Groups
 -H"Authorization: Bearer <Token>"
 -H"Content-type: application/json" -d'
{"schemas": [
        "urn:ietf:params:scim:schemas:core:2.0:Group"
      ],
      "displayName": "GroupName",
      "members": []
}'

グループメンバー更新(メンバー一覧をreplaceする。)

グループ情報を拾っても、現在のメンバー一覧が取得できないため、メンバー一覧をreplaceでまるっと入れ替える。

<Endpoint>/Groups/<group-id>
-XPATCH
 -H"Authorization: Bearer <Token>"
 -H"Content-type: application/json" -d'
{
  "schemas": [
    "urn:ietf:params:scim:api:messages:2.0:PatchOp"
  ],
  "Operations": [
    {
      "op": "replace",
      "path": "members",
      "value": [
        { "value": "<User-id>"},
        { "value": "<User-id>"},
        { "value": "<User-id>"},
        { "value": "<User-id>"}
      ]
    }
  ]
}'