def __init__(self, client_get, client_authn_factory=None, conf=None): Service.__init__(self, client_get, client_authn_factory=client_authn_factory, conf=conf) self.pre_construct = [self.get_id_token_hint, self.add_post_logout_redirect_uri, self.add_state]
def __init__(self, client_get, client_authn_factory=None, conf=None): Service.__init__(self, client_get, client_authn_factory=client_authn_factory, conf=conf) self.pre_construct.append(self.cc_pre_construct) self.post_construct.append(self.cc_post_construct)
def __init__(self, client_get, client_authn_factory=None, conf=None, rel='', **kwargs): Service.__init__(self, client_get, client_authn_factory=client_authn_factory, conf=conf, **kwargs) self.rel = rel or OIC_ISSUER
def __init__(self, client_get, client_authn_factory=None, conf=None): Service.__init__(self, client_get, client_authn_factory=client_authn_factory, conf=conf) self.pre_construct.extend( [pre_construct_pick_redirect_uri, set_state_parameter]) self.post_construct.append(self.store_auth_request)
def __init__(self, client_get, client_authn_factory=None, conf=None): Service.__init__(self, client_get, client_authn_factory=client_authn_factory, conf=conf) self.pre_construct = [ self.add_client_behaviour_preference, #add_redirect_uris, add_callback_uris, add_jwks_uri_or_jwks ] self.post_construct = [self.oidc_post_construct]
def service_request(self, service: Service, url: str, method: Optional[str] = "GET", body: Optional[dict] = None, response_body_type: Optional[str] = "", headers: Optional[dict] = None, **kwargs) -> Message: """ The method that sends the request and handles the response returned. This assumes that the response arrives in the HTTP response. :param service: The Service instance :param url: The URL to which the request should be sent :param method: Which HTTP method to use :param body: A message body if any :param response_body_type: The expected format of the body of the return message :param httpc_params: Arguments for the HTTP client :return: A cls or ResponseMessage instance or the HTTP response instance if no response body was expected. """ if headers is None: headers = {} logger.debug(REQUEST_INFO.format(url, method, body, headers)) try: response = service.get_response_ext(url, method, body, response_body_type, headers, **kwargs) except AttributeError: response = self.get_response(service, url, method, body, response_body_type, headers, **kwargs) if 'error' in response: pass else: try: kwargs['key'] = kwargs['state'] except KeyError: pass service.update_service_context(response, **kwargs) return response
def gather_request_args(self, **kwargs): ar_args = Service.gather_request_args(self, **kwargs) if 'redirect_uri' not in ar_args: try: ar_args['redirect_uri'] = self.client_get( "service_context").redirect_uris[0] except (KeyError, AttributeError): raise MissingParameter('redirect_uri') return ar_args
def get_response(self, service: Service, url: str, method: Optional[str] = "GET", body: Optional[dict] = None, response_body_type: Optional[str] = "", headers: Optional[dict] = None, **kwargs): """ :param url: :param method: :param body: :param response_body_type: :param headers: :param kwargs: :return: """ try: resp = self.http(url, method, data=body, headers=headers) except Exception as err: logger.error('Exception on request: {}'.format(err)) raise if 300 <= resp.status_code < 400: return {'http_response': resp} if resp.status_code < 300: if "keyjar" not in kwargs: kwargs["keyjar"] = service.client_get("service_context").keyjar if not response_body_type: response_body_type = service.response_body_type if response_body_type == 'html': return resp.text if body: kwargs['request_body'] = body return self.parse_request_response(service, resp, response_body_type, **kwargs)
def __init__(self, client_get, client_authn_factory=None, conf=None): Service.__init__(self, client_get, client_authn_factory=client_authn_factory, conf=conf)
def __init__(self, client_get, client_authn_factory=None, conf=None): Service.__init__(self, client_get, client_authn_factory=client_authn_factory, conf=conf) self.pre_construct = [self.oidc_pre_construct]