amazonka-sts-1.5.0: Amazon Security Token Service SDK.

Copyright(c) 2013-2017 Brendan Hay
LicenseMozilla Public License, v. 2.0.
MaintainerBrendan Hay <brendan.g.hay+amazonka@gmail.com>
Stabilityauto-generated
Portabilitynon-portable (GHC extensions)
Safe HaskellNone
LanguageHaskell2010

Network.AWS.STS.GetFederationToken

Contents

Description

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. For a comparison of GetFederationToken with the other APIs that produce temporary credentials, see Requesting Temporary Security Credentials and Comparing the AWS STS APIs in the IAM User Guide .

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 root account, but we do not recommended it. 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 that they need access to. For more information, see IAM Best Practices in the IAM User Guide .

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

The temporary security credentials created by GetFederationToken can be used to make API calls to any AWS service with the following exceptions:

  • You cannot use these credentials to call any IAM APIs.
  • You cannot call any STS APIs except GetCallerIdentity .

Permissions

The permissions for the temporary security credentials returned by GetFederationToken are determined by a combination of the following:

  • The policy or policies that are attached to the IAM user whose credentials are used to call GetFederationToken .
  • The policy that is passed as a parameter in the call.

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 . For information about using GetFederationToken to create temporary security credentials, see GetFederationToken—Federation Through a Custom Identity Broker .

Synopsis

Creating a Request

getFederationToken Source #

Creates a value of GetFederationToken with the minimum fields required to make a request.

Use one of the following lenses to modify other fields as desired:

  • gftDurationSeconds - 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.
  • gftPolicy - 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. The format for this parameter, as described by its regex pattern, is a string of characters up to 2048 characters in length. The characters can be any ASCII character from the space character to the end of the valid character list (u0020-u00FF). It can also include the tab (u0009), linefeed (u000A), and carriage return (u000D) characters. For more information about how permissions work, see Permissions for GetFederationToken .
  • gftName - 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. The regex used to validate this parameter is a string of characters consisting of upper- and lower-case alphanumeric characters with no spaces. You can also include underscores or any of the following characters: =,.@-

data GetFederationToken Source #

See: getFederationToken smart constructor.

Instances

Eq GetFederationToken Source # 
Data GetFederationToken Source # 

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> GetFederationToken -> c GetFederationToken #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c GetFederationToken #

toConstr :: GetFederationToken -> Constr #

dataTypeOf :: GetFederationToken -> DataType #

dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c GetFederationToken) #

dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c GetFederationToken) #

gmapT :: (forall b. Data b => b -> b) -> GetFederationToken -> GetFederationToken #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> GetFederationToken -> r #

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> GetFederationToken -> r #

gmapQ :: (forall d. Data d => d -> u) -> GetFederationToken -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> GetFederationToken -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> GetFederationToken -> m GetFederationToken #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> GetFederationToken -> m GetFederationToken #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> GetFederationToken -> m GetFederationToken #

Read GetFederationToken Source # 
Show GetFederationToken Source # 
Generic GetFederationToken Source # 
Hashable GetFederationToken Source # 
NFData GetFederationToken Source # 

Methods

rnf :: GetFederationToken -> () #

AWSRequest GetFederationToken Source # 
ToQuery GetFederationToken Source # 
ToPath GetFederationToken Source # 
ToHeaders GetFederationToken Source # 
type Rep GetFederationToken Source # 
type Rep GetFederationToken = D1 (MetaData "GetFederationToken" "Network.AWS.STS.GetFederationToken" "amazonka-sts-1.5.0-1TsRqghBsTWDbeeJJE5QJN" False) (C1 (MetaCons "GetFederationToken'" PrefixI True) ((:*:) (S1 (MetaSel (Just Symbol "_gftDurationSeconds") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 (Maybe Nat))) ((:*:) (S1 (MetaSel (Just Symbol "_gftPolicy") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 (Maybe Text))) (S1 (MetaSel (Just Symbol "_gftName") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 Text)))))
type Rs GetFederationToken Source # 

Request Lenses

gftDurationSeconds :: Lens' GetFederationToken (Maybe Natural) Source #

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.

gftPolicy :: Lens' GetFederationToken (Maybe Text) Source #

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. The format for this parameter, as described by its regex pattern, is a string of characters up to 2048 characters in length. The characters can be any ASCII character from the space character to the end of the valid character list (u0020-u00FF). It can also include the tab (u0009), linefeed (u000A), and carriage return (u000D) characters. For more information about how permissions work, see Permissions for GetFederationToken .

