Skip to main content

AssumeRoleWithWebIdentity

Table of Contents

Introduction

Calling AssumeRoleWithWebIdentity does not require the use of MinIO default credentials. Therefore, you can distribute an application (for example, on mobile devices) that requests temporary security credentials without including MinIO default credentials in the application. Instead, the identity of the caller is validated by using a JWT access token from the web identity provider. The temporary security credentials returned by this API consists of an access key, a secret key, and a security token. Applications can use these temporary security credentials to sign calls to MinIO API operations. By default, the temporary security credentials created by AssumeRoleWithWebIdentity last for one hour. However, use the optional DurationSeconds parameter to specify the duration of the credentials. This value varies from 900 seconds (15 minutes) up to the maximum session duration of 7 days.

API Request Parameters

WebIdentityToken

The OAuth 2.0 access token that is provided by the web identity provider. Application must get this token by authenticating the user who is using your application with a web identity provider before the application makes an AssumeRoleWithWebIdentity call.

Version

Indicates STS API version information, the only supported value is ‘2011-06-15’. This value is borrowed from AWS STS API documentation for compatibility reasons.

DurationSeconds

The duration, in seconds. The value can range from 900 seconds (15 minutes) up to 7 days. If value is higher than this setting, then operation fails. By default, the value is set to 3600 seconds. If no DurationSeconds is specified expiry seconds is obtained from WebIdentityToken.

Policy

An IAM policy in JSON format that you want to use as an inline session policy. This parameter is optional. Passing policies to this operation returns new temporary credentials. The resulting session’s permissions are the intersection of the canned policy name and the policy set here. You cannot use this policy to grant more permissions than those allowed by the canned policy name being assumed.

Response Elements

XML response for this API is similar to AWS STS AssumeRoleWithWebIdentity

Errors

XML error response for this API is similar to AWS STS AssumeRoleWithWebIdentity

Sample POST Request

Sample Response

Using WebIdentity API

or using mc
Testing with an example
Visit Google Developer Console under Project, APIs, Credentials to get your OAuth2 client credentials. Add http://localhost:8080/oauth2/callback as a valid OAuth2 Redirect URL.
NOTE: for a reasonable test outcome, make sure the assumed user has at least permission/policy to list all buckets. That policy would look like below:

Authorization Flow

  • Visit http://localhost:8080, login will direct the user to the Google OAuth2 Auth URL to obtain a permission grant.
  • The redirection URI (callback handler) receives the OAuth2 callback, verifies the state parameter, and obtains a Token.
  • Using the access token the callback handler further talks to Google OAuth2 Token URL to obtain an JWT id_token.
  • Once obtained the JWT id_token is further sent to STS endpoint i.e MinIO to retrive temporary credentials.
  • Temporary credentials are displayed on the browser upon successful retrieval.

Using MinIO Browser

To support WebIdentity login on MinIO Browser, set openid configuration and restart MinIO
Sample URLs for Keycloak are config_url - http://localhost:8080/auth/realms/demo/.well-known/openid-configuration JWT token returned by the Identity Provider should include a custom claim for the policy, this is required to create a STS user in MinIO. The name of the custom claim could be either policy or <NAMESPACE_PREFIX>policy. If there is no namespace then claim_prefix can be ingored. For example if the custom claim name is https://min.io/policy then, claim_prefix should be set as https://min.io/.
  • Open MinIO Browser and click Log in with OpenID
  • Enter the Client ID obtained from Identity Provider and press ENTER, if not you can set a client_id on server to avoid this step.
  • The user will be redirected to the Identity Provider login page
  • Upon successful login on Identity Provider page the user will be automatically logged into MinIO Browser

Explore Further