/usr/lib/python2.6/site-packages/keystoneclient/middleware
NameSizeModeActions
auth_token.py646860644editdlrm
auth_token.pyc556180644editdlrm
memcache_crypt.py61720644editdlrm
memcache_crypt.pyc73060644editdlrm
s3_token.py108580644editdlrm
s3_token.pyc87200644editdlrm
__init__.py00644editdlrm
__init__.pyc1680644editdlrm
Edit: /usr/lib/python2.6/site-packages/keystoneclient/middleware/s3_token.pyc (8720B)
Ñò `_. This WSGI component: * Get a request from the swift3 middleware with an S3 Authorization access key. * Validate s3 token in Keystone. * Transform the account name to AUTH_%(tenant_name). iÿÿÿÿN(t jsonutils(tstrutils(turllibsS3 Token AuthenticationicCs¬|p |}n||jotd||fƒ‚n|o|id|ƒ}|d7}|d7}t|ƒ}|dp.||jp!||jpd|d|!jo tdtii|ƒƒ‚qyn¬|d7}|d7}|id|ƒ}t|ƒ}|dpN||jpA||djp0d|d|!jp||djo+||o tdtii|ƒƒ‚n|d|!}|idg|dt|ƒƒ|S(s!Validate and split the given HTTP request path. **Examples**:: ['a'] = split_path('/a') ['a', None] = split_path('/a', 1, 2) ['a', 'c'] = split_path('/a/c', 1, 2) ['a', 'c', 'o/r'] = split_path('/a/c/o/r', 1, 3, True) :param path: HTTP Request path to be split :param minsegs: Minimum number of segments to be extracted :param maxsegs: Maximum number of segments to be extracted :param rest_with_last: If True, trailing data will be returned as part of last segment. If False, and there is trailing data, raises ValueError. :returns: list of segments with a length of maxsegs (non-existent segments will return as None) :raises: ValueError if given an invalid path sminsegs > maxsegs: %d > %dt/iitsInvalid path: %sN(t ValueErrortsplittlenRtparsetquotetextendtNone(tpathtminsegstmaxsegstrest_with_lasttsegstcount((sQ/tmp/pip-build-cD3xZi/python-keystoneclient/keystoneclient/middleware/s3_token.pyt split_path6s.     %$   )  "t ServiceErrorcBseZRS((t__name__t __module__(((sQ/tmp/pip-build-cD3xZi/python-keystoneclient/keystoneclient/middleware/s3_token.pyRdstS3TokencBs2eZdZd„Zd„Zd„Zd„ZRS(s<Auth Middleware that handles S3 authenticating client calls.c Cs=||_ti|idtƒƒ|_|iidtƒ|iidƒ|iddƒ|_ |idƒ}t |iddƒƒ}|id d ƒ}d |||f|_ t i |id tƒƒ}|id ƒ}|idƒ}|o t|_n?|o|o||f|_n|o ||_n d|_dS(sCommon initialization code.tlog_namesStarting the %s components¦This middleware module is deprecated as of v0.11.0 in favor of keystonemiddleware.s3_token - please update your WSGI pipeline to reference the new middleware package.treseller_prefixtAUTH_t auth_hostt auth_portiŠt auth_protocolthttpss %s://%s:%stinsecuretcertfiletkeyfileN(tapptloggingt getLoggertgetRtloggertdebugt PROTOCOL_NAMEtwarningRtintt request_uriRtbool_from_stringtFalsetverifyR ( tselfR!tconfRRRRt cert_filetkey_file((sQ/tmp/pip-build-cD3xZi/python-keystoneclient/keystoneclient/middleware/s3_token.pyt__init__ks(    cCsvhd d6d d6}tiddƒ}||d |_d |||d f}tio|iƒ}n||_|S(Ni‘s Access deniedt AccessDeniedis!Could not parse the specified URIt InvalidURIt content_typestext/xmlisg %s %s i(i‘s Access denied(is!Could not parse the specified URI(twebobtResponsetstatustsixtPY3tencodetbody(R.tcodet error_tabletrespt error_msg((sQ/tmp/pip-build-cD3xZi/python-keystoneclient/keystoneclient/middleware/s3_token.pyt deny_request‹s   c Csçhdd6}y/tid|id|d|d|iƒ}WnItiij o7}|iid|ƒ|idƒ}t |ƒ‚nX|i d jp|i d jo;|ii d |i |i ƒ|id ƒ}t |ƒ‚n|S( Nsapplication/jsons Content-Types%s/v2.0/s3tokenstheaderstdataR-sHTTP connection exception: %sR4iÈi,s)Keystone reply error: status=%s reason=%sR3( trequeststpostR*R-t exceptionstRequestExceptionR%tinfoRARt status_codeR&treason(R.t creds_jsonRBtresponseteR?((sQ/tmp/pip-build-cD3xZi/python-keystoneclient/keystoneclient/middleware/s3_token.pyt _json_request›s    cCsgti|ƒ}|iidƒy.t|iddtƒ}|\}}}}Wn6tj o*d} |ii| ƒ|i||ƒSXd|i jo'd} |ii| ƒ|i||ƒS|i i d|i i dƒƒ} | p'd } |ii| ƒ|i||ƒS|i d} y)| i d ƒd i d dƒ\} } Wn?tj o3d } |ii| | ƒ|i dƒ||ƒSXd}d | jo| i d ƒ\} }nhh| d6| d6| d6d6}ti|ƒ}|iid|ƒy|i|ƒ}WnHtj o<}|id}d} |ii| |iƒ|||ƒSX|iid|i|iƒy:|iƒ}t|dddƒ}|ddd}WnNttfj o<d}|ii||i|iƒ|i dƒ||ƒSX||i d<|p|d}|iid|ƒd|i|f}|di||ƒ|d<|i||ƒS(s:Handle incoming request. authenticate and send downstream.sCalling S3Token middleware.iisNot a path query, skipping.t Authorizations"No Authorization header. skipping.s X-Auth-TokensX-Storage-Tokens9You did not specify an auth or a storage token. skipping.t iÿÿÿÿt:s,You have an invalid Authorization header: %sR4taccessttokent signaturet credentialss,Connecting to Keystone sending this JSON: %sis1Received error, exiting middleware with error: %ss&Keystone Reply: Status: %d, Output: %stidttenantsError on keystone reply: %d %ssConnecting with tenant: %ss%s%st PATH_INFON(R6tRequestR%R&RR tTrueRR!RBR$RtrsplitRAR RtdumpsRNRtargsRItcontenttjsontstrtKeyErrorRtreplace(R.tenvirontstart_responsetreqtpartstversiontaccountt containertobjtmsgRSt auth_headerRRRTt force_tenanttcredsRKR?RMt identity_infottoken_idRWterrorttenant_to_connecttnew_tenant_name((sQ/tmp/pip-build-cD3xZi/python-keystoneclient/keystoneclient/middleware/s3_token.pyt__call__®sv  )           (RRt__doc__R2RARNRt(((sQ/tmp/pip-build-cD3xZi/python-keystoneclient/keystoneclient/middleware/s3_token.pyRhs   c s,|iƒ‰ˆi|ƒ‡fd†}|S(s4Returns a WSGI filter app for use with paste.deploy.cs t|ˆƒS(N(R(R!(R/(sQ/tmp/pip-build-cD3xZi/python-keystoneclient/keystoneclient/middleware/s3_token.pyt auth_filters(tcopytupdate(t global_conft local_confRv((R/sQ/tmp/pip-build-cD3xZi/python-keystoneclient/keystoneclient/middleware/s3_token.pytfilter_factory s  (RuR"toslo_serializationRt oslo_utilsRRDR9t six.movesRR6R'R R,Rt ExceptionRtobjectRR{(((sQ/tmp/pip-build-cD3xZi/python-keystoneclient/keystoneclient/middleware/s3_token.pyt&s    .£