Collect user info claims that are to be placed in the id token.

    :param endpoint_context: Endpoint context
    :param session: Session information
    :param def_itc: Default ID Token claims
    :return: User information or None
331205
def userinfo_in_id_token_claims(endpoint_context, session, def_itc=None):
    
    if def_itc:
        itc = def_itc
    else:
        itc = {}

    itc.update(id_token_claims(session))

    if not itc:
        return None

    _claims = by_schema(endpoint_context.id_token_schema, **itc)

    if _claims:
        return collect_user_info(endpoint_context, session, _claims)
    else:
        return None
1288572
def verify(self, user, identity):
        
        return UserIdentityRequest(self).put(self.endpoint.verify, user, identity)
927359
def _CaptureUserId(self):
    """"""
    user_kind, user_id = user_id_collector()
    if user_kind and user_id:
      self.breakpoint['evaluatedUserId'] = {'kind': user_kind, 'id': user_id}
1013805
def get_context_data(self, **kwargs):
        '''  '''

        # Update the site session data so that registration processes know to send return links to
        # the view class registrations page.  set_return_page() is in SiteHistoryMixin.
        self.set_return_page('viewregistrations',_('View Registrations'),event_id=self.object.id)

        context = {
            'event': self.object,
            'registrations': EventRegistration.objects.filter(
                event=self.object,
                cancelled=False
            ).order_by('registration__customer__user__first_name', 'registration__customer__user__last_name'),
        }
        context.update(kwargs)
        return super(EventRegistrationSummaryView, self).get_context_data(**context)
274819
def get_userinfo(self, access_token, id_token, payload):
        """"""

        user_response = requests.get(
            self.OIDC_OP_USER_ENDPOINT,
            headers={
                'Authorization': 'Bearer {0}'.format(access_token)
            },
            verify=self.get_settings('OIDC_VERIFY_SSL', True))
        user_response.raise_for_status()
        return user_response.json()
937528
def claim_new_token(self):
        
        # Intentionally doing this manually so we don't have a chicken and egg problem with DataServiceApi.
        headers = {
            'Content-Type': ContentType.json,
            'User-Agent': self.user_agent_str,
        }
        data = {
            "agent_key": self.config.agent_key,
            "user_key": self.config.user_key,
        }
        url_suffix = "/software_agents/api_token"
        url = self.config.url + url_suffix
        response = requests.post(url, headers=headers, data=json.dumps(data))
        if response.status_code == 404:
            if not self.config.agent_key:
                raise MissingInitialSetupError()
            else:
                raise SoftwareAgentNotFoundError()
        elif response.status_code == 503:
            raise DataServiceError(response, url_suffix, data)
        elif response.status_code != 201:
            raise AuthTokenCreationError(response)
        resp_json = response.json()
        self._auth = resp_json['api_token']
        self._expires = resp_json['expires_on']
1235911
def _get_tokens(self, authn_response, context):
        
        if "code" in authn_response:
            # make token request
            args = {
                "code": authn_response["code"],
                "redirect_uri": self.client.registration_response['redirect_uris'][0],
            }

            token_resp = self.client.do_access_token_request(scope="openid", state=authn_response["state"],
                                                             request_args=args,
                                                             authn_method=self.client.registration_response[
                                                                 "token_endpoint_auth_method"])

            self._check_error_response(token_resp, context)
            return token_resp["access_token"], token_resp["id_token"]

        return authn_response.get("access_token"), authn_response.get("id_token")
96209
def request_get_user(self, user_ids) -> dict:
        
        method_params = {'user_ids': user_ids}
        response = self.session.send_method_request('users.get', method_params)
        self.check_for_errors('users.get', method_params, response)
        return response
