Use this as before_filter for every CheckID request based action.
 Loads the current openid request and cancels if none can be found.
 The user has to log in, if he has not verified his ownership of
 the identifier, yet.
342678
def ensure_valid_checkid_request
      self.openid_request = checkid_request
      if !openid_request.is_a?(OpenID::Server::CheckIDRequest)
        redirect_to root_path, :alert => t(:identity_verification_request_invalid)
      elsif !allow_verification?
        flash[:notice] = logged_in? && !pape_requirements_met?(auth_time) ?
          t(:service_provider_requires_reauthentication_last_login_too_long_ago) :
          t(:login_to_verify_identity)
        session[:return_to] = proceed_path
        redirect_to login_path
      end
    end
865273
protected boolean requiresAuthentication(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) {
    //copied from org.springframework.security.ui.AbstractProcessingFilter.requiresAuthentication
    String uri = request.getRequestURI();
    int pathParamIndex = uri.indexOf(';');

    if (pathParamIndex > 0) {
      // strip everything after the first semi-colon
      uri = uri.substring(0, pathParamIndex);
    }

    if ("".equals(request.getContextPath())) {
      return uri.endsWith(filterProcessesUrl);
    }

    boolean match = uri.endsWith(request.getContextPath() + filterProcessesUrl);
    if (log.isDebugEnabled()) {
      log.debug(uri + (match ? " matches " : " does not match ") + filterProcessesUrl);
    }
    return match;
  }
462850
def check_for_authentication(self):
        
        auth_required = self.current.workflow_name not in settings.ANONYMOUS_WORKFLOWS
        if auth_required and not self.current.is_auth:
            self.current.log.debug("LOGIN REQUIRED:::: %s" % self.current.workflow_name)
            raise HTTPError(401, "Login required for %s" % self.current.workflow_name)
1285027
def oid_login_handler(self, f, oid):
        
        if request.args.get("openid_complete") != u"yes":
            return f(False)
        consumer = Consumer(SessionWrapper(self), oid.store_factory())
        openid_response = consumer.complete(
            request.args.to_dict(), oid.get_current_url()
        )
        if openid_response.status == SUCCESS:
            return self.after_login(OpenIDResponse(openid_response, []))
        elif openid_response.status == CANCEL:
            oid.signal_error(u"The request was cancelled")
            return redirect(oid.get_current_url())
        oid.signal_error(u"OpenID authentication error")
        return redirect(oid.get_current_url())
1023497
def validate_authorization_request(self, request):
        
        # If request.prompt is 'none' then no login/authorization form should
        # be presented to the user. Instead, a silent login/authorization
        # should be performed.
        if request.prompt == 'none':
            raise OIDCNoPrompt()
        else:
            return self.proxy_target.validate_authorization_request(request)
1121001
def usable_id(cls, id):
        
        try:
            # id is maybe a dc_code
            qry_id = cls.from_dc_code(id)
            if not qry_id:
                # id is maybe a ISO
                qry_id = cls.from_iso(id)
                if qry_id:
                    cls.deprecated('ISO code for datacenter filter use '
                                   'dc_code instead')
            if not qry_id:
                # id is maybe a country
                qry_id = cls.from_country(id)
            if not qry_id:
                qry_id = int(id)
        except Exception:
            qry_id = None

        if not qry_id:
            msg = 'unknown identifier %s' % id
            cls.error(msg)

        return qry_id
91920
def cancel(id)
      have_key?
      address = @url_privat + "/api/exchange/orders/" + id
      body = { }
      h = delete_ssl_with_sign(address, body)
      {
        "success" => h["success"],
      }
    end
474543
def _checkSetupNeeded(self, message):
        
        # In OpenID 1, we check to see if this is a cancel from
        # immediate mode by the presence of the user_setup_url
        # parameter.
        if message.isOpenID1():
            user_setup_url = message.getArg(OPENID1_NS, 'user_setup_url')
            if user_setup_url is not None:
                raise SetupNeededError(user_setup_url)
1049668
def _checkAuth(self, message, server_url):
        
        logging.info('Using OpenID check_authentication')
        request = self._createCheckAuthRequest(message)
        if request is None:
            return False
        try:
            response = self._makeKVPost(request, server_url)
        except (fetchers.HTTPFetchingError, ServerError) as e:
            e0 = e.args[0]
            logging.exception('check_authentication failed: %s' % e0)
            return False
        else:
            return self._processCheckAuthResponse(response, server_url)
282046
public BoxRequestsUser.GetUserInfo getUserInfoRequest(String id) {
        BoxRequestsUser.GetUserInfo request = new BoxRequestsUser.GetUserInfo(getUserInformationUrl(id), mSession);
        return request;
    }
1368335
public function removeIDFilterIfNeeded()
    {
        if (!$this->useIdFilter && !$this->idFilterRemoved) {
            array_shift($this->filters);
            $this->idFilterRemoved = true;
        }
    }
1336921
def cancel(id)
      have_key?
      address = @url_private + "/trade_cancel/"
      params = {
        "id" => id,
      }
      h = post_ssl_with_sign(address, params)
      {
        "success" => h["result"],
      }
    end
872081
def verify(cls, user_id, verification_hash):
        
        user = yield cls.get(user_id)

        # If user does not have verification hash then this means they have already been verified
        if 'verification_hash' not in user._resource:
            raise Return(user)

        if user.verification_hash != verification_hash:
            raise exceptions.ValidationError('Invalid verification hash')

        del user.verification_hash
        yield user._save()

        raise Return(user)
447985
def valid_id(opts, id_):
    '''
    
    '''
    try:
        if any(x in id_ for x in ('/', '\\', str('\0'))):
            return False
        return bool(clean_path(opts['pki_dir'], id_))
    except (AttributeError, KeyError, TypeError, UnicodeDecodeError):
        return False
169707
def usable_id(cls, id):
        
        try:
            # id is maybe a sshkey name
            qry_id = cls.from_name(id)
            if not qry_id:
                qry_id = int(id)
        except DuplicateResults as exc:
            cls.error(exc.errors)
        except Exception:
            qry_id = None

        if not qry_id:
            msg = 'unknown identifier %s' % id
            cls.error(msg)

        return qry_id
17441
def load(self, id, *args, **kwargs):
        
        self._pre_load(id, *args, **kwargs)
        response = self._load(id, *args, **kwargs)
        response = self._post_load(response, *args, **kwargs)
        return response
65778
def id_exists(api, search_id):
    
    response = utils.checked_api_call(api, 'get_specific', id=search_id)
    return response is not None