See super class method satosa.frontends.base.FrontendModule#handle_authn_response
        :type context: satosa.context.Context
        :type internal_response: satosa.internal.InternalData
        :rtype satosa.response.Response
768182
def handle_authn_response(self, context, internal_response):
        
        return self._handle_authn_response(context, internal_response, self.idp)
975196
def _handle_authentication_error(self):
        
        response = make_response('Access Denied')
        response.headers['WWW-Authenticate'] = self.auth.get_authenticate_header()
        response.status_code = 401
        return response
1318327
def disco_response(self, context):
        
        info = context.request
        state = context.state

        try:
            entity_id = info["entityID"]
        except KeyError as err:
            satosa_logging(logger, logging.DEBUG, "No IDP chosen for state", state, exc_info=True)
            raise SATOSAAuthenticationError(state, "No IDP chosen") from err

        return self.authn_request(context, entity_id)
274941
private AuthenticationResult handleJwtSSO(HttpServletRequest req, HttpServletResponse res) {
        String jwtCookieName = JwtSSOTokenHelper.getJwtCookieName();
        if (jwtCookieName == null) { // jwtsso feature not active
            return null;
        }

        String encodedjwtssotoken = ssoCookieHelper.getJwtSsoTokenFromCookies(req, jwtCookieName);

        if (encodedjwtssotoken == null) { //jwt sso cookie is missing, look at the auth header
            encodedjwtssotoken = getJwtBearerToken(req);
        }
        if (encodedjwtssotoken == null) {
            return null;
        } else {
            if (LoggedOutJwtSsoCookieCache.contains(encodedjwtssotoken)) {
                String LoggedOutMsg = "JWT_ALREADY_LOGGED_OUT";
                if (req.getAttribute(LoggedOutMsg) == null) {
                    Tr.audit(tc, LoggedOutMsg, new Object[] {});
                    req.setAttribute(LoggedOutMsg, "true");
                }

                return new AuthenticationResult(AuthResult.FAILURE, Tr.formatMessage(tc, LoggedOutMsg));
            }
            return authenticateWithJwt(req, res, encodedjwtssotoken);
        }
    }
201713
def auth(context, request):
    

    if ploneapi.user.is_anonymous():
        request.response.setStatus(401)
        request.response.setHeader('WWW-Authenticate',
                                   'basic realm="JSONAPI AUTH"', 1)

    logger.info("*** BASIC AUTHENTICATE ***")
    return {}
302626
def _handle_response(self, response):
        
        status = response.status_code
        if status == 400:
          msg = u"bad request"
          raise exceptions.BadRequest(status, msg)
        elif status == 401:
          msg = u"authorization failed user:%s" % (self.sk_user)
          raise exceptions.Unauthorized(status, msg)
        elif status == 404:
          raise exceptions.NotFound()
        elif status == 422:
          msg = u"bad request"
          raise exceptions.BadRequest(status, msg)
        elif status in range(400, 500):
          msg = u"unexpected bad request"
          raise exceptions.BadRequest(status, msg) 
        elif status in range(500, 600):
          raise exceptions.ServerError()
        return response
1056485
def process(self, request, response, environ):
        
        token_data = self.create_token(
            client_id=self.client.identifier,
            data=self.data,
            grant_type=AuthorizationCodeGrant.grant_type,
            scopes=self.scopes,
            user_id=self.user_id)

        self.auth_code_store.delete_code(self.code)

        if self.scopes:
            token_data["scope"] = encode_scopes(self.scopes)

        json_success_response(data=token_data, response=response)

        return response
332990
def token(request, response, verify_user, context=None, **kwargs):
    
    token = request.get_header('Authorization')
    if token:
        try:
            verified_token = verify_user(token)
        except TypeError:
            verified_token = verify_user(token, context)
        if verified_token:
            return verified_token
        else:
            return False
    return None
180847
def access_token_response_data(self, access_token, response_type=None, nonce=''):
        

        # Clear the scope for requests that do not use OpenID Connect.
        # Scopes for pure OAuth2 request are currently not supported.
        scope = constants.DEFAULT_SCOPE

        extra_data = {}

        # Add OpenID Connect `id_token` if requested.
        #
        # TODO: Unfourtunately because of how django-oauth2-provider implements
        # scopes, we cannot check if `openid` is the first scope to be
        # requested, as required by OpenID Connect specification.

        if provider.scope.check(constants.OPEN_ID_SCOPE, access_token.scope):
            id_token = self.get_id_token(access_token, nonce)
            extra_data['id_token'] = self.encode_id_token(id_token)
            scope = provider.scope.to_int(*id_token.scopes)

        # Update the token scope, so it includes only authorized values.
        access_token.scope = scope
        access_token.save()

        # Get the main fields for OAuth2 response.
        response_data = super(AccessTokenView, self).access_token_response_data(access_token)

        # Add any additional fields if OpenID Connect is requested. The order of
        # the addition makes sures the OAuth2 values are not overrided.
        response_data = dict(extra_data.items() + response_data.items())

        return response_data
