使用shibboleth idp登录aws的saml
aws-saml-login的Python项目详细描述
====
aws saml登录
====
…图片::https://travis-ci.org/zalando/aws-saml-login.svg?branch=master
:目标:https://travis ci.org/zalando/aws saml login
:alt:build status
…图片::https://coveralls.io/repos/zalando/aws saml login/badge.svg
:目标:https://coveralls.io/r/zalando/aws saml login
:alt:code coverage
图片::https://img.shields.io/pypi/dw/aws saml login.svg
:目标:https://pypi.python.org/pypi/aws saml login/
:alt:pypi downloads
图片::https://img.shields.io/pypi/v/aws saml login.svg
:目标:https://pypi.python.org/pypi/aws saml login/
:alt:最新的pypi版本
。图片::https://img.shields.io/pypi/l/aws saml login.svg
:target:https://pypi.python.org/pypi/aws saml login/
:alt:license
此python包提供一些帮助函数,允许在使用带有"shibboleth标识"的联合登录时从sts(安全令牌服务)编程检索临时aws凭据提供者'.目前它只支持shibboleth idp。
实现依赖于shibboleth重定向页(html表单)和aws角色选择页的html解析。
此包需要python 3.4。
代码块::bash
$sudo pip3 install--升级aws saml login
用法
=
…代码块::python
可能会显示一个用户对话框来选择一个
第一个角色=角色[0]
提供程序arn、角色arn、帐户名=第一个角色
密钥ID,秘密,会话令牌)
会话令牌,"eu-central-1")
ec2=session.resource('ec2')
角色arn)
会话['{}{}'。格式(帐户名,角色arn.split(':')[-1])]=获取会话(密钥id,机密,会话令牌)
用于会话中的密钥。密钥():
打印('key:{}/帐户别名:{}
。格式(密钥,
会话[密钥]。客户端('iam')。列出帐户别名()['accountalias'])
#aws sdk(例如boto)可用于调用aws端点。_ sts:http://docs.aws.amazon.com/sts/latest/usingsts/welcome.html
。_ shibboleth idp:http://shibboleth.net/products/identity provider.html
====
=代码块::xml
<;rp:relyingpartygroup…>;
…
<;!--一、二、二、二、三、三、三、三、三、三、三、四、四、四、四、四、四、四、四、四、四、六、六、六、六、六、六、六、六、六、六、六、六、六、六、六、六、六、六、六、六、六、六、六、六、六、六、六、六、六、六、六、六、--元数据配置-->;
<;!--一、二、二、二、三、三、三、三、三、三、三、四、四、四、四、四、四、四、四、四、四、六、六、六、六、六、六、六、六、六、六、六、六、六、六、六、六、六、六、六、六、六、六、六、六、六、六、六、六、六、六、六、六、--元数据提供程序其他元数据提供程序的组合-->;
<;元数据:元数据提供程序id="shibbolethmetadata"xsi:type="metadata:chainingmetadataprovider">;
…
<;满足adata:metadataprovider id="amazon webservices"xsi:type="metadata:filebackedhttpmetadataprovider"
metadataurl="https://signin.aws.amazon.com/static/saml metadata.xml"
backingfile="shibboleth idp/metadata/amazon webservices.xml">;
<;/metadata:metadata provider>;
…
<;/metadata:metadataprovider>;
…
<;rp:relyingparty id="urn:amazon:webservices"
provider="https://myidp.example.org/shibboleth"
默认登录凭据ref="idpcredential">;
<;rp:profileconfiguration xsi:type="saml:saml2ssoprofile"includeattributestatement="true"
assertionlifetime="pt5m"assertionproxycount="0"
signresponses="never"signassertions="always"
encryptassertions="never"encryptnameids="never"/>;
<;/rp:relyingparty>;
…
<;/rp:relyingpartygroup>;
<;解析器:attributeResolver…>;
…
<;!--一、二、二、二、三、三、三、三、三、三、三、四、四、四、四、四、四、四、四、四、四、六、六、六、六、六、六、六、六、六、六、六、六、六、六、六、六、六、六、六、六、六、六、六、六、六、六、六、六、六、六、六、六、--AWS连接器-->;
<;!--=======-->;
<;解析器:attributeDefinition id="awsroles"xsi:type="ad:mapped"sourceattributeid="memberof">;
<;解析器:依赖项ref="corpldap"/>;
<;解析器:attributeencoder
xsi:type="enc:saml2string"
name="https://aws.amazon.com/saml/attributes/role"
friendlyname="role"/>;
<;ad:valuemap>;
<;ad:returnvalue>;arn:aws:iam::$2:saml provider/shibboleth,arn:aws:iam::$2:role/shibboleth-$1<;/ad:returnvalue>;
<;ad:sourcevalue ignorecase="true">;cn=([^,]*),ou=角色,ou=[^,]*?([0-9]+),ou=aws.*<;/ad:sourcevalue>;
<;/ad:valuemap>;
<;/resolver:attributedefinition>;
<;resolver:attributedefinition id="awsrolesessionname"xsi:type="ad:simple"sourceattributeid="uid">;
<;resolver:dependency ref="corpldap"/>;
<;解析器:attributeencoder
xsi:type="enc:saml2string"
name="https://aws.amazon.com/saml/attributes/rolesessionname"
friendlyname="rolesessionname"/>;
<;/解析器:attributedefinition>;
…
<;/resolver:attributeResolver>;
<;afp:attributeFilterPolicyGroup…>;
…
<;afp:attributeFilterPolicy id="afp aws">;
<;afp:policyRequirementRule xsi:type="basic:attributeResquesterString"value="urn:amazon:webserv"ICES"/>;
<;afp:attributerule attributeid="transientid">;
<;afp:permitvaluerule xsi:type="basic:any"/>;
<;afp:attributerule>;
<;afp:attributerule attributeid="awsroles">;
<;afp:permitvaluerule xsi:type="basic:any"/>;
<;afp:attributerule>;
<;afp:attributerule attributeid="awsrolesessionname">;
<;afp:permitvaluerule xsi:type="basic:any"/>;
<;afp:attributerule>;
<;afp:attributefilterpolICY>;
…
<;/afp:attributeFilterPolicyGroup>;
providerID=urn:amazon:webservices
许可证
==
版权所有©2015 zalando se
2.0版apache许可证下的许可证("许可证");
除非符合许可证,否则您不能使用此文件。
您可以在
http://www.apache.org/licenses/license-2.0
除非适用法律要求或书面同意,否则根据许可证分发的软件应按"原样"分发,
无任何明示或暗示的保证或条件。
有关管理许可的特定语言和
限制,请参阅许可证。在许可证下的离子。
aws saml登录
====
…图片::https://travis-ci.org/zalando/aws-saml-login.svg?branch=master
:目标:https://travis ci.org/zalando/aws saml login
:alt:build status
…图片::https://coveralls.io/repos/zalando/aws saml login/badge.svg
:目标:https://coveralls.io/r/zalando/aws saml login
:alt:code coverage
图片::https://img.shields.io/pypi/dw/aws saml login.svg
:目标:https://pypi.python.org/pypi/aws saml login/
:alt:pypi downloads
图片::https://img.shields.io/pypi/v/aws saml login.svg
:目标:https://pypi.python.org/pypi/aws saml login/
:alt:最新的pypi版本
。图片::https://img.shields.io/pypi/l/aws saml login.svg
:target:https://pypi.python.org/pypi/aws saml login/
:alt:license
此python包提供一些帮助函数,允许在使用带有"shibboleth标识"的联合登录时从sts(安全令牌服务)编程检索临时aws凭据提供者'.目前它只支持shibboleth idp。
实现依赖于shibboleth重定向页(html表单)和aws角色选择页的html解析。
此包需要python 3.4。
代码块::bash
$sudo pip3 install--升级aws saml login
用法
=
…代码块::python
可能会显示一个用户对话框来选择一个
第一个角色=角色[0]
提供程序arn、角色arn、帐户名=第一个角色
密钥ID,秘密,会话令牌)
会话令牌,"eu-central-1")
ec2=session.resource('ec2')
角色arn)
会话['{}{}'。格式(帐户名,角色arn.split(':')[-1])]=获取会话(密钥id,机密,会话令牌)
用于会话中的密钥。密钥():
打印('key:{}/帐户别名:{}
。格式(密钥,
会话[密钥]。客户端('iam')。列出帐户别名()['accountalias'])
#aws sdk(例如boto)可用于调用aws端点。_ sts:http://docs.aws.amazon.com/sts/latest/usingsts/welcome.html
。_ shibboleth idp:http://shibboleth.net/products/identity provider.html
=代码块::xml
<;rp:relyingpartygroup…>;
…
<;!--一、二、二、二、三、三、三、三、三、三、三、四、四、四、四、四、四、四、四、四、四、六、六、六、六、六、六、六、六、六、六、六、六、六、六、六、六、六、六、六、六、六、六、六、六、六、六、六、六、六、六、六、六、--元数据配置-->;
<;!--一、二、二、二、三、三、三、三、三、三、三、四、四、四、四、四、四、四、四、四、四、六、六、六、六、六、六、六、六、六、六、六、六、六、六、六、六、六、六、六、六、六、六、六、六、六、六、六、六、六、六、六、六、--元数据提供程序其他元数据提供程序的组合-->;
<;元数据:元数据提供程序id="shibbolethmetadata"xsi:type="metadata:chainingmetadataprovider">;
…
<;满足adata:metadataprovider id="amazon webservices"xsi:type="metadata:filebackedhttpmetadataprovider"
metadataurl="https://signin.aws.amazon.com/static/saml metadata.xml"
backingfile="shibboleth idp/metadata/amazon webservices.xml">;
<;/metadata:metadata provider>;
…
<;/metadata:metadataprovider>;
…
<;rp:relyingparty id="urn:amazon:webservices"
provider="https://myidp.example.org/shibboleth"
默认登录凭据ref="idpcredential">;
<;rp:profileconfiguration xsi:type="saml:saml2ssoprofile"includeattributestatement="true"
assertionlifetime="pt5m"assertionproxycount="0"
signresponses="never"signassertions="always"
encryptassertions="never"encryptnameids="never"/>;
<;/rp:relyingparty>;
…
<;/rp:relyingpartygroup>;
<;解析器:attributeResolver…>;
…
<;!--一、二、二、二、三、三、三、三、三、三、三、四、四、四、四、四、四、四、四、四、四、六、六、六、六、六、六、六、六、六、六、六、六、六、六、六、六、六、六、六、六、六、六、六、六、六、六、六、六、六、六、六、六、--AWS连接器-->;
<;!--=======-->;
<;解析器:attributeDefinition id="awsroles"xsi:type="ad:mapped"sourceattributeid="memberof">;
<;解析器:依赖项ref="corpldap"/>;
<;解析器:attributeencoder
xsi:type="enc:saml2string"
name="https://aws.amazon.com/saml/attributes/role"
friendlyname="role"/>;
<;ad:valuemap>;
<;ad:returnvalue>;arn:aws:iam::$2:saml provider/shibboleth,arn:aws:iam::$2:role/shibboleth-$1<;/ad:returnvalue>;
<;ad:sourcevalue ignorecase="true">;cn=([^,]*),ou=角色,ou=[^,]*?([0-9]+),ou=aws.*<;/ad:sourcevalue>;
<;/ad:valuemap>;
<;/resolver:attributedefinition>;
<;resolver:attributedefinition id="awsrolesessionname"xsi:type="ad:simple"sourceattributeid="uid">;
<;resolver:dependency ref="corpldap"/>;
<;解析器:attributeencoder
xsi:type="enc:saml2string"
name="https://aws.amazon.com/saml/attributes/rolesessionname"
friendlyname="rolesessionname"/>;
<;/解析器:attributedefinition>;
…
<;/resolver:attributeResolver>;
<;afp:attributeFilterPolicyGroup…>;
…
<;afp:attributeFilterPolicy id="afp aws">;
<;afp:policyRequirementRule xsi:type="basic:attributeResquesterString"value="urn:amazon:webserv"ICES"/>;
<;afp:attributerule attributeid="transientid">;
<;afp:permitvaluerule xsi:type="basic:any"/>;
<;afp:attributerule>;
<;afp:attributerule attributeid="awsroles">;
<;afp:permitvaluerule xsi:type="basic:any"/>;
<;afp:attributerule>;
<;afp:attributerule attributeid="awsrolesessionname">;
<;afp:permitvaluerule xsi:type="basic:any"/>;
<;afp:attributerule>;
<;afp:attributefilterpolICY>;
…
<;/afp:attributeFilterPolicyGroup>;
providerID=urn:amazon:webservices
许可证
==
版权所有©2015 zalando se
2.0版apache许可证下的许可证("许可证");
除非符合许可证,否则您不能使用此文件。
您可以在
http://www.apache.org/licenses/license-2.0
除非适用法律要求或书面同意,否则根据许可证分发的软件应按"原样"分发,
无任何明示或暗示的保证或条件。
有关管理许可的特定语言和
限制,请参阅许可证。在许可证下的离子。