2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

IBM Security Verify API で 複数ユーザーのアカウントを一括無効化する

Last updated at Posted at 2021-05-20

はじめに

IBM Security Verify(ISV) APIを利用して、複数ユーザーを1つのAPIリクエストで無効化する方法についてご紹介します。

APIのリファレンス

APIのリファレンスは、以下のURLから確認できます。
https://<自分のテナント名>.verify.ibm.com/developer/explorer/#

1.事前準備について

詳細は「IBM Security Verify API で ユーザーのアカウントを無効化する」をご参照ください。
https://qiita.com/fitz/items/7874a95245eea3ecef13

2.Bulk APIによるユーザーの無効化

ユーザー管理に関する複数のリクエストを一括実行するためには、/v2.0/Bulk APIを利用します。
bulkapi (1).png

POST/PATCH/DELETEなどのリクエストにより必要な値がかわるため、モデルをご確認ください。
bulkapi (2).png

/v2.0/Bulk APIには以下の制限があります。

The maximum number of operations is 1000 and the maximum payload size is 1048576

今回は/v2.0/Bulk APIを利用して2ユーザーを無効化します。

schemasの設定は、モデルの説明の通り"urn:ietf:params:scim:api:messages:2.0:BulkRequest"とします。

"schemas": [
        "urn:ietf:params:scim:api:messages:2.0:BulkRequest"
    ]

Operationsに、個々のユーザーを無効化するための内容を記載します。

  • "method"にはPOST/PATCH/DELETEなどリクエストの種類を指定します。
  • "path"に"/users/<無効化するユーザーのユーザーID>"を指定します。
  • "data"にデータ変更する内容を指定します。今回はActive属性をFalseに指定します。
"Operations": [
        {
            "method": "PATCH",
            "path": "/Users/64000xxxxx",
            "data": {
                "schemas": [
                    "urn:ietf:params:scim:api:messages:2.0:PatchOp"
                ],
                "Operations": [
                    {
                        "op": "replace",
                        "path": "active",
                        "value": false
                    }
                ]
            }
        },
        {
            "method": "PATCH",
            "path": "/Users/65000xxxxx",
            "data": {
                "schemas": [
                    "urn:ietf:params:scim:api:messages:2.0:PatchOp"
                ],
                "Operations": [
                    {
                        "op": "replace",
                        "path": "active",
                        "value": false
                    }
                ]
            }
        }
    ]

実行するリクエストは以下のような形になります。

curl -X POST https://<テナント名>.verify.ibm.com/v2.0/Bulk  --header "Content-Type: application/scim+json" --header "Authorization: Bearer <アクセストークン>" --data-raw "{\"schemas\":[\"urn:ietf:params:scim:api:messages:2.0:BulkRequest\"],\"Operations\":[{\"method\":\"PATCH\",\"path\":\"/Users/<userid>\",\"data\":{\"schemas\":[\"urn:ietf:params:scim:api:messages:2.0:PatchOp\"],\"Operations\":[{\"op\":\"replace\",\"path\":\"active\",\"value\":false}]}},{\"method\":\"PATCH\",\"path\":\"/Users/<userid>\",\"data\":{\"schemas\":[\"urn:ietf:params:scim:api:messages:2.0:PatchOp\"],\"Operations\":[{\"op\":\"replace\",\"path\":\"active\",\"value\":false}]}}]}"

Bulk APIで実行したリクエストの結果は、リクエスト単位で表示されます。
bulkapi (3) .png

最後に

IBM Security VerifyのBulk APIを利用してアカウントを一括無効化する方法についてご紹介しました。

2
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?