def userinfo(access_token, scope_request=None, claims_request=None):
    """
    Returns data required for an OpenID Connect UserInfo response, according to:

    http://openid.net/specs/openid-connect-basic-1_0.html#UserInfoResponse

    Supports scope and claims request parameter as described in:

    - http://openid.net/specs/openid-connect-core-1_0.html#ScopeClaims
    - http://openid.net/specs/openid-connect-core-1_0.html#ClaimsParameter

    Arguments: access_token (:class:`AccessToken`): Associated access
        token.  scope_request (list): Optional list of requested
        scopes. Only scopes authorized in the `access_token` will be
            considered.  claims_request
        (dict): Optional dictionary with a claims request parameter.

    Information on the claims request parameter specification:

    - http://openid.net/specs/openid-connect-core-1_0.html#ClaimsParameter

    As a convinience, if neither `scope_request` or user_info claim is
    specified in the `claims_request`, it will return the claims for
    all the scopes in the `access_token`.

    Returns an :class:`IDToken` instance with the scopes from the
    `scope_request` and the corresponding claims. Claims in the
    `claims_request` paramater userinfo section will be included *in
    addition* to the ones corresponding to `scope_request`.

    """

    handlers = HANDLERS['userinfo']

    # Select only the relevant section of the claims request.
    claims_request_section = claims_request.get('userinfo', {}) if claims_request else {}

    # If nothing is requested, return the claims for the scopes in the access token.
    if not scope_request and not claims_request_section:
        scope_request = provider.scope.to_names(access_token.scope)
    else:
        scope_request = scope_request

    scopes, claims = collect(
        handlers,
        access_token,
        scope_request=scope_request,
        claims_request=claims_request_section,
    )

    return IDToken(access_token, scopes, claims)
def userinfo ( access_token , scope_request = None , claims_request = None ) : handlers = HANDLERS [ 'userinfo' ] claims_request_section = claims_request . get ( 'userinfo' , { } ) if claims_request else { } if not scope_request and not claims_request_section : scope_request = provider . scope . to_names ( access_token . scope ) else : scope_request = scope_request scopes , claims = collect ( handlers , access_token , scope_request = scope_request , claims_request = claims_request_section , ) return IDToken ( access_token , scopes , claims )
Returns data required for an OpenID Connect UserInfo response, according to:

    http://openid.net/specs/openid-connect-basic-1_0.html#UserInfoResponse

    Supports scope and claims request parameter as described in:

    - http://openid.net/specs/openid-connect-core-1_0.html#ScopeClaims
    - http://openid.net/specs/openid-connect-core-1_0.html#ClaimsParameter

    Arguments: access_token (:class:`AccessToken`): Associated access
        token.  scope_request (list): Optional list of requested
        scopes. Only scopes authorized in the `access_token` will be
            considered.  claims_request
        (dict): Optional dictionary with a claims request parameter.

    Information on the claims request parameter specification:

    - http://openid.net/specs/openid-connect-core-1_0.html#ClaimsParameter

    As a convinience, if neither `scope_request` or user_info claim is
    specified in the `claims_request`, it will return the claims for
    all the scopes in the `access_token`.

    Returns an :class:`IDToken` instance with the scopes from the
    `scope_request` and the corresponding claims. Claims in the
    `claims_request` paramater userinfo section will be included *in
    addition* to the ones corresponding to `scope_request`.