AWS SDK for .NET Documentation
GetFederationToken Method (request)
AmazonAmazon.SecurityTokenAmazonSecurityTokenServiceGetFederationToken(GetFederationTokenRequest) Did this page help you?   Yes   No    Tell us about it...
Returns a set of temporary security credentials (consisting of an access key ID, a secret access key, and a security token) for a federated user. A typical use is in a proxy application that gets temporary security credentials on behalf of distributed applications inside a corporate network. Because you must call the
CopyC#
GetFederationToken
action using the long-term security credentials of an IAM user, this call is appropriate in contexts where those credentials can be safely stored, usually in a server-based application.

Note: Do not use this call in mobile applications or client-based web applications that directly get temporary security credentials. For those types of applications, use

CopyC#
AssumeRoleWithWebIdentity
.

The

CopyC#
GetFederationToken
action must be called by using the long-term AWS security credentials of an IAM user. You can also call
CopyC#
GetFederationToken
using the security credentials of an AWS account (root), but this is not recommended. Instead, we recommend that you create an IAM user for the purpose of the proxy application and then attach a policy to the IAM user that limits federated users to only the actions and resources they need access to. For more information, see IAM Best Practices in Using IAM.

The temporary security credentials that are obtained by using the long-term credentials of an IAM user are valid for the specified duration, between 900 seconds (15 minutes) and 129600 seconds (36 hours). Temporary credentials that are obtained by using AWS account (root) credentials have a maximum duration of 3600 seconds (1 hour)

Permissions

The permissions for the temporary security credentials returned by

CopyC#
GetFederationToken
are determined by a combination of the following:

The passed policy is attached to the temporary security credentials that result from the

CopyC#
GetFederationToken
API call--that is, to the federated user. When the federated user makes an AWS request, AWS evaluates the policy attached to the federated user in combination with the policy or policies attached to the IAM user whose credentials were used to call
CopyC#
GetFederationToken
. AWS allows the federated user's request only when both the federated user and the IAM user are explicitly allowed to perform the requested action. The passed policy cannot grant more permissions than those that are defined in the IAM user policy.

A typical use case is that the permissions of the IAM user whose credentials are used to call

CopyC#
GetFederationToken
are designed to allow access to all the actions and resources that any federated user will need. Then, for individual users, you pass a policy to the operation that scopes down the permissions to a level that's appropriate to that individual user, using a policy that allows only a subset of permissions that are granted to the IAM user.

If you do not pass a policy, the resulting temporary security credentials have no effective permissions. The only exception is when the temporary security credentials are used to access a resource that has a resource-based policy that specifically allows the federated user to access the resource.

For more information about how permissions work, see Permissions for GetFederationToken in Using Temporary Security Credentials. For information about using

CopyC#
GetFederationToken
to create temporary security credentials, see Creating Temporary Credentials to Enable Access for Federated Users in Using Temporary Security Credentials.

Declaration Syntax
Parameters
request (GetFederationTokenRequest)
Container for the necessary parameters to execute the GetFederationToken service method.
Return Value
The response from the GetFederationToken service method, as returned by SecurityTokenService.
Exceptions
ExceptionCondition
MalformedPolicyDocumentException The request was rejected because the policy document was malformed. The error message describes the specific error.
PackedPolicyTooLargeException The request was rejected because the policy document was too large. The error message describes how big the policy document is, in packed form, as a percentage of what the API allows.

Assembly: AWSSDK (Module: AWSSDK) Version: 1.5.60.0 (1.5.60.0)