public class GetFederationTokenRequest extends AmazonWebServiceRequest implements Serializable
GetFederationToken operation
.
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
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
AssumeRoleWithWebIdentity
.
The GetFederationToken
action must be called by using the
long-term AWS security credentials of an IAM user. You can also call
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
GetFederationToken
are determined by a combination of the
following:
GetFederationToken
.
The passed policy is attached to the temporary security credentials
that result from the 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 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 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 GetFederationToken
to create temporary security credentials, see Creating Temporary Credentials to Enable Access for Federated Users
in Using Temporary Security Credentials .
NOOP
Constructor and Description |
---|
GetFederationTokenRequest()
Default constructor for a new GetFederationTokenRequest object.
|
GetFederationTokenRequest(String name)
Constructs a new GetFederationTokenRequest object.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj) |
Integer |
getDurationSeconds()
The duration, in seconds, that the session should last.
|
String |
getName()
The name of the federated user.
|
String |
getPolicy()
An IAM policy in JSON format that is passed with the
GetFederationToken call and evaluated along with the
policy or policies that are attached to the IAM user whose credentials
are used to call GetFederationToken . |
int |
hashCode() |
void |
setDurationSeconds(Integer durationSeconds)
The duration, in seconds, that the session should last.
|
void |
setName(String name)
The name of the federated user.
|
void |
setPolicy(String policy)
An IAM policy in JSON format that is passed with the
GetFederationToken call and evaluated along with the
policy or policies that are attached to the IAM user whose credentials
are used to call GetFederationToken . |
String |
toString()
Returns a string representation of this object; useful for testing and
debugging.
|
GetFederationTokenRequest |
withDurationSeconds(Integer durationSeconds)
The duration, in seconds, that the session should last.
|
GetFederationTokenRequest |
withName(String name)
The name of the federated user.
|
GetFederationTokenRequest |
withPolicy(String policy)
An IAM policy in JSON format that is passed with the
GetFederationToken call and evaluated along with the
policy or policies that are attached to the IAM user whose credentials
are used to call GetFederationToken . |
copyPrivateRequestParameters, getGeneralProgressListener, getRequestClientOptions, getRequestCredentials, getRequestMetricCollector, setGeneralProgressListener, setRequestCredentials, setRequestMetricCollector, withGeneralProgressListener, withRequestMetricCollector
public GetFederationTokenRequest()
public GetFederationTokenRequest(String name)
name
- The name of the federated user. The name is used as an
identifier for the temporary security credentials (such as
Bob
). For example, you can reference the federated user
name in a resource-based policy, such as in an Amazon S3 bucket
policy.public String getName()
Bob
). For
example, you can reference the federated user name in a resource-based
policy, such as in an Amazon S3 bucket policy.
Constraints:
Length: 2 - 32
Pattern: [\w+=,.@-]*
Bob
). For
example, you can reference the federated user name in a resource-based
policy, such as in an Amazon S3 bucket policy.public void setName(String name)
Bob
). For
example, you can reference the federated user name in a resource-based
policy, such as in an Amazon S3 bucket policy.
Constraints:
Length: 2 - 32
Pattern: [\w+=,.@-]*
name
- The name of the federated user. The name is used as an identifier for
the temporary security credentials (such as Bob
). For
example, you can reference the federated user name in a resource-based
policy, such as in an Amazon S3 bucket policy.public GetFederationTokenRequest withName(String name)
Bob
). For
example, you can reference the federated user name in a resource-based
policy, such as in an Amazon S3 bucket policy.
Returns a reference to this object so that method calls can be chained together.
Constraints:
Length: 2 - 32
Pattern: [\w+=,.@-]*
name
- The name of the federated user. The name is used as an identifier for
the temporary security credentials (such as Bob
). For
example, you can reference the federated user name in a resource-based
policy, such as in an Amazon S3 bucket policy.public String getPolicy()
GetFederationToken
call and evaluated along with the
policy or policies that are attached to the IAM user whose credentials
are used to call GetFederationToken
. The passed policy is
used to scope down the permissions that are available to the IAM user,
by allowing only a subset of the permissions that are granted to the
IAM user. The passed policy cannot grant more permissions than those
granted to the IAM user. The final permissions for the federated user
are the most restrictive set based on the intersection of the passed
policy and the IAM user policy. 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.
Constraints:
Length: 1 - 2048
Pattern: [\u0009\u000A\u000D\u0020-\u00FF]+
GetFederationToken
call and evaluated along with the
policy or policies that are attached to the IAM user whose credentials
are used to call GetFederationToken
. The passed policy is
used to scope down the permissions that are available to the IAM user,
by allowing only a subset of the permissions that are granted to the
IAM user. The passed policy cannot grant more permissions than those
granted to the IAM user. The final permissions for the federated user
are the most restrictive set based on the intersection of the passed
policy and the IAM user policy. 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.
public void setPolicy(String policy)
GetFederationToken
call and evaluated along with the
policy or policies that are attached to the IAM user whose credentials
are used to call GetFederationToken
. The passed policy is
used to scope down the permissions that are available to the IAM user,
by allowing only a subset of the permissions that are granted to the
IAM user. The passed policy cannot grant more permissions than those
granted to the IAM user. The final permissions for the federated user
are the most restrictive set based on the intersection of the passed
policy and the IAM user policy. 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.
Constraints:
Length: 1 - 2048
Pattern: [\u0009\u000A\u000D\u0020-\u00FF]+
policy
- An IAM policy in JSON format that is passed with the
GetFederationToken
call and evaluated along with the
policy or policies that are attached to the IAM user whose credentials
are used to call GetFederationToken
. The passed policy is
used to scope down the permissions that are available to the IAM user,
by allowing only a subset of the permissions that are granted to the
IAM user. The passed policy cannot grant more permissions than those
granted to the IAM user. The final permissions for the federated user
are the most restrictive set based on the intersection of the passed
policy and the IAM user policy. 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.
public GetFederationTokenRequest withPolicy(String policy)
GetFederationToken
call and evaluated along with the
policy or policies that are attached to the IAM user whose credentials
are used to call GetFederationToken
. The passed policy is
used to scope down the permissions that are available to the IAM user,
by allowing only a subset of the permissions that are granted to the
IAM user. The passed policy cannot grant more permissions than those
granted to the IAM user. The final permissions for the federated user
are the most restrictive set based on the intersection of the passed
policy and the IAM user policy. 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.
Returns a reference to this object so that method calls can be chained together.
Constraints:
Length: 1 - 2048
Pattern: [\u0009\u000A\u000D\u0020-\u00FF]+
policy
- An IAM policy in JSON format that is passed with the
GetFederationToken
call and evaluated along with the
policy or policies that are attached to the IAM user whose credentials
are used to call GetFederationToken
. The passed policy is
used to scope down the permissions that are available to the IAM user,
by allowing only a subset of the permissions that are granted to the
IAM user. The passed policy cannot grant more permissions than those
granted to the IAM user. The final permissions for the federated user
are the most restrictive set based on the intersection of the passed
policy and the IAM user policy. 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.
public Integer getDurationSeconds()
Constraints:
Range: 900 - 129600
public void setDurationSeconds(Integer durationSeconds)
Constraints:
Range: 900 - 129600
durationSeconds
- The duration, in seconds, that the session should last. Acceptable
durations for federation sessions range from 900 seconds (15 minutes)
to 129600 seconds (36 hours), with 43200 seconds (12 hours) as the
default. Sessions obtained using AWS account (root) credentials are
restricted to a maximum of 3600 seconds (one hour). If the specified
duration is longer than one hour, the session obtained by using AWS
account (root) credentials defaults to one hour.public GetFederationTokenRequest withDurationSeconds(Integer durationSeconds)
Returns a reference to this object so that method calls can be chained together.
Constraints:
Range: 900 - 129600
durationSeconds
- The duration, in seconds, that the session should last. Acceptable
durations for federation sessions range from 900 seconds (15 minutes)
to 129600 seconds (36 hours), with 43200 seconds (12 hours) as the
default. Sessions obtained using AWS account (root) credentials are
restricted to a maximum of 3600 seconds (one hour). If the specified
duration is longer than one hour, the session obtained by using AWS
account (root) credentials defaults to one hour.public String toString()
toString
in class Object
Object.toString()
Copyright © 2014. All rights reserved.