/usr/lib/python2.6/site-packages/keystoneclient/contrib/auth/v3
NameSizeModeActions
oidc.py87510644editdlrm
oidc.pyc87280644editdlrm
saml2.py376870644editdlrm
saml2.pyc365610644editdlrm
__init__.py00644editdlrm
__init__.pyc1730644editdlrm
Edit: /usr/lib/python2.6/site-packages/keystoneclient/contrib/auth/v3/saml2.pyc (36561B)
Ñò (((sS/tmp/pip-build-cD3xZi/python-keystoneclient/keystoneclient/contrib/auth/v3/saml2.pyR9PstSaml2UnscopedTokencBseZdZeZdZhdd6dd6Zhdd6Zhdd 6d d 6d d 6ZdZ dZ dZ dZ d„Z ed„ƒZeid„ƒZed„ƒZeid„ƒZd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„ZRS(söImplement authentication plugin for SAML2 protocol. ECP stands for `Enhanced Client or Proxy` and is a SAML2 extension for federated authentication where a transportation layer consists of HTTP protocol and XML SOAP messages. `Read for more information `_ on ECP. Reference the `SAML2 ECP specification `_. Currently only HTTPBasicAuth mechanism is available for the IdP authenication. :param auth_url: URL of the Identity Service :type auth_url: string :param identity_provider: name of the Identity Provider the client will authenticate against. This parameter will be used to build a dynamic URL used to obtain unscoped OpenStack token. :type identity_provider: string :param identity_provider_url: An Identity Provider URL, where the SAML2 authn request will be sent. :type identity_provider_url: string :param username: User's login :type username: string :param password: User's password :type password: string is#text/html, application/vnd.paos+xmltAcceptsMver="urn:liberty:paos:2003-08";"urn:oasis:names:tc:SAML:2.0:profiles:SSO:ecp"tPAOSsapplication/vnd.paos+xmls Content-Types,urn:oasis:names:tc:SAML:2.0:profiles:SSO:ecptecps)http://schemas.xmlsoap.org/soap/envelope/tSsurn:liberty:paos:2003-08tpaoss//ecp:RelayStates6/S:Envelope/S:Header/paos:Request/@responseConsumerURLs>/S:Envelope/S:Header/ecp:Response/@AssertionConsumerServiceURLsb S:Server responseConsumerURL from SP and assertionConsumerServiceURL from IdP do not match cKsEtt|ƒid||||_||_|||_|_dS(NR(R+R@t__init__Rtidentity_provider_urlt _usernamet _password(R RRRGR&R)R((sS/tmp/pip-build-cD3xZi/python-keystoneclient/keystoneclient/contrib/auth/v3/saml2.pyRF¥s  cCs|iS(N(RH(R ((sS/tmp/pip-build-cD3xZi/python-keystoneclient/keystoneclient/contrib/auth/v3/saml2.pyR&¯scCs ||_dS(N(RH(R tvalue((sS/tmp/pip-build-cD3xZi/python-keystoneclient/keystoneclient/contrib/auth/v3/saml2.pyR&´scCs|iS(N(RI(R ((sS/tmp/pip-build-cD3xZi/python-keystoneclient/keystoneclient/contrib/auth/v3/saml2.pyR)¹scCs ||_dS(N(RI(R RJ((sS/tmp/pip-build-cD3xZi/python-keystoneclient/keystoneclient/contrib/auth/v3/saml2.pyR)¾scKs>|i|ijo|S|id}|i||dt|S(Ntlocationt authenticated(t status_codeR3R=trequesttFalse(R R;tresponsetmethodRRK((sS/tmp/pip-build-cD3xZi/python-keystoneclient/keystoneclient/contrib/auth/v3/saml2.pyt_handle_http_302_ecp_redirectÃs  cCs||i}|i|ƒdS(N(tSAML2_HEADER_INDEXtremove(R tsaml2_authn_requesttheader((sS/tmp/pip-build-cD3xZi/python-keystoneclient/keystoneclient/contrib/auth/v3/saml2.pyt_prepare_idp_saml2_requestÌs cCs||jop|i|d|id|idtƒtdƒ}|h|id6|d6|id6|d6}ti|ƒ‚nd S( sØCheck if consumer URLs issued by SP and IdP are equal. In the initial SAML2 authn Request issued by a Service Provider there is a url called ``consumer url``. A trusted Identity Provider should issue identical url. If the URLs are not equal the federated authn process should be interrupted and the user should be warned. :param session: session object to send out HTTP requests. :type session: keystoneclient.session.Session :param sp_response_consumer_url: consumer URL issued by a SP :type sp_response_consumer_url: string :param idp_sp_response_consumer_url: consumer URL issued by an IdP :type idp_sp_response_consumer_url: string tdataR=RLs›Consumer URLs from Service Provider %(service_provider)s %(sp_consumer_url)s and Identity Provider %(identity_provider)s %(idp_consumer_url)s are not equaltservice_providertsp_consumer_urlRtidp_consumer_urlN( tpostt SOAP_FAULTtECP_SP_SAML2_REQUEST_HEADERSRORR#RRtValidationError(R R;tsp_response_consumer_urltidp_sp_response_consumer_urlR((sS/tmp/pip-build-cD3xZi/python-keystoneclient/keystoneclient/contrib/auth/v3/saml2.pyt_check_consumer_urlsÐs      cCsö|i|id|idtƒ}d|ijo||_tSyti|i ƒ|_ Wn7ti j o(}t dƒ|}t i|ƒ‚nX|i i|id|iƒ}|i|ƒ|_|i i|id|iƒ}|i|ƒ|_tS(sÍInitial HTTP GET request to the SAML2 protected endpoint. It's crucial to include HTTP headers indicating that the client is willing to take advantage of the ECP SAML2 extension and receive data as the SOAP. Unlike standard authentication methods in the OpenStack Identity, the client accesses:: ``/v3/OS-FEDERATION/identity_providers/{identity_providers}/ protocols/{protocol}/auth`` After a successful HTTP call the HTTP response should include SAML2 authn request in the XML format. If a HTTP response contains ``X-Subject-Token`` in the headers and the response body is a valid JSON assume the user was already authenticated and Keystone returned a valid unscoped token. Return True indicating the user was already authenticated. :param session: a session object to send out HTTP requests. :type session: keystoneclient.session.Session R=RLsX-Subject-TokensCSAML2: Error parsing XML returned from Service Provider, reason: %st namespaces(tgetR#tECP_SP_EMPTY_REQUEST_HEADERSROR=tauthenticated_responseR6RR RRURRRRtxpathtECP_RELAY_STATEtECP_SAML2_NAMESPACESR t relay_statet!ECP_SERVICE_PROVIDER_CONSUMER_URLR`(R R;t sp_responseRRRjR`((sS/tmp/pip-build-cD3xZi/python-keystoneclient/keystoneclient/contrib/auth/v3/saml2.pyt_send_service_provider_requestôs(        c Cs|i|iƒ|i}|i|idhdd6dti|ƒd|i|ifdtdtƒ}yti |i ƒ|_ Wn7ti j o(}t dƒ|}ti|ƒ‚nX|i i|id |iƒ}|i|ƒ|_|i||i|iƒd S( sAPresent modified SAML2 authn assertion from the Service Provider.R=stext/xmls Content-typeRXt requests_authRLtlogsDSAML2: Error parsing XML returned from Identity Provider, reason: %sRcN(RWRUR\RGRRR&R)ROR Rtsaml2_idp_authn_responseRRRRRgtECP_IDP_CONSUMER_URLRiR tidp_response_consumer_urlRbR`(R R;tidp_saml2_authn_requestt idp_responseRRRr((sS/tmp/pip-build-cD3xZi/python-keystoneclient/keystoneclient/contrib/auth/v3/saml2.pyt_send_idp_saml2_authn_request$s(       c Cs{|i|idd<|i|id|idti|iƒdtdtƒ}|i||ddd|iƒ}||_ dS( s6Present SAML2 assertion to the Service Provider. The assertion is issued by a trusted Identity Provider for the authenticated user. This function directs the HTTP request to SP managed URL, for instance: ``https://:/Shibboleth.sso/ SAML2/ECP``. Upon success the there's a session created and access to the protected resource is granted. Many implementations of the SP return HTTP 302 status code pointing to the protected URL (``https://:/v3/ OS-FEDERATION/identity_providers/{identity_provider}/protocols/ {protocol_id}/auth`` in this case). Saml2 plugin should point to that URL again, with HTTP GET method, expecting an unscoped token. :param session: a session object to send out HTTP requests. iR=RXRLtredirectRQtGETN( RjRpR\RrR^RRRORRRf(R R;RP((sS/tmp/pip-build-cD3xZi/python-keystoneclient/keystoneclient/contrib/auth/v3/saml2.pyt+_send_service_provider_saml2_authn_responseBs   cCsU|i|ƒ}|p|i|ƒ|i|ƒn|iid|iiƒdfS(sG Get unscoped OpenStack token after federated authentication. This is a multi-step process including multiple HTTP requests. The federated authentication consists of:: * HTTP GET request to the Identity Service (acting as a Service Provider). Client utilizes URL:: ``/v3/OS-FEDERATION/identity_providers/{identity_provider}/ protocols/saml2/auth``. It's crucial to include HTTP headers indicating we are expecting SOAP message in return. Service Provider should respond with such SOAP message. This step is handed by a method ``Saml2UnscopedToken_send_service_provider_request()`` * HTTP POST request to the external Identity Provider service with ECP extension enabled. The content sent is a header removed SOAP message returned from the Service Provider. It's also worth noting that ECP extension to the SAML2 doesn't define authentication method. The most popular is HttpBasicAuth with just user and password. Other possibilities could be X509 certificates or Kerberos. Upon successful authentication the user should receive a SAML2 assertion. This step is handed by a method ``Saml2UnscopedToken_send_idp_saml2_authn_request(session)`` * HTTP POST request again to the Service Provider. The body of the request includes SAML2 assertion issued by a trusted Identity Provider. The request should be sent to the Service Provider consumer url specified in the SAML2 assertion. Providing the authentication was successful and both Service Provider and Identity Providers are trusted to each other, the Service Provider will issue an unscoped token with a list of groups the federated user is a member of. This step is handed by a method ``Saml2UnscopedToken_send_service_provider_saml2_authn_response()`` Unscoped token example:: { "token": { "methods": [ "saml2" ], "user": { "id": "username%40example.com", "name": "username@example.com", "OS-FEDERATION": { "identity_provider": "ACME", "protocol": "saml2", "groups": [ {"id": "abc123"}, {"id": "bcd234"} ] } } } } :param session : a session object to send out HTTP requests. :type session: keystoneclient.session.Session :returns: (token, token_json) sX-Subject-Tokenttoken(RmRuRxRfR=tjson(R R;tsaml_authenticated((sS/tmp/pip-build-cD3xZi/python-keystoneclient/keystoneclient/contrib/auth/v3/saml2.pyt_get_unscoped_tokenes C  cKs%|i|ƒ\}}ti||S(s.Authenticate via SAML2 protocol and retrieve unscoped token. This is a multi-step process where a client does federated authn receives an unscoped token. Federated authentication utilizing SAML2 Enhanced Client or Proxy extension. See ``Saml2UnscopedToken_get_unscoped_token()`` for more information on that step. Upon successful authentication and assertion mapping an unscoped token is returned and stored within the plugin object for further use. :param session : a session object to send out HTTP requests. :type session: keystoneclient.session.Session :return: an object with scoped token's id and unscoped token json included. :rtype: :py:class:`keystoneclient.access.AccessInfoV3` (R|Rt AccessInfoV3(R R;RRyt token_json((sS/tmp/pip-build-cD3xZi/python-keystoneclient/keystoneclient/contrib/auth/v3/saml2.pyt get_auth_ref¯s (R1R2t__doc__R9t_auth_method_classRSReR^RiRhRkRqR]RFR7R&tsetterR)RRRWRbRmRuRxR|R(((sS/tmp/pip-build-cD3xZi/python-keystoneclient/keystoneclient/contrib/auth/v3/saml2.pyR@Xs:#      $ 0  # JtADFSUnscopedTokencBseZdZeZdZhdd6Zhdd6Zhdd6dd6d d 6Zhdd6d d 6Z d Z d„Z e d„ƒZ e id„ƒZ e d„ƒZeid„ƒZed„ƒZd„Zdd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„ZRS(s¼Authentication plugin for Microsoft ADFS2.0 IdPs. :param auth_url: URL of the Identity Service :type auth_url: string :param identity_provider: name of the Identity Provider the client will authenticate against. This parameter will be used to build a dynamic URL used to obtain unscoped OpenStack token. :type identity_provider: string :param identity_provider_url: An Identity Provider URL, where the SAML2 authentication request will be sent. :type identity_provider_url: string :param service_provider_endpoint: Endpoint where an assertion is being sent, for instance: ``https://host.domain/Shibboleth.sso/ADFS`` :type service_provider_endpoint: string :param username: User's login :type username: string :param password: User's password :type password: string ixs#application/soap+xml; charset=utf-8s Content-Types!application/x-www-form-urlencodeds'http://www.w3.org/2003/05/soap-envelopetss$http://www.w3.org/2005/08/addressingtasRhttp://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsdtus0http://docs.oasis-open.org/ws-sx/ws-trust/200512ttsZ/s:Envelope/s:Body/t:RequestSecurityTokenResponseCollection/t:RequestSecurityTokenResponsecKsNtt|ƒid||||_||_||_|||_|_dS(NR(R+RƒRFRRGtservice_provider_endpointRHRI(R RRRGRˆR&R)R((sS/tmp/pip-build-cD3xZi/python-keystoneclient/keystoneclient/contrib/auth/v3/saml2.pyRFûs    cCs|iS(N(RH(R ((sS/tmp/pip-build-cD3xZi/python-keystoneclient/keystoneclient/contrib/auth/v3/saml2.pyR&scCs ||_dS(N(RH(R RJ((sS/tmp/pip-build-cD3xZi/python-keystoneclient/keystoneclient/contrib/auth/v3/saml2.pyR&scCs|iS(N(RI(R ((sS/tmp/pip-build-cD3xZi/python-keystoneclient/keystoneclient/contrib/auth/v3/saml2.pyR) scCs ||_dS(N(RI(R RJ((sS/tmp/pip-build-cD3xZi/python-keystoneclient/keystoneclient/contrib/auth/v3/saml2.pyR)scCs8tt|ƒiƒ}|itidddƒgƒ|S(Nsservice-provider-endpointR$sService Provider's Endpoint(R+RƒR,R-RR.(R/R0((sS/tmp/pip-build-cD3xZi/python-keystoneclient/keystoneclient/contrib/auth/v3/saml2.pyR,s   cCs7yt|iƒSWntj onXt|iiƒS(sÚCheck if cookie jar is not empty. keystoneclient.session.Session object doesn't have a cookies attribute. We should then try fetching cookies from the underlying requests.Session object. If that fails too, there is something wrong and let Python raise the AttributeError. :param session :returns: True if cookie jar is nonempty, False otherwise :raises AttributeError: in case cookies are not find anywhere (tbooltcookiestAttributeErrorR;(R R;((sS/tmp/pip-build-cD3xZi/python-keystoneclient/keystoneclient/contrib/auth/v3/saml2.pyt_cookies!s s%Y-%m-%dT%H:%M:%S.%fZcCsVtiiƒ}|tid|iƒ}g}||fD]}||i|ƒq9~S(sòCalculate created and expires datetime objects. The method is going to be used for building ADFS Request Security Token message. Time interval between ``created`` and ``expires`` dates is now static and equals to 120 seconds. ADFS security tokens should not be live too long, as currently ``keystoneclient`` doesn't have mechanisms for reusing such tokens (every time ADFS authn method is called, keystoneclient will login with the ADFS instance). :param fmt: Datetime format for specifying string format of a date. It should not be changed if the method is going to be used for building the ADFS security token request. :type fmt: string tseconds(tdatetimetutcnowt timedeltatDEFAULT_ADFS_TOKEN_EXPIRATIONtstrftime(R tfmtt date_createdt date_expirest_[1]t_time((sS/tmp/pip-build-cD3xZi/python-keystoneclient/keystoneclient/contrib/auth/v3/saml2.pyt _token_dates5s  cCsÙhdd6}hdd6}hdd6}hdd6}tid d |iƒ}ti|d ƒ}ti|d ƒ}|id dƒd|_ti|dƒ}dtiƒi|_ti|dƒ} ti| dƒ} d| _ti|dƒ} | id dƒti|dd |ƒ} | id dƒti| dƒ} | iddƒti| dƒ}ti| dƒ}|i ƒ\|_|_ti| dƒ}|iddtiƒiƒti|dƒ}ti|d d!d"ƒ}ti|d#ƒ}ti|d$d |ƒ}ti|d%d |ƒ}ti|d&d |ƒ}ti|dƒ}ti|d'ƒ}d(|_ti|d)ƒ}d*|_ti|d+ƒ}d,|_|i |_|i |_|i | _|i |_||_d-S(.s‰Build the ADFS Request Security Token SOAP message. Some values like username or password are inserted in the request. sQhttp://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsdtos0http://docs.oasis-open.org/ws-sx/ws-trust/200512ttrusts,http://schemas.xmlsoap.org/ws/2004/09/policytwsps$http://www.w3.org/2005/08/addressingtwsas1{http://www.w3.org/2003/05/soap-envelope}Envelopetnsmaps/{http://www.w3.org/2003/05/soap-envelope}Headers,{http://www.w3.org/2005/08/addressing}Actions7{http://www.w3.org/2003/05/soap-envelope}mustUnderstandt1s:http://docs.oasis-open.org/ws-sx/ws-trust/200512/RST/Issues/{http://www.w3.org/2005/08/addressing}MessageIDs urn:uuid:s-{http://www.w3.org/2005/08/addressing}ReplyTos-{http://www.w3.org/2005/08/addressing}Addresss.http://www.w3.org/2005/08/addressing/anonymouss({http://www.w3.org/2005/08/addressing}Tos[{http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd}Securitys]{http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd}TimestampsV{http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd}Idt_0s[{http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd}Createds[{http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd}Expiress`{http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd}UsernameTokensU{http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd}us uuid-%s-1s[{http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd}Usernames[{http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd}PasswordtTypes_http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordTexts-{http://www.w3.org/2003/05/soap-envelope}BodysF{http://docs.oasis-open.org/ws-sx/ws-trust/200512}RequestSecurityTokens7{http://schemas.xmlsoap.org/ws/2004/09/policy}AppliesTos7{http://www.w3.org/2005/08/addressing}EndpointReferences9{http://docs.oasis-open.org/ws-sx/ws-trust/200512}KeyTypes7http://docs.oasis-open.org/ws-sx/ws-trust/200512/Bearers={http://docs.oasis-open.org/ws-sx/ws-trust/200512}RequestTypes6http://docs.oasis-open.org/ws-sx/ws-trust/200512/Issues;{http://docs.oasis-open.org/ws-sx/ws-trust/200512}TokenTypes%urn:oasis:names:tc:SAML:1.0:assertionN(RtElementt NAMESPACESt SubElementtsetttexttuuidtuuid4thexR˜R&R)RGRˆtprepared_request(R tWSS_SECURITY_NAMESPACEtTRUST_NAMESPACEt WSP_NAMESPACEt WSA_NAMESPACEtrootRVtactiont messageIDtreplyIDtaddressttotsecurityt timestamptcreatedtexpirest usernametokenR&R)tbodytrequest_security_tokent applies_totendpoint_referencet wsa_addresstkeytypet request_typet token_type((sS/tmp/pip-build-cD3xZi/python-keystoneclient/keystoneclient/contrib/auth/v3/saml2.pyt_prepare_adfs_requestKs®                                        c s­‡fd†}ˆiˆiƒ}y.|idˆidˆid|dtƒ}Wn3tij o$}||ƒ}ti|ƒ‚nXt dƒ}ˆi |i |ƒˆ_ dS(slSend ADFS Security token to the ADFS server. Store the result in the instance attribute and raise an exception in case the response is not valid XML data. If a user cannot authenticate due to providing bad credentials, the ADFS2.0 server will return a HTTP 500 response and a XML Fault message. If ``exceptions.InternalServerError`` is caught, the method tries to parse the XML response. If parsing is unsuccessful, an ``exceptions.AuthorizationFailure`` is raised with a reason from the XML fault. Otherwise an original ``exceptions.InternalServerError`` is re-raised. :param session : a session object to send out HTTP requests. :type session: keystoneclient.session.Session :raises keystoneclient.exceptions.AuthorizationFailure: when HTTP response from the ADFS server is not a valid XML ADFS security token. :raises keystoneclient.exceptions.InternalServerError: If response status code is HTTP 500 and the response XML cannot be recognized. csvd}|ii}y;ˆi|ƒi|dˆiƒ}ˆi|ƒ}|iSWn"tti fj o |‚nXdS(Ns3/s:Envelope/s:Body/s:Fault/s:Code/s:Subcode/s:ValueRc( RPRRRgR¢R R¥R RR(RRgRtobj(R (sS/tmp/pip-build-cD3xZi/python-keystoneclient/keystoneclient/contrib/auth/v3/saml2.pyt _get_failureìs  R"R=RXRLsFError parsing XML returned from the ADFS Identity Provider, reason: %sN( RR©R\RGt HEADER_SOAPRORtInternalServerErrorRRRRt adfs_token(R R;RÃRºRPRtreasonR((R sS/tmp/pip-build-cD3xZi/python-keystoneclient/keystoneclient/contrib/auth/v3/saml2.pyt_get_adfs_security_tokenÓs   cCsq|ii|id|iƒ}|i|ƒ}|i|ƒ}|iddƒ}tii |ƒ}d||_ dS(s)Prepare ADFS Security Token to be sent to the Service Provider. The method works as follows: * Extract SAML2 assertion from the ADFS Security Token. * Replace namespaces * urlencode assertion * concatenate static string with the encoded assertion Rcs0http://docs.oasis-open.org/ws-sx/ws-trust/200512s+http://schemas.xmlsoap.org/ws/2005/02/trustswa=wsignin1.0&wresult=N( RÆRgtADFS_ASSERTION_XPATHtADFS_TOKEN_NAMESPACESR RtreplaceRtparsetquotetencoded_assertion(R t assertionRÎ((sS/tmp/pip-build-cD3xZi/python-keystoneclient/keystoneclient/contrib/auth/v3/saml2.pyt_prepare_sp_request s  c Cs5|id|id|id|idtdtƒdS(s!Send prepared assertion to a service provider. As the assertion doesn't contain a protected resource, the value from the ``location`` header is not valid and we should not let the Session object get redirected there. The aim of this call is to get a cookie in the response which is required for entering a protected endpoint. :param session : a session object to send out HTTP requests. :type session: keystoneclient.session.Session :raises: Corresponding HTTP error exception R"RXR=RvRLN(R\RˆRÎt HEADER_X_FORMRO(R R;((sS/tmp/pip-build-cD3xZi/python-keystoneclient/keystoneclient/contrib/auth/v3/saml2.pyt#_send_assertion_to_service_provider"s cCsN|i|ƒtjotitdƒƒ‚n|i|idtƒ|_dS(sAccess protected endpoint and fetch unscoped token. After federated authentication workflow a protected endpoint should be accessible with the session object. The access is granted basing on the cookies stored within the session object. If, for some reason no cookies are present (quantity test) it means something went wrong and user will not be able to fetch an unscoped token. In that case an ``exceptions.AuthorizationFailure` exception is raised and no HTTP call is even made. :param session : a session object to send out HTTP requests. :type session: keystoneclient.session.Session :raises keystoneclient.exceptions.AuthorizationFailure: in case session object has empty cookie jar. swSession object doesn't contain a cookie, therefore you are not allowed to enter the Identity Provider's protected area.RLN(RŒRORRRRdR#Rf(R R;((sS/tmp/pip-build-cD3xZi/python-keystoneclient/keystoneclient/contrib/auth/v3/saml2.pyt_access_service_provider4s cGs•|iƒ|i|ƒ|iƒ|i|ƒ|i|ƒy%|iid|iiƒdfSWn.tt fj ot i d|iƒ‚nXdS(sÌRetrieve unscoped token after authentcation with ADFS server. This is a multistep process:: * Prepare ADFS Request Securty Token - build a etree.XML object filling certain attributes with proper user credentials, created/expires dates (ticket is be valid for 120 seconds as currently we don't handle reusing ADFS issued security tokens) . Step handled by ``ADFSUnscopedToken._prepare_adfs_request()`` method. * Send ADFS Security token to the ADFS server. Step handled by ``ADFSUnscopedToken._get_adfs_security_token()`` method. * Receive and parse security token, extract actual SAML assertion and prepare a request addressed for the Service Provider endpoint. This also includes changing namespaces in the XML document. Step handled by ``ADFSUnscopedToken._prepare_sp_request()`` method. * Send prepared assertion to the Service Provider endpoint. Usually the server will respond with HTTP 301 code which should be ignored as the 'location' header doesn't contain protected area. The goal of this operation is fetching the session cookie which later allows for accessing protected URL endpoints. Step handed by ``ADFSUnscopedToken._send_assertion_to_service_provider()`` method. * Once the session cookie is issued, the protected endpoint can be accessed and an unscoped token can be retrieved. Step handled by ``ADFSUnscopedToken._access_service_provider()`` method. :param session : a session object to send out HTTP requests. :type session: keystoneclient.session.Session :returns: (Unscoped federated token, token JSON body) sX-Subject-TokenRyRPN( RÁRÈRÐRÒRÓRfR=RztKeyErrort ValueErrorRtInvalidResponse(R R;R((sS/tmp/pip-build-cD3xZi/python-keystoneclient/keystoneclient/contrib/auth/v3/saml2.pyR|Ns$       cKs%|i|ƒ\}}ti||S(N(R|RR}(R R;RRyR~((sS/tmp/pip-build-cD3xZi/python-keystoneclient/keystoneclient/contrib/auth/v3/saml2.pyRs(R1R2R€R9RR‘RÄRÑR¢RÊRÉRFR7R&R‚R)R8R,RŒR˜RÁRÈRÐRÒRÓR|R(((sS/tmp/pip-build-cD3xZi/python-keystoneclient/keystoneclient/contrib/auth/v3/saml2.pyRƒÉs8        ˆ 6    1tSaml2ScopedTokenMethodcBseZdZd„ZRS(RcKs:tt|ƒi||||}|\}}|i|fS(s5Build and return request body for token scoping step.(R+R×R>t _method_name(R R;R<R=RR‡t _token_methodRy((sS/tmp/pip-build-cD3xZi/python-keystoneclient/keystoneclient/contrib/auth/v3/saml2.pyR>‡s (R1R2RØR>(((sS/tmp/pip-build-cD3xZi/python-keystoneclient/keystoneclient/contrib/auth/v3/saml2.pyRׄstSaml2ScopedTokencBseZdZeZd„ZRS(s'Class for scoping unscoped saml2 token.cKsMtt|ƒi||||ip|iptitdƒƒ‚ndS(Ns$Neither project nor domain specified(R+RÚRFt project_idt domain_idRR_R(R RRyR((sS/tmp/pip-build-cD3xZi/python-keystoneclient/keystoneclient/contrib/auth/v3/saml2.pyRF•s(R1R2R€R×RRF(((sS/tmp/pip-build-cD3xZi/python-keystoneclient/keystoneclient/contrib/auth/v3/saml2.pyRÚs(RŽR¦tlxmlRt oslo_configRt six.movesRtkeystoneclientRtkeystoneclient.auth.identityRRtkeystoneclient.i18nRtAuthConstructorRt AuthMethodR9R@Rƒt TokenMethodR×tTokenRÚ(((sS/tmp/pip-build-cD3xZi/python-keystoneclient/keystoneclient/contrib/auth/v3/saml2.pyt s  6ÿrÿ¼