gftName :: Lens' GetFederationToken Text Source #

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. The regex used to validate this parameter is a string of characters consisting of upper- and lower-case alphanumeric characters with no spaces. You can also include underscores or any of the following characters: =,.@-

Destructuring the Response

getFederationTokenResponse Source #

Creates a value of GetFederationTokenResponse with the minimum fields required to make a request.

Use one of the following lenses to modify other fields as desired:

  • gftrsPackedPolicySize - A percentage value indicating the size of the policy in packed form. The service rejects policies for which the packed size is greater than 100 percent of the allowed value.
  • gftrsCredentials - The temporary security credentials, which include an access key ID, a secret access key, and a security (or session) token. Note: The size of the security token that STS APIs return is not fixed. We strongly recommend that you make no assumptions about the maximum size. As of this writing, the typical size is less than 4096 bytes, but that can vary. Also, future updates to AWS might require larger sizes.
  • gftrsFederatedUser - Identifiers for the federated user associated with the credentials (such as arn:aws:sts::123456789012:federated-user/Bob or 123456789012:Bob ). You can use the federated user's ARN in your resource-based policies, such as an Amazon S3 bucket policy.
  • gftrsResponseStatus - -- | The response status code.

data GetFederationTokenResponse Source #

Contains the response to a successful GetFederationToken request, including temporary AWS credentials that can be used to make AWS requests.

See: getFederationTokenResponse smart constructor.

Instances

Eq GetFederationTokenResponse Source # 
Data GetFederationTokenResponse Source # 

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> GetFederationTokenResponse -> c GetFederationTokenResponse #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c GetFederationTokenResponse #

toConstr :: GetFederationTokenResponse -> Constr #

dataTypeOf :: GetFederationTokenResponse -> DataType #

dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c GetFederationTokenResponse) #

dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c GetFederationTokenResponse) #

gmapT :: (forall b. Data b => b -> b) -> GetFederationTokenResponse -> GetFederationTokenResponse #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> GetFederationTokenResponse -> r #

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> GetFederationTokenResponse -> r #

gmapQ :: (forall d. Data d => d -> u) -> GetFederationTokenResponse -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> GetFederationTokenResponse -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> GetFederationTokenResponse -> m GetFederationTokenResponse #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> GetFederationTokenResponse -> m GetFederationTokenResponse #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> GetFederationTokenResponse -> m GetFederationTokenResponse #

Show GetFederationTokenResponse Source # 
Generic GetFederationTokenResponse Source # 
NFData GetFederationTokenResponse Source # 
type Rep GetFederationTokenResponse Source # 
type Rep GetFederationTokenResponse = D1 (MetaData "GetFederationTokenResponse" "Network.AWS.STS.GetFederationToken" "amazonka-sts-1.5.0-1TsRqghBsTWDbeeJJE5QJN" False) (C1 (MetaCons "GetFederationTokenResponse'" PrefixI True) ((:*:) ((:*:) (S1 (MetaSel (Just Symbol "_gftrsPackedPolicySize") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 (Maybe Nat))) (S1 (MetaSel (Just Symbol "_gftrsCredentials") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 (Maybe AuthEnv)))) ((:*:) (S1 (MetaSel (Just Symbol "_gftrsFederatedUser") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 (Maybe FederatedUser))) (S1 (MetaSel (Just Symbol "_gftrsResponseStatus") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 Int)))))

Response Lenses

gftrsPackedPolicySize :: Lens' GetFederationTokenResponse (Maybe Natural) Source #

A percentage value indicating the size of the policy in packed form. The service rejects policies for which the packed size is greater than 100 percent of the allowed value.

gftrsCredentials :: Lens' GetFederationTokenResponse (Maybe AuthEnv) Source #

The temporary security credentials, which include an access key ID, a secret access key, and a security (or session) token. Note: The size of the security token that STS APIs return is not fixed. We strongly recommend that you make no assumptions about the maximum size. As of this writing, the typical size is less than 4096 bytes, but that can vary. Also, future updates to AWS might require larger sizes.

gftrsFederatedUser :: Lens' GetFederationTokenResponse (Maybe FederatedUser) Source #

Identifiers for the federated user associated with the credentials (such as arn:aws:sts::123456789012:federated-user/Bob or 123456789012:Bob ). You can use the federated user's ARN in your resource-based policies, such as an Amazon S3 bucket policy.