/usr/lib/python2.6/site-packages/keystoneauth1/tests/unit/extras/saml2
Edit: /usr/lib/python2.6/site-packages/keystoneauth1/tests/unit/extras/saml2/test_auth_adfs.pyc (9726B)
Ñò
7
Wc @ s© d d k Z d d k l Z d d k l Z d d k l Z d d k l Z d d k
l Z d d k l
Z d d k l Z d d k
l Z d
e i f d „ ƒ YZ d S( iÿÿÿÿN( t etree( t urllib( t
exceptions( t _saml2( t client_fixtures( t fixtures( t utils( t matcherst AuthenticateviaADFSTestsc B sø e Z d Z h d d 6d d 6d d 6d d 6d d 6d
d 6Z d Z d
Z d Z d Z e i ƒ i
Z d Z e
d „ ƒ Z d „ Z d „ Z d „ Z d „ Z d „ Z d „ Z d „ Z d „ Z d „ Z d „ Z d „ Z d „ Z d „ Z d „ Z RS( t auths' http://www.w3.org/2003/05/soap-envelopet ss0 http://docs.oasis-open.org/ws-sx/ws-trust/200512t trusts$ http://www.w3.org/2005/08/addressingt wsas, http://schemas.xmlsoap.org/ws/2004/09/policyt wspt asQ http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsdt os: /s:Envelope/s:Header/o:Security/o:UsernameToken/o:Usernames: /s:Envelope/s:Header/o:Security/o:UsernameToken/o:Passwords] /s:Envelope/s:Body/trust:RequestSecurityToken/wsp:AppliesTo/wsa:EndpointReference/wsa:Addresss /s:Envelope/s:Header/a:Tot saml2c C s d S( Ns$ 4b911420-4982-4009-8afc-5c596cd487f5( ( t self( ( s[ /tmp/pip-build-wCUybK/keystoneauth1/keystoneauth1/tests/unit/extras/saml2/test_auth_adfs.pyt _uuid4; s c C s¥ t t | ƒ i ƒ d | _ d | _ d | i d f | _ d | _ t i | i | i | i | i | i
| i | i ƒ | _
t i d ƒ | _ t i d ƒ | _ d S( Nt adfss5 http://adfs.local/adfs/service/trust/13/usernamemixeds %s/%ss: OS-FEDERATION/identity_providers/adfs/protocols/saml2/auths, https://openstack4.local/Shibboleth.sso/ADFSs% ADFS_RequestSecurityTokenResponse.xmls ADFS_fault.xml( t superR t setUpt IDENTITY_PROVIDERt IDENTITY_PROVIDER_URLt TEST_URLt FEDERATION_AUTH_URLt SP_ENDPOINTR t V3ADFSPasswordt TEST_USERt
TEST_TOKENt PROTOCOLt
adfspluginR t _load_xmlt ADFS_SECURITY_TOKEN_RESPONSEt
ADFS_FAULT( R ( ( s[ /tmp/pip-build-wCUybK/keystoneauth1/keystoneauth1/tests/unit/extras/saml2/test_auth_adfs.pyR ? s
c C s† | i i | i d t i | i ƒ d d ƒ| i i ƒ | i i | i ƒ t
i | i i ƒ } | i } | i
| t i | ƒ ƒ d S( s- Test ADFSPassword._get_adfs_security_token().t contentt status_codeiÈ N( t
requests_mockt postR R t make_onelineR! R t _prepare_adfs_requestt _get_adfs_security_tokent sessionR t tostringt
adfs_tokent
assertThatR t XMLEquals( R t
adfs_responset fixture_response( ( s[ /tmp/pip-build-wCUybK/keystoneauth1/keystoneauth1/tests/unit/extras/saml2/test_auth_adfs.pyt test_get_adfs_security_tokenS s
c C sL | i i ƒ | i i i | i d | i ƒd } | i | i | i ƒ d S( Nt
namespacesi ( R R( t prepared_requestt xpatht
USER_XPATHt
NAMESPACESt assertEqualR t text( R t user( ( s[ /tmp/pip-build-wCUybK/keystoneauth1/keystoneauth1/tests/unit/extras/saml2/test_auth_adfs.pyt test_adfs_request_userc s
c C sL | i i ƒ | i i i | i d | i ƒd } | i | i | i ƒ d S( NR2 i ( R R( R3 R4 t PASSWORD_XPATHR6 R7 R R8 ( R t password( ( s[ /tmp/pip-build-wCUybK/keystoneauth1/keystoneauth1/tests/unit/extras/saml2/test_auth_adfs.pyt test_adfs_request_passwordi s
c C sL | i i ƒ | i i i | i d | i ƒd } | i | i | i ƒ d S( NR2 i ( R R( R3 R4 t TO_XPATHR6 R7 R R8 ( R t to( ( s[ /tmp/pip-build-wCUybK/keystoneauth1/keystoneauth1/tests/unit/extras/saml2/test_auth_adfs.pyt test_adfs_request_too s
c C sL | i i ƒ | i i i | i d | i ƒd } | i | i | i ƒ d S( NR2 i ( R R( R3 R4 t
ADDRESS_XPATHR6 R7 R R8 ( R t address( ( s[ /tmp/pip-build-wCUybK/keystoneauth1/keystoneauth1/tests/unit/extras/saml2/test_auth_adfs.pyt! test_prepare_adfs_request_addressu s
c C s¹ t i | i ƒ } | i t i i d t i i ƒ} | d } t i | ƒ } | i d d ƒ } t
i i | ƒ } d | } t i | i ƒ | i
_ | i
i ƒ | i | | i
i ƒ d S( NR2 i s0 http://docs.oasis-open.org/ws-sx/ws-trust/200512s+ http://schemas.xmlsoap.org/ws/2005/02/trusts wa=wsignin1.0&wresult=( R t XMLR! R4 R R t ADFS_ASSERTION_XPATHt ADFS_TOKEN_NAMESPACESR+ t replaceR t parset quoteR R, t _prepare_sp_requestR7 t encoded_assertion( R t assertion( ( s[ /tmp/pip-build-wCUybK/keystoneauth1/keystoneauth1/tests/unit/extras/saml2/test_auth_adfs.pyt test_prepare_sp_request{ s
c C sd t i | i ƒ } | i i d | i d | d d ƒ| i i ƒ | i t i
| i i | i ƒ d S( sÔ Test proper parsing XML fault after bad authentication.
An exceptions.AuthorizationFailure should be raised including
error message from the XML message indicating where was the problem.
t POSTR# R$ iô N(
R R' R" R% t register_uriR R R( t assertRaisesR t AuthorizationFailureR) R* ( R R# ( ( s[ /tmp/pip-build-wCUybK/keystoneauth1/keystoneauth1/tests/unit/extras/saml2/test_auth_adfs.pyt' test_get_adfs_security_token_authn_fail s
c C sR | i i d | i d d d d ƒ| i i ƒ | i t i | i i | i ƒ d S( sø Test proper handling HTTP 500 and mangled (non XML) response.
This should never happen yet, keystoneauth1 should be prepared
and correctly raise exceptions.InternalServerError once it cannot
parse XML fault message
RN R# s NOT XMLR$ iô N(
R% RO R R R( RP R t InternalServerErrorR) R* ( R ( ( s[ /tmp/pip-build-wCUybK/keystoneauth1/keystoneauth1/tests/unit/extras/saml2/test_auth_adfs.pyt) test_get_adfs_security_token_bad_response£ s
c C sŠ t i ƒ i } | i i | i d h | d 6d d ƒ| i ƒ | i _ | i i ƒ | i i
| i ƒ | i d t
| i i i ƒ ƒ d S( s Test whether SP issues a cookie.t headerss
set-cookieR$ i. i N( t uuidt uuid4t hexR% R&