Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
Size: Mime:
ó
µEYc@sddlZddlZddlmZddlZddlmZddlmZddlmZddl	m
Z
ejeƒZ
dZejejƒde
jfd„ƒYƒZd	efd
„ƒYZdefd„ƒYZdefd„ƒYZd
efd„ƒYZdS(iÿÿÿÿN(t
positional(t_utils(taccess(t
exceptions(t
federationtOidcAuthorizationCodetOidcClientCredentialstOidcPasswordtOidcAccessTokent	_OidcBasecBsheZdZd	Zdd	d	d	d„Zd„Zd„Zd„Zd„Z	d„Z
ejd„ƒZ
RS(
s®Base class for different OpenID Connect based flows.

    The OpenID Connect specification can be found at::
    ``http://openid.net/specs/openid-connect-core-1_0.html``
    sopenid profilecKsŸtt|ƒj||||||_||_|	|_i|_||_||_||_	|
dk	r›|
|jkrˆtj
ƒ‚ntjdtƒndS(sÙThe OpenID Connect plugin expects the following.

        :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
        :type identity_provider: string

        :param protocol: Protocol name as configured in keystone
        :type protocol: string

        :param client_id: OAuth 2.0 Client ID
        :type client_id: string

        :param client_secret: OAuth 2.0 Client Secret
        :type client_secret: string

        :param access_token_type: OAuth 2.0 Authorization Server Introspection
                                  token type, it is used to decide which type
                                  of token will be used when processing token
                                  introspection. Valid values are:
                                  "access_token" or "id_token"
        :type access_token_type: string

        :param access_token_endpoint: OpenID Connect Provider Token Endpoint,
                                      for example:
                                      https://localhost:8020/oidc/OP/token
                                      Note that if a discovery document is
                                      provided this value will override
                                      the discovered one.
        :type access_token_endpoint: string

        :param discovery_endpoint: OpenID Connect Discovery Document URL,
                                   for example:
                  https://localhost:8020/oidc/.well-known/openid-configuration
        :type access_token_endpoint: string

        :param scope: OpenID Connect scope that is requested from OP,
                      for example: "openid profile email", defaults to
                      "openid profile". Note that OpenID Connect specification
                      states that "openid" must be always specified.
        :type scope: string
        sXPassing grant_type as an argument has been deprecated as it is now defined in the plugin itself. You should stop passing this argument to the plugin, as it will be ignored, since you cannot pass a free text string as a grant_type. This argument will be dropped from the plugin in July 2017 or with the next major release of keystoneauth (3.0.0)N(tsuperR	t__init__t	client_idt
client_secrettdiscovery_endpointt_discovery_documenttaccess_token_endpointtaccess_token_typetscopetNonet
grant_typeRtOidcGrantTypeMissmatchtwarningstwarntDeprecationWarning(tselftauth_urltidentity_providertprotocolRR
RRRRRtkwargs((sS/home/tvault/.virtenv/lib/python2.7/site-packages/keystoneauth1/identity/v3/oidc.pyR*s4								cCs³|jdk	r¬|jr¬y|j|jdtƒ}Wn2tjk
ritjdi|jd6ƒ‚nXy|j	ƒ|_Wnt
k
rnX|js¬tjƒ‚q¬n|jS(sÃGet the contents of the OpenID Connect Discovery Document.

        This method grabs the contents of the OpenID Connect Discovery Document
        if a discovery_endpoint was passed to the constructor and returns it as
        a dict, otherwise returns an empty dict. Note that it will fetch the
        discovery document only once, so subsequent calls to this method will
        return the cached result, if any.

        :param session: a session object to send out HTTP requests.
        :type session: keystoneauth1.session.Session

        :returns: a python dictionary containing the discovery document if any,
                  otherwise it will return an empty dict.
        :rtype: dict
        t
authenticateds-Cannot fetch discovery document %(discovery)st	discoveryN(RRRtgettFalseRt	HttpErrort_loggerterrortjsont	ExceptiontInvalidOidcDiscoveryDocument(Rtsessiontresp((sS/home/tvault/.virtenv/lib/python2.7/site-packages/keystoneauth1/identity/v3/oidc.pyt_get_discovery_documentws 

	
	cCsS|jdk	r|jS|j|ƒ}|jdƒ}|dkrOtjƒ‚n|S(sGet the "token_endpoint" for the OpenID Connect flow.

        This method will return the correct access token endpoint to be used.
        If the user has explicitly passed an access_token_endpoint to the
        constructor that will be returned. If there is no explicit endpoint and
        a discovery url is provided, it will try to get it from the discovery
        document. If nothing is found, an exception will be raised.

        :param session: a session object to send out HTTP requests.
        :type session: keystoneauth1.session.Session

        :return: the endpoint to use
        :rtype: string or None if no endpoint is found
        ttoken_endpointN(RRR*R RtOidcAccessTokenEndpointNotFound(RR(Rtendpoint((sS/home/tvault/.virtenv/lib/python2.7/site-packages/keystoneauth1/identity/v3/oidc.pyt_get_access_token_endpoint›scCsY|j|jf}|j|ƒ}|j|d|d|dtƒ}|jƒ|j}|S(séExchange a variety of user supplied values for an access token.

        :param session: a session object to send out HTTP requests.
        :type session: keystoneauth1.session.Session

        :param payload: a dict containing various OpenID Connect values, for
                        example::
                          {'grant_type': 'password', 'username': self.username,
                           'password': self.password, 'scope': self.scope}
        :type payload: dict
        t
requests_authtdataR(RR
R.tpostR!R%R(RR(tpayloadtclient_authRtop_responsetaccess_token((sS/home/tvault/.virtenv/lib/python2.7/site-packages/keystoneauth1/identity/v3/oidc.pyt_get_access_token³s	cCs3id|d6}|j|jd|dtƒ}|S(s Exchange an access token for a keystone token.

        By Sending the access token in an `Authorization: Bearer` header, to
        an OpenID Connect protected endpoint (Federated Token URL). The
        OpenID Connect server will use the access token to look up information
        about the authenticated user (this technique is called instrospection).
        The output of the instrospection will be an OpenID Connect Claim, that
        will be used against the mapping engine. Should the mapping engine
        succeed, a Keystone token will be presented to the user.

        :param session: a session object to send out HTTP requests.
        :type session: keystoneauth1.session.Session

        :param access_token: The OpenID Connect access token.
        :type access_token: str
        sBearer t
AuthorizationtheadersR(R1tfederated_token_urlR!(RR(R5R8t
auth_response((sS/home/tvault/.virtenv/lib/python2.7/site-packages/keystoneauth1/identity/v3/oidc.pyt_get_keystone_tokenÉs
	cCs§|j|ƒ}|jdƒ}|rQ|jdk	rQ|j|krQtjƒ‚n|j|ƒ}|jd|jƒ|j||ƒ}|j	||ƒ}t
jd|ƒS(s$Authenticate with OpenID Connect and get back claims.

        This is a multi-step process:

        1.- An access token must be retrieved from the server. In order to do
            so, we need to exchange an authorization grant or refresh token
            with the token endpoint in order to obtain an access token. The
            authorization grant varies from plugin to plugin.

        2.- We then exchange the access token upon accessing the protected
            Keystone endpoint (federated auth URL). This will trigger the
            OpenID Connect Provider to perform a user introspection and
            retrieve information (specified in the scope) about the user in the
            form of an OpenID Connect Claim. These claims will be sent to
            Keystone in the form of environment variables.

        :param session: a session object to send out HTTP requests.
        :type session: keystoneauth1.session.Session

        :returns: a token data representation
        :rtype: :py:class:`keystoneauth1.access.AccessInfoV3`
        tgrant_types_supportedRR)N(R*R RRRtOidcPluginNotSupportedtget_payloadt
setdefaultR6R;Rtcreate(RR(Rtgrant_typesR2R5tresponse((sS/home/tvault/.virtenv/lib/python2.7/site-packages/keystoneauth1/identity/v3/oidc.pytget_unscoped_auth_refáscCs
tƒ‚dS(s$Get the plugin specific payload for obtainin an access token.

        OpenID Connect supports different grant types. This method should
        prepare the payload that needs to be exchanged with the server in
        order to get an access token for the particular grant type that the
        plugin is implementing.

        :param session: a session object to send out HTTP requests.
        :type session: keystoneauth1.session.Session

        :returns: a python dictionary containing the payload to be exchanged
        :rtype: dict
        N(tNotImplementedError(RR(((sS/home/tvault/.virtenv/lib/python2.7/site-packages/keystoneauth1/identity/v3/oidc.pyR>sN(t__name__t
__module__t__doc__RRRR*R.R6R;RCtabctabstractmethodR>(((sS/home/tvault/.virtenv/lib/python2.7/site-packages/keystoneauth1/identity/v3/oidc.pyR	 sG	$				+cBsAeZdZdZedƒdddddd„ƒZd„ZRS(sEImplementation for OpenID Connect Resource Owner Password Credential.tpasswordiR5cKs\tt|ƒjd|d|d|d|d|d|d|d|||	|_|
|_d	S(
sèThe OpenID Password plugin expects the following.

        :param username: Username used to authenticate
        :type username: string

        :param password: Password used to authenticate
        :type password: string
        RRRRR
RRRN(R
RRtusernameRJ(RRRRRR
RRRRKRJR((sS/home/tvault/.virtenv/lib/python2.7/site-packages/keystoneauth1/identity/v3/oidc.pyR#s	cCs(i|jd6|jd6|jd6}|S(sGet an authorization grant for the "password" grant type.

        :param session: a session object to send out HTTP requests.
        :type session: keystoneauth1.session.Session

        :returns: a python dictionary containing the payload to be exchanged
        :rtype: dict
        RKRJR(RKRJR(RR(R2((sS/home/tvault/.virtenv/lib/python2.7/site-packages/keystoneauth1/identity/v3/oidc.pyR>@s	


N(RERFRGRRRRR>(((sS/home/tvault/.virtenv/lib/python2.7/site-packages/keystoneauth1/identity/v3/oidc.pyRs	cBs;eZdZdZedƒdddd„ƒZd„ZRS(s5Implementation for OpenID Connect Client Credentials.tclient_credentialsiR5c	
KsJtt|ƒjd|d|d|d|d|d|d|d||	d	S(
s÷The OpenID Client Credentials expects the following.

        :param client_id: Client ID used to authenticate
        :type username: string

        :param client_secret: Client Secret used to authenticate
        :type password: string
        RRRRR
RRRN(R
RR(
RRRRRR
RRRR((sS/home/tvault/.virtenv/lib/python2.7/site-packages/keystoneauth1/identity/v3/oidc.pyRTscCsi|jd6}|S(s'Get an authorization grant for the client credentials grant type.

        :param session: a session object to send out HTTP requests.
        :type session: keystoneauth1.session.Session

        :returns: a python dictionary containing the payload to be exchanged
        :rtype: dict
        R(R(RR(R2((sS/home/tvault/.virtenv/lib/python2.7/site-packages/keystoneauth1/identity/v3/oidc.pyR>ns	N(RERFRGRRRRR>(((sS/home/tvault/.virtenv/lib/python2.7/site-packages/keystoneauth1/identity/v3/oidc.pyROs	cBsAeZdZdZedƒdddddd„ƒZd„ZRS(s5Implementation for OpenID Connect Authorization Code.tauthorization_codeiR5cKs\tt|ƒjd|d|d|d|d|d|d|d|||	|_|
|_d	S(
s÷The OpenID Authorization Code plugin expects the following.

        :param redirect_uri: OpenID Connect Client Redirect URL
        :type redirect_uri: string

        :param code: OAuth 2.0 Authorization Code
        :type code: string

        RRRRR
RRRN(R
RRtredirect_uritcode(RRRRRR
RRRRNROR((sS/home/tvault/.virtenv/lib/python2.7/site-packages/keystoneauth1/identity/v3/oidc.pyR€s	cCsi|jd6|jd6}|S(s)Get an authorization grant for the "authorization_code" grant type.

        :param session: a session object to send out HTTP requests.
        :type session: keystoneauth1.session.Session

        :returns: a python dictionary containing the payload to be exchanged
        :rtype: dict
        RNRO(RNRO(RR(R2((sS/home/tvault/.virtenv/lib/python2.7/site-packages/keystoneauth1/identity/v3/oidc.pyR>s	N(RERFRGRRRRR>(((sS/home/tvault/.virtenv/lib/python2.7/site-packages/keystoneauth1/identity/v3/oidc.pyR{s	cBs5eZdZedƒd„ƒZd„Zd„ZRS(s5Implementation for OpenID Connect access token reuse.ic
KsDtt|ƒj|||dddddddd|||_dS(s#The OpenID Connect plugin based on the Access Token.

        It expects the following:

        :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
        :type identity_provider: string

        :param protocol: Protocol name as configured in keystone
        :type protocol: string

        :param access_token: OpenID Connect Access token
        :type access_token: string
        RR
RRN(R
RRRR5(RRRRR5R((sS/home/tvault/.virtenv/lib/python2.7/site-packages/keystoneauth1/identity/v3/oidc.pyR®scCsiS(s+OidcAccessToken does not require a payload.((RR(((sS/home/tvault/.virtenv/lib/python2.7/site-packages/keystoneauth1/identity/v3/oidc.pyR>ËscCs%|j||jƒ}tjd|ƒS(s¼Authenticate with OpenID Connect and get back claims.

        We exchange the access token upon accessing the protected Keystone
        endpoint (federated auth URL). This will trigger the OpenID Connect
        Provider to perform a user introspection and retrieve information
        (specified in the scope) about the user in the form of an OpenID
        Connect Claim. These claims will be sent to Keystone in the form of
        environment variables.

        :param session: a session object to send out HTTP requests.
        :type session: keystoneclient.session.Session

        :returns: a token data representation
        :rtype: :py:class:`keystoneauth1.access.AccessInfoV3`
        R)(R;R5RR@(RR(RB((sS/home/tvault/.virtenv/lib/python2.7/site-packages/keystoneauth1/identity/v3/oidc.pyRCÏs(RERFRGRRR>RC(((sS/home/tvault/.virtenv/lib/python2.7/site-packages/keystoneauth1/identity/v3/oidc.pyR«s	(sOidcAuthorizationCodesOidcClientCredentialssOidcPasswordsOidcAccessToken(RHRRtsixt
keystoneauth1RtutilsRRtkeystoneauth1.identity.v3Rt
get_loggerRER#t__all__t
add_metaclasstABCMetatFederationBaseAuthR	RRRR(((sS/home/tvault/.virtenv/lib/python2.7/site-packages/keystoneauth1/identity/v3/oidc.pyt<module>
s$ý1,0