375998
def handle_backend_error(self, exception):
        
        auth_req = self._get_authn_request_from_state(exception.state)
        # If the client sent us a state parameter, we should reflect it back according to the spec
        if 'state' in auth_req:
            error_resp = AuthorizationErrorResponse(error="access_denied",
                                                    error_description=exception.message,
                                                    state=auth_req['state'])
        else:
            error_resp = AuthorizationErrorResponse(error="access_denied",
                                                    error_description=exception.message)
        satosa_logging(logger, logging.DEBUG, exception.message, exception.state)
        return SeeOther(error_resp.request(auth_req["redirect_uri"], should_fragment_encode(auth_req)))
1129826
def handle_response(response)
      type, msgid, error, result = response
      if observable = @requests[msgid]
        @requests[msgid].set_response(result, error)
      else
        warn "unknown response with id=#{msgid}"
      end
    end
38451
def _handler_response(self, response, data=None):
        
        if response.status_code == 200:
            data = response.json()
            if isinstance(data, dict) and data.get("error_code"):

                raise WeiboAPIError(data.get("request"), data.get("error_code"), data.get("error"))
            else:
                return data
        else:
            raise WeiboRequestError(
                "Weibo API request error: status code: {code} url:{url} ->"
                " method:{method}: data={data}".format(
                    code=response.status_code,
                    url=response.url,
                    method=response.request.method,
                    data=data
                )
            )
672641
def parse_response(object)
      LOG.debug("response is #{object}")
      case object
        when ::Net::HTTPUnauthorized
          ::File.delete(ACCESS_TOKEN)
          raise 'user revoked oauth connection'
        when ::Net::HTTPOK then
          object.body
      end
    end
578423
def parse_auth_response(self, auth_response):
        

        auth_dict = dict()
        auth_response = auth_response.json()
        LOG.debug('Authentication Response Body [ %s ]', auth_response)

        access = auth_response.get('access')
        access_token = access.get('token')
        access_tenant = access_token.get('tenant')
        access_user = access.get('user')

        auth_dict['os_token'] = access_token.get('id')
        auth_dict['os_tenant'] = access_tenant.get('name')
        auth_dict['os_user'] = access_user.get('name')

        if not auth_dict['os_token']:
            raise exceptions.AuthenticationProblem(
                'When attempting to grab the tenant or user nothing was'
                ' found. No Token Found to Parse. Here is the DATA: [ %s ]'
                ' Stack Trace [ %s ]',
                auth_response,
                traceback.format_exc()
            )

        region = self.job_args.get('os_region')
        print(region)
        if not region:
            raise exceptions.SystemProblem('No Region Set')

        service_catalog = access.pop('serviceCatalog')

        # Get the storage URL
        object_endpoints = self._service_endpoints(
            service_catalog=service_catalog,
            types_list=turbolift.__srv_types__
        )

        # In the legacy internal flag is set override the os_endpoint_type
        #  TODO(cloudnull) Remove this in future releases
        if 'internal' in self.job_args and self.job_args['internal']:
            LOG.warn(
                'The use of the ``--internal`` flag has been deprecated and'
                ' will be removed in future releases. Please use the'
                ' ``--os-endpoint-type`` flag and set the type name'
                ' instead. In the case of using snet (service net) this is'
                ' generally noted as "internalURL". Example setting:'
                ' ``--os-endpoint-type internalURL``'
            )
            self.job_args['os_endpoint_type'] = 'internalURL'

        auth_dict['storage_url'] = get_service_url(
            region=region,
            endpoint_list=object_endpoints,
            lookup=self.job_args['os_endpoint_type']
        )

        # Get the CDN URL
        cdn_endpoints = self._service_endpoints(
            service_catalog=service_catalog, types_list=turbolift.__cdn_types__
        )

        if cdn_endpoints:
            auth_dict['cdn_storage_url'] = get_service_url(
                region=region,
                endpoint_list=cdn_endpoints,
                lookup=self.job_args['cdn_endpoint_type']
            )

        return auth_dict
178836
def handle_response(response)
      case response.code.to_i
        when 301,302
          raise "Redirect"
        when 200...400
          response
        when 400
          raise "Bad Request"
        when 401
          raise "Unauthorized Access"
        when 403
          raise "Forbidden Access"
        when 404
          raise "Rescoure not found"
        when 405
          raise "Method not allowed"
        when 409
          raise RequestError.new("Rescource conflict")
        when 422
          raise RequestError.new("Resource invalid")
        when 401...500
          raise "Client error"
        when 500...600
          raise RequestError.new("Server error")
        else
          raise "Unknown response: #{response.code.to_i}"
      end
    end
1283589
def authorization_error_class(response):
    
    message = response.headers.get("www-authenticate")
    if message:
        error = message.replace('"', "").rsplit("=", 1)[1]
    else:
        error = response.status_code
    return _auth_error_mapping[error](response)
503461
def from_response(self, response_data):
        ''' 

        '''
        return HSAccessTokenAuth(
            response_data['access_token'],
            response_data['token_type'], 
            response_data['refresh_token'],
            response_data['expires_in'], 
            response_data.get('state') # Not always here
        )