メインコンテンツまでスキップ

Permissions and access control

セッション・トークンや API キーを作成する際に、特定のネームスペース、キャッシュ・キー、キャッ シュ・キー接頭辞、およびトピックに対する権限を制限することができます。これは、permissions を使用することで可能になります。トークンを作成する際に、Scope オブジェクトでパーミッションのセットを定義します。トークンを作成すると、トークンはパーミッションスコープで指定されたキャッシュキーとトピックにのみアクセスできるようになり、特定の操作(読み取り、書き込み、公開、購読など)を実行できるようになります。ユーザーがパーミッションスコープの範囲外のアクションを実行しようとすると、403 Unauthorized というステータスコードが返されます。

Scope

APIキーとトークンは、リソースへのアクセスを制限するために、特定のパーミッション・セットにスコープすることができます。スコープオブジェクトにはキャッシュパーミッションとトピックパーミッションの両方が含まれます。

Attributes


permissions* array of Cache permission and Topic permission

A set of cache and/or topic permissions used to scope the token.


The Scope object
{
"permissions": [
{
"role": "readonly",
"cache": "data",
"item": {
"key": "foo"
}
},
{
"role": "subscribeonly",
"cache": "data",
"topic": "bar"
}
]
}

Cache permission

個々のキャッシュ・キー、キャッシュ・キーのプレフィックス、またはキャッシュ全体に対してパーミッションを作成できます。キャッシュ権限を作成するとき、ユーザはシステム定義の3つの役割のいずれかを選択します:

  • readwrite - キャッシュデータへのフルアクセスを提供
  • writeonly - 書き込み操作(setsortedSetIncrementScorelistPopFront など)へのアクセスを提供する。
  • readonly - 読み取り操作のみへのアクセスを提供する (getdictionaryFetchsetFetch など)。

Attributes


role* enum

The system-defined permission set for cache operations

Allowed values: readwrite, writeonly, readonly

cache* string

The namespace to scope permissions to


item object

Configuration to limit cache operations to specific keys.


The Cache permission object
{
"role": "readonly",
"cache": "myCache",
"item": {
"keyPrefix": "id-45-",
"key": "string"
}
}

Topic permission

与えられたネームスペース内の個別またはすべてのトピックに対してパーミッションを作成できます。トピック接頭辞はサポートされていません。トピック権限を作成する際、ユーザは 3 つのシステム定義の役割から 1 つを選択します:

  • publishsubscribe - トピックデータへのフルアクセスを提供
  • publishonly - 書き込み操作(publish)のみへのアクセスを提供する。
  • subscribeonly - 読み取り操作のみへのアクセスを提供する (subscribe)

Attributes


role* enum

The system-defined permission set for topic operations

Allowed values: subscribeonly, publishonly, publishsubscribe

cache* string

The namespace to scope permissions to


topic* string

The name of the specific topic to scope permissions to.


The Topic permission object
{
"role": "subscribeonly",
"cache": "myCache",
"topic": "test-topic"
}