OBS can be accessed through temporary access keys and the security token, which can be obtained on IAM. You can assign the temporary access keys (including the security token) to a third-party application and an IAM user, so they can access OBS within a specified period of time.
You can obtain the temporary access keys and security token by calling the IAM API in Obtaining a Temporary AK/SK.
Temporary AK/SK and security token comply with the least privilege principle and can be used to temporarily access OBS. When you use a temporary AK/SK pair to call an API for authentication, you must use the temporary AK/SK and security token at the same time and add the x-obs-security-token field to the request header.
Temporary access keys have the following advantages over permanent access keys of IAM users:
For details, see Authenticating a Request.
When an IAM user calls the IAM API in Obtaining a Temporary AK/SK, the user can specify parameter policy to add a temporary policy for the temporary access keys to further restrict the permissions granted to other users. The format and content of a temporary policy are consistent with those specified in IAM Permissions.
As shown in the following figure, circle 1 indicates the original permissions of an IAM user, and circle 2 indicates the temporary permissions specified by a temporary policy. The overlapped part 3 is the scope of permissions enabled by the temporary access keys.
Temporary access keys comply with the least privilege principle. Configure a temporary policy within the original permission scope of an IAM user. Otherwise you may be confused about why permissions enabled by a temporary policy are not effective. As illustrated by the following figure, the finally effective permissions are the authorized temporary permissions.
A temporary policy authentication starts from the Deny statements. Unspecified permissions are denied by default.
Therefore, you are advised to specify only the allowed permission.
Temporary access keys are used to authorize third parties to temporarily access OBS. For example, some companies have their user management systems, which manage device app users and local enterprise users. These users do not have IAM user permissions, so IAM users can grant temporary access keys to these users when they need to access OBS.
Typical application scenario:
A company has a large number of device apps that need to access OBS. Different apps represent different end users who require different access permissions. In this case, temporary access keys can be used to access OBS.
IAM users can obtain the temporary access keys and security token by calling the IAM API in Obtaining a Temporary AK/SK. When calling this API, pass the policy parameter to set a temporary policy. An example is provided as follows:
{ "auth": { "identity": { "methods": [ ... ... ], "policy": { ... ... } } } }
The policy's syntax and format are the same as those specified in IAM Permissions.
For details, see Granting Temporary Access to OBS.