93667
def _collect_values(handlers, names, user, client, values):
    

    results = {}

    def visitor(claim_name, func):
        data = {'user': user, 'client': client}
        data.update(values.get(claim_name) or {})
        claim_value = func(data)
        # If the claim_value is None, it means that the claim is not authorized.
        if claim_value is not None:
            # New values overwrite previous results
            results[claim_name] = claim_value

    _visit_handlers(handlers, visitor, 'claim', names)

    return results
309210
def token_getter(is_personal=True, is_internal=False):
    
    def wrapper(f):
        @wraps(f)
        def decorated(*args, **kwargs):
            if 'token_id' not in kwargs:
                abort(500)

            token = Token.query.filter_by(
                id=kwargs.pop('token_id'),
                user_id=current_user.get_id(),
                is_personal=is_personal,
                is_internal=is_internal,
            ).first()

            if token is None:
                abort(404)

            return f(token, *args, **kwargs)
        return decorated
    return wrapper
81124
def register_endpoints(self):
        
        url_map = []
        sp_endpoints = self.sp.config.getattr("endpoints", "sp")
        for endp, binding in sp_endpoints["assertion_consumer_service"]:
            parsed_endp = urlparse(endp)
            url_map.append(("^%s$" % parsed_endp.path[1:], functools.partial(self.authn_response, binding=binding)))

        if self.discosrv:
            for endp, binding in sp_endpoints["discovery_response"]:
                parsed_endp = urlparse(endp)
                url_map.append(
                    ("^%s$" % parsed_endp.path[1:], self.disco_response))

        if self.expose_entityid_endpoint():
            parsed_entity_id = urlparse(self.sp.config.entityid)
            url_map.append(("^{0}".format(parsed_entity_id.path[1:]),
                            self._metadata_endpoint))

        return url_map
671149
def get_user_entitlement(self, user_id):
        
        route_values = {}
        if user_id is not None:
            route_values['userId'] = self._serialize.url('user_id', user_id, 'str')
        response = self._send(http_method='GET',
                              location_id='8480c6eb-ce60-47e9-88df-eca3c801638b',
                              version='5.0-preview.2',
                              route_values=route_values)
        return self._deserialize('UserEntitlement', response)
1269796
def request_verification(self, user, identity):
        
        return UserIdentityRequest(self).put(self.endpoint.request_verification, user, identity)
227043
def getRegistered(self, context = ""):
		
		myobjs = {}
		try:
			# Python 2.x
			objs_iterator = self._objs[context].iteritems()
		except AttributeError:
			# Python 3.x
			objs_iterator = self._objs[context].items()
		for oidstr, snmpobj in objs_iterator:
			myobjs[oidstr] = {
				"type": type(snmpobj).__name__,
				"value": snmpobj.value()
			}
		return dict(myobjs)
624701
def get_user_id(self, provider, info):
        ""
        id_key = self.provider_id or 'id'
        result = info
        try:
            for key in id_key.split('.'):
                result = result[key]
            return result
        except KeyError:
            return None
742395
def get_user_token(self):
        
        headers = { 'User-Agent': self.user_agent(),
                'Host': self.domain(),
                'Accept': '*/*',
        }
        headers.update(self.headers())
        r = requests.get(   self.portals_url()+'/users/_this/token',
                            headers=headers,
                            auth=self.auth())
        if HTTP_STATUS.OK == r.status_code:
            return r.text
        else:
            print("get_user_token: Something went wrong: <{0}>: {1}".format(
                        r.status_code, r.reason))
            r.raise_for_status()
244979
def get_user(self, validated_token):
        
        try:
            user_id = validated_token[api_settings.USER_ID_CLAIM]
        except KeyError:
            raise InvalidToken(_('Token contained no recognizable user identification'))

        try:
            user = User.objects.get(**{api_settings.USER_ID_FIELD: user_id})
        except User.DoesNotExist:
            raise AuthenticationFailed(_('User not found'), code='user_not_found')

        if not user.is_active:
            raise AuthenticationFailed(_('User is inactive'), code='user_inactive')

        return user