Set whether or not the route must use HTTPS.

If set to true, the request must be an HTTPS request;
if false, it must *not* be HTTPS.

Example:

->secure()
541105
public function secure(bool $secure = true) : RouteBuilder
    {
        foreach ($this->routes as $route) {
            $route->secure($secure);
        }
        return $this;
    }
582305
function isSecure(url) {
    if (typeof url !== 'string') {
      return false;
    }
    var parts = url.split('://');
    if (parts[0] === 'https') {
      return true;
    }
    return false;
  }
682788
function securedRoute(seneca, options, context, method, middleware, route) {
  const routeArgs = [route.path].concat(middleware).concat([
    (request, reply, next) => {
      if (!request.user) {
        return reply.redirect(route.secure.fail)
      }
      handleRoute(seneca, options, request, reply, route, next)
    }
  ])

  context[method].apply(context, routeArgs)
}
965217
def correct_uri(url)
      return unless url.is_a?(String) && !url.empty?

      uri = URI(url)
      uri.scheme == 'http' ? known_https(uri) : uri
    end
822852
def request(self, request):
        
        if request is None:
            raise ValueError("Invalid value for `request`, must not be `None`")
        if request is not None and not re.search('^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$', request):
            raise ValueError("Invalid value for `request`, must be a follow pattern or equal to `/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/`")

        self._request = request
517738
def __need_ssl(self, host_and_port=None):
        
        if not host_and_port:
            host_and_port = self.current_host_and_port

        return host_and_port in self.__ssl_params
107309
def should_require_authentication(self, url):
        
        return (not self.routes # require auth for all URLs
                or any(route.match(url) for route in self.routes))
409161
public void setSecure(boolean isSecure) throws URIException {
        mIsSecure = isSecure;

        if (mUri == null) {
            // mUri not yet set
            return;
        }

        URI newUri = mUri;

        // check if URI consistent
        if (isSecure() && mUri.getScheme().equalsIgnoreCase(HTTP)) {
            newUri = new URI(mUri.toString().replaceFirst(HTTP, HTTPS), true);
            
        } else if (!isSecure() && mUri.getScheme().equalsIgnoreCase(HTTPS)) {
            newUri = new URI(mUri.toString().replaceFirst(HTTPS, HTTP), true);
        }

        if (newUri != mUri) {
            mUri = newUri;
            setHostPort(mUri.getPort());
        }
    }
967521
private static boolean isSecure(String protocol) throws BugError {
		if (HTTP.equalsIgnoreCase(protocol)) {
			return false;
		} else if (HTTPS.equalsIgnoreCase(protocol)) {
			return true;
		} else {
			throw new BugError("Unsupported protocol |%s| for HTTP transaction.", protocol);
		}
	}
623023
def validate_request(request):
    
    if getattr(settings, 'BASICAUTH_DISABLE', False):
        # Not to use this env
        return True

    if 'HTTP_AUTHORIZATION' not in request.META:
        return False

    authorization_header = request.META['HTTP_AUTHORIZATION']
    ret = extract_basicauth(authorization_header)
    if not ret:
        return False

    username, password = ret

    raw_pass = settings.BASICAUTH_USERS.get(username)
    if raw_pass is None:
        return False

    # To avoid timing atacks
    # https://security.stackexchange.com/questions/83660/simple-string-comparisons-not-secure-against-timing-attacks
    if not constant_time_compare(raw_pass, password):
        return False

    request.META['REMOTE_USER'] = username
    return True
1092227
private static function canRoute() {
        $httpContext = self::$config['httpContext'];

        if ($httpContext->isIgnoredRoute()) {
            $request = $httpContext->getRequest();
            $response = $httpContext->getResponse();
            $response->clear();

            if (!file_exists($request->documentRoot() . $request->path())) {
                $response->setStatusCode(404);
            }
            else {
                require($request->documentRoot() . $request->path());
            }

            $response->end();
            return false;
        }

        $route = $httpContext->getRoute();

        if ($route == null) {
            $response = $httpContext->getResponse();
            $response->setStatusCode(404);
            $response->end();
            return false;
        }

        return $route;
    }
777664
def request_uri=(new_request_uri)
      if !new_request_uri.respond_to?(:to_str)
        raise TypeError, "Can't convert #{new_request_uri.class} into String."
      end
      if self.absolute? && self.scheme !~ /^https?$/i
        raise InvalidURIError,
          "Cannot set an HTTP request URI for a non-HTTP URI."
      end
      new_request_uri = new_request_uri.to_str
      path_component = new_request_uri[/^([^\?]*)\??(?:.*)$/, 1]
      query_component = new_request_uri[/^(?:[^\?]*)\?(.*)$/, 1]
      path_component = path_component.to_s
      path_component = (!path_component.empty? ? path_component : SLASH)
      self.path = path_component
      self.query = query_component

      # Reset dependent values
      remove_composite_values
    end
132179
protected function _secureRequired(Controller $controller)
    {
        if (is_array($this->_config['requireSecure']) &&
            !empty($this->_config['requireSecure'])
        ) {
            $requireSecure = $this->_config['requireSecure'];

            if (in_array($this->_action, $requireSecure) || $requireSecure === ['*']) {
                if (!$this->getController()->getRequest()->is('ssl')) {
                    throw new SecurityException(
                        'Request is not SSL and the action is required to be secure'
                    );
                }
            }
        }

        return true;
    }
1231954
def is_resource_protected(self, request, **kwargs):
        
        exempt_urls = self.get_exempt_url_patterns()
        protected_urls = self.get_protected_url_patterns()
        path = request.path_info.lstrip('/')

        path_is_exempt = any(m.match(path) for m in exempt_urls)
        if path_is_exempt:
            return False

        path_is_protected = any(m.match(path) for m in protected_urls)
        if path_is_protected:
            return True

        return False
669688
def has_page?(url)
      schemes = %w(http https)
      if schemes.include? url.scheme
        u = url.dup
        return schemes.any? { |s| u.scheme = s; has_key?(u) }
      end

      has_key? url
    end
933934
@Override
  public boolean isSecure(HttpServletRequest request) {
    String proto = request.getHeader(X_FORWARED_PROTO);
    if( proto != null ) return proto.equalsIgnoreCase(HTTPS_PROTOCOL);
    return super.isSecure(request);
  }
761731
def is_valid_request(self, request, parameters={},
                         fake_method=None, handle_error=True):
        '''
        

        '''
        try:
            # Set the parameters to be what we were passed earlier
            # if we didn't get any passed to us now
            if not parameters and hasattr(self, 'params'):
                parameters = self.params

            method, url, headers, parameters = self.parse_request(
                request, parameters, fake_method)

            oauth_request = oauth2.Request.from_request(
                method,
                url,
                headers=headers,
                parameters=parameters)

            self.oauth_server.verify_request(
                oauth_request, self.oauth_consumer, {})

        except oauth2.MissingSignature, e:
            if handle_error:
                return False
            else:
                raise e
        # Signature was valid
        return True