summaryrefslogtreecommitdiff
path: root/boto/iam
diff options
context:
space:
mode:
authorDaniel G. Taylor <danielgtaylor@gmail.com>2013-11-21 11:30:38 -0800
committerDaniel G. Taylor <danielgtaylor@gmail.com>2013-11-21 11:30:38 -0800
commit0a51647cdc472b91eed2b248d4122a86786e825b (patch)
treecb5f306d843909034e6c20d2a8dbc35a45be6571 /boto/iam
parent1bc0da3268fe548b2aeee401d841d986e61fcb5a (diff)
downloadboto-0a51647cdc472b91eed2b248d4122a86786e825b.tar.gz
Add support for new STS and IAM calls related to SAML
Diffstat (limited to 'boto/iam')
-rw-r--r--boto/iam/connection.py123
1 files changed, 118 insertions, 5 deletions
diff --git a/boto/iam/connection.py b/boto/iam/connection.py
index 9cc15c6f..223a2c9e 100644
--- a/boto/iam/connection.py
+++ b/boto/iam/connection.py
@@ -65,11 +65,14 @@ class IAMConnection(AWSQueryConnection):
body = response.read()
boto.log.debug(body)
if response.status == 200:
- e = boto.jsonresponse.Element(list_marker=list_marker,
- pythonize_name=True)
- h = boto.jsonresponse.XmlHandler(e, parent)
- h.parse(body)
- return e
+ if body:
+ e = boto.jsonresponse.Element(list_marker=list_marker,
+ pythonize_name=True)
+ h = boto.jsonresponse.XmlHandler(e, parent)
+ h.parse(body)
+ return e
+ else:
+ return {}
else:
boto.log.error('%s %s' % (response.status, response.reason))
boto.log.error('%s' % body)
@@ -1318,3 +1321,113 @@ class IAMConnection(AWSQueryConnection):
return self.get_response('UpdateAssumeRolePolicy',
{'RoleName': role_name,
'PolicyDocument': policy_document})
+
+ def create_saml_provider(self, saml_metadata_document, name):
+ """
+ Creates an IAM entity to describe an identity provider (IdP)
+ that supports SAML 2.0.
+
+ The SAML provider that you create with this operation can be
+ used as a principal in a role's trust policy to establish a
+ trust relationship between AWS and a SAML identity provider.
+ You can create an IAM role that supports Web-based single
+ sign-on (SSO) to the AWS Management Console or one that
+ supports API access to AWS.
+
+ When you create the SAML provider, you upload an a SAML
+ metadata document that you get from your IdP and that includes
+ the issuer's name, expiration information, and keys that can
+ be used to validate the SAML authentication response
+ (assertions) that are received from the IdP. You must generate
+ the metadata document using the identity management software
+ that is used as your organization's IdP.
+ This operation requires `Signature Version 4`_.
+ For more information, see `Giving Console Access Using SAML`_
+ and `Creating Temporary Security Credentials for SAML
+ Federation`_ in the Using Temporary Credentials guide.
+
+ :type saml_metadata_document: string
+ :param saml_metadata_document: An XML document generated by an identity
+ provider (IdP) that supports SAML 2.0. The document includes the
+ issuer's name, expiration information, and keys that can be used to
+ validate the SAML authentication response (assertions) that are
+ received from the IdP. You must generate the metadata document
+ using the identity management software that is used as your
+ organization's IdP.
+ For more information, see `Creating Temporary Security Credentials for
+ SAML Federation`_ in the Using Temporary Security Credentials
+ guide.
+
+ :type name: string
+ :param name: The name of the provider to create.
+
+ """
+ params = {
+ 'SAMLMetadataDocument': saml_metadata_document,
+ 'Name': name,
+ }
+ return self.get_response('CreateSAMLProvider', params)
+
+ def list_saml_providers(self):
+ """
+ Lists the SAML providers in the account.
+ This operation requires `Signature Version 4`_.
+ """
+ return self.get_response('ListSAMLProviders', {})
+
+ def get_saml_provider(self, saml_provider_arn):
+ """
+ Returns the SAML provider metadocument that was uploaded when
+ the provider was created or updated.
+ This operation requires `Signature Version 4`_.
+
+ :type saml_provider_arn: string
+ :param saml_provider_arn: The Amazon Resource Name (ARN) of the SAML
+ provider to get information about.
+
+ """
+ params = {'SAMLProviderArn': saml_provider_arn }
+ return self.get_response('GetSAMLProvider', params)
+
+ def update_saml_provider(self, saml_metadata_document, saml_provider_arn):
+ """
+ Updates the metadata document for an existing SAML provider.
+ This operation requires `Signature Version 4`_.
+
+ :type saml_metadata_document: string
+ :param saml_metadata_document: An XML document generated by an identity
+ provider (IdP) that supports SAML 2.0. The document includes the
+ issuer's name, expiration information, and keys that can be used to
+ validate the SAML authentication response (assertions) that are
+ received from the IdP. You must generate the metadata document
+ using the identity management software that is used as your
+ organization's IdP.
+
+ :type saml_provider_arn: string
+ :param saml_provider_arn: The Amazon Resource Name (ARN) of the SAML
+ provider to update.
+
+ """
+ params = {
+ 'SAMLMetadataDocument': saml_metadata_document,
+ 'SAMLProviderArn': saml_provider_arn,
+ }
+ return self.get_response('UpdateSAMLProvider', params)
+
+ def delete_saml_provider(self, saml_provider_arn):
+ """
+ Deletes a SAML provider.
+
+ Deleting the provider does not update any roles that reference
+ the SAML provider as a principal in their trust policies. Any
+ attempt to assume a role that references a SAML provider that
+ has been deleted will fail.
+ This operation requires `Signature Version 4`_.
+
+ :type saml_provider_arn: string
+ :param saml_provider_arn: The Amazon Resource Name (ARN) of the SAML
+ provider to delete.
+
+ """
+ params = {'SAMLProviderArn': saml_provider_arn }
+ return self.get_response('DeleteSAMLProvider', params)