当前位置: 首页>>代码示例>>Python>>正文


Python OpenIDServiceEndpoint.type_uris方法代码示例

本文整理汇总了Python中openid.consumer.discover.OpenIDServiceEndpoint.type_uris方法的典型用法代码示例。如果您正苦于以下问题:Python OpenIDServiceEndpoint.type_uris方法的具体用法?Python OpenIDServiceEndpoint.type_uris怎么用?Python OpenIDServiceEndpoint.type_uris使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在openid.consumer.discover.OpenIDServiceEndpoint的用法示例。


在下文中一共展示了OpenIDServiceEndpoint.type_uris方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: begin

# 需要导入模块: from openid.consumer.discover import OpenIDServiceEndpoint [as 别名]
# 或者: from openid.consumer.discover.OpenIDServiceEndpoint import type_uris [as 别名]
 def begin(self, url):
     endpoint = OpenIDServiceEndpoint()
     endpoint.claimed_id = 'oid'
     endpoint.server_url = 'http://localhost/'
     endpoint.type_uris = [OPENID_2_0_TYPE]
     auth_request = consumer.AuthRequest(endpoint, None)
     return auth_request
开发者ID:miing,项目名称:mci_migo,代码行数:9,代码来源:test_views_consumer.py

示例2: v1endpoint

# 需要导入模块: from openid.consumer.discover import OpenIDServiceEndpoint [as 别名]
# 或者: from openid.consumer.discover.OpenIDServiceEndpoint import type_uris [as 别名]
 def v1endpoint(self, port):
     """Return an OpenID 1.1 OpenIDServiceEndpoint for the server."""
     base = "http://%s:%s" % (socket.getfqdn('127.0.0.1'), port)
     ep = OpenIDServiceEndpoint()
     ep.claimed_id = base + "/id/bob"
     ep.server_url = base + "/openidserver"
     ep.type_uris = [OPENID_1_1_TYPE]
     return ep
开发者ID:jefftriplett,项目名称:python-openid,代码行数:10,代码来源:test_examples.py

示例3: _verifyDiscoveryResultsOpenID2

# 需要导入模块: from openid.consumer.discover import OpenIDServiceEndpoint [as 别名]
# 或者: from openid.consumer.discover.OpenIDServiceEndpoint import type_uris [as 别名]
def _verifyDiscoveryResultsOpenID2(self, resp_msg, endpoint):
    to_match = OpenIDServiceEndpoint()
    to_match.type_uris = [OPENID_2_0_TYPE]
    to_match.claimed_id = resp_msg.getArg(OPENID2_NS, 'claimed_id')
    to_match.local_id = resp_msg.getArg(OPENID2_NS, 'identity')

    # Raises a KeyError when the op_endpoint is not present
    to_match.server_url = resp_msg.getArg(
        OPENID2_NS, 'op_endpoint', no_default)

    # claimed_id and identifier must both be present or both
    # be absent
    if (to_match.claimed_id is None and
        to_match.local_id is not None):
        raise consumer.ProtocolError(
            'openid.identity is present without openid.claimed_id')

    elif (to_match.claimed_id is not None and
          to_match.local_id is None):
        raise consumer.ProtocolError(
            'openid.claimed_id is present without openid.identity')

    # This is a response without identifiers, so there's really no
    # checking that we can do, so return an endpoint that's for
    # the specified `openid.op_endpoint'
    elif to_match.claimed_id is None:
        return OpenIDServiceEndpoint.fromOPEndpointURL(to_match.server_url)

    # The claimed ID doesn't match, so we have to do discovery
    # again. This covers not using sessions, OP identifier
    # endpoints and responses that didn't match the original
    # request.
    if to_match.server_url.startswith(u'https://www.google.com/a/'):
        import urllib
        claimed_id = u'https://www.google.com/accounts/o8/user-xrds?uri=%s' % urllib.quote_plus(to_match.claimed_id)
    else:
        claimed_id = to_match.claimed_id

    if not endpoint:
        oidutil.log('No pre-discovered information supplied.')
        endpoint = self._discoverAndVerify(claimed_id, [to_match])
    else:
        # The claimed ID matches, so we use the endpoint that we
        # discovered in initiation. This should be the most common
        # case.
        try:
            self._verifyDiscoverySingle(endpoint, to_match)
        except consumer.ProtocolError, e:
            oidutil.log(
                "Error attempting to use stored discovery information: " +
                str(e))
            oidutil.log("Attempting discovery to verify endpoint")
            endpoint = self._discoverAndVerify(
                claimed_id, [to_match])
