Identity Providers & Federation (Part 2)
To read part 1, please click here
Using Web Identity Federation API Operations for Mobile Apps
Using Amazon Cognito as your identity broker offers best results for almost all identity federation scenarios. But, if you have already created an app that can use web identity federation by manually calling the AsumeRoleWithWebIdentity API, you can use it continuously and your apps will be fine. The process for using web identity federation without Amazon Cognito is as follows:
- Firstly, you have to sign-up as a developer with the external identity provider and configure your apps with the provider. You can also configure multiple apps with each provider.
- If you use an IdP other than Google, Facebook or Amazon Cognito compatible with OIDC, then create an IAM identity provider entity for it.
- In IAM, create one or more roles, and define roles and permissions the app's users have, for each role.
- After that, you have to authenticate your users with the IdP, in your app. However, how to perform this task might vary according to which identity you use and on which platform your app runs.
- Now, you can make an unsigned call to the AsumeRoleWithWebIdentity action in order to request temporary security credentials. After which, AWS verifies the authenticity of the token and returns temporary security credentials to your app that have the permissions for the role that you name in the request. The response also includes metadata about the user from the IdP, such as the unique user ID that the IdP associates with the user.
- While using the temporary security credentials from the AsumeRoleWithWebIdentity response, your app makes signed requests to AWS API operations. This allows you to create access control policies that can lock the folder so that only the user with that ID can access it.
- Your app should also be able cache the temporary security credentials so that you don't have to get the new ones each time the app needs to make a request to AWS. The credentials are good for about one hour by default and when they expires you have to call AssumeRoleWithWebIdentity a new set of temporary security credentials. However, if you use the AWS SDK for iOS or the AWS SDK for Android, you can take help of AmazonStSCredentialsProvider action, that can manage as well as refresh the IAM temporary credentials as required.
To read part 1, please click here
Comments
Post a Comment