开发者ID:10clouds,项目名称:django-federated-login,代码行数:56,代码来源:patches.py

示例4: make_identifier_select_endpoint

# 需要导入模块: from openid.consumer.discover import OpenIDServiceEndpoint [as 别名]
# 或者: from openid.consumer.discover.OpenIDServiceEndpoint import type_uris [as 别名]
    def make_identifier_select_endpoint(self, protocol_uri):
        """Create an endpoint for use in OpenID identifier select mode.

        :arg protocol_uri: The URI for the OpenID protocol version.  This
            should be one of the OPENID_X_Y_TYPE constants.

        If the OpenID 1.x protocol is selected, the endpoint will be
        suitable for use with Launchpad's non-standard identifier select
        workflow.
        """
        msg = "Unexpected protocol URI: %s" % protocol_uri
        assert protocol_uri in OPENID_TYPES, msg

        endpoint = OpenIDServiceEndpoint()
        endpoint.server_url = self.base_openid_url
        if protocol_uri == OPENID_2_0_TYPE:
            endpoint.type_uris = [OPENID_IDP_2_0_TYPE]
        else:
            endpoint.type_uris = [protocol_uri]
            endpoint.claimed_id = IDENTIFIER_SELECT
            endpoint.local_id = IDENTIFIER_SELECT
        return endpoint
开发者ID:miing,项目名称:mci_migo,代码行数:24,代码来源:helpers.py

示例5: make_endpoint

# 需要导入模块: from openid.consumer.discover import OpenIDServiceEndpoint [as 别名]
# 或者: from openid.consumer.discover.OpenIDServiceEndpoint import type_uris [as 别名]
    def make_endpoint(self, protocol_uri, claimed_id, local_id=None):
        """Create an endpoint for use with `Consumer.beginWithoutDiscovery`.

        :arg protocol_uri: The URI for the OpenID protocol version.  This
            should be one of the OPENID_X_Y_TYPE constants.
        :arg claimed_id: The claimed identity URL for the endpoint.
        :arg local_id: The OP local identifier for the endpoint.  If this
            argument is not provided, it defaults to claimed_id.
        """
        msg = "Unexpected protocol URI: %s" % protocol_uri
        assert protocol_uri in OPENID_TYPES, msg

        endpoint = OpenIDServiceEndpoint()
        endpoint.type_uris = [protocol_uri]
        endpoint.server_url = self.base_openid_url
        endpoint.claimed_id = claimed_id
        endpoint.local_id = local_id or claimed_id
        return endpoint
开发者ID:miing,项目名称:mci_migo,代码行数:20,代码来源:helpers.py

示例6: make_endpoint

# 需要导入模块: from openid.consumer.discover import OpenIDServiceEndpoint [as 别名]
# 或者: from openid.consumer.discover.OpenIDServiceEndpoint import type_uris [as 别名]
def make_endpoint(protocol_uri, claimed_id, local_id=None):
    """Create an endpoint for use with `Consumer.beginWithoutDiscovery`.

    :arg protocol_uri: The URI for the OpenID protocol version.  This
        should be one of the OPENID_X_Y_TYPE constants.
    :arg claimed_id: The claimed identity URL for the endpoint.
    :arg local_id: The OP local identifier for the endpoint.  If this
        argument is not provided, it defaults to claimed_id.
    """
    assert protocol_uri in [
        OPENID_1_0_TYPE, OPENID_1_1_TYPE, OPENID_2_0_TYPE], (
        "Unexpected protocol URI: %s" % protocol_uri)

    endpoint = OpenIDServiceEndpoint()
    endpoint.type_uris = [protocol_uri]
    endpoint.server_url = get_requested_server_url(claimed_id)
    endpoint.claimed_id = claimed_id
    endpoint.local_id = local_id or claimed_id
    return endpoint
开发者ID:miing,项目名称:mci_migo,代码行数:21,代码来源:openidhelpers.py

示例7: make_identifier_select_endpoint

# 需要导入模块: from openid.consumer.discover import OpenIDServiceEndpoint [as 别名]
# 或者: from openid.consumer.discover.OpenIDServiceEndpoint import type_uris [as 别名]
def make_identifier_select_endpoint():
    """Create an endpoint for use in OpenID identifier select mode."""
    endpoint = OpenIDServiceEndpoint()
    endpoint.server_url = get_server_url()
    endpoint.type_uris = [OPENID_IDP_2_0_TYPE]
    return endpoint
开发者ID:vitaminmoo,项目名称:unnaturalcode,代码行数:8,代码来源:helpers.py


注:本文中的openid.consumer.discover.OpenIDServiceEndpoint.type_uris方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。