prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  OpenIDC SSO through apache stopped working after update to 3.7.6
  ### Deployment Type
  
  Self-hosted
  
  ### NetBox Version
  
  v3.7.6
  
  ### Python Version
  
  3.9
  
  ### Steps to Reproduce
  
  This is a longstanding NetBox instance. It runs under gunicorn, proxied through apache which is configured to use mod_auth_openid for authentication. 
  
  NetBox's configuration includes:
  REMOTE_AUTH_ENABLED = True
  REMOTE_AUTH_BACKEND = 'netbox.authentication.RemoteUserBackend'
  REMOTE_AUTH_HEADER = 'HTTP_OIDC_CLAIM_PREFERRED_USERNAME'
  REMOTE_AUTH_AUTO_CREATE_USER = True
  
  This was working fine until the update to 3.7.6 following our usual procedure:
  
  Pull and checkout v3.7.6.
  
  Run upgrade.sh
  
  Restart NetBox gunicorn service, netbox-rq and apache
  
  Since the upgrade, NetBox has presented a login box instead of logging in as the REMOTE_AUTH_HEADER user. Using tcpdump, I can see the "OIDC_CLAIM_preferred_username" header is being sent to gunicorn. Other instances using the same OpenIDC configuration are working.
  
  
  ### Expected Behavior
  
  REMOTE_AUTH login using OpenIDC credentials.
  
  ### Observed Behavior
  
  The web frontend prompts for username and password.
  
  </issue>
  <code>
  [start of contrib/gunicorn.py]
  1 # The IP address (typically localhost) and port that the NetBox WSGI process should listen on
  2 bind = '127.0.0.1:8001'
  3 
  4 # Number of gunicorn workers to spawn. This should typically be 2n+1, where
  5 # n is the number of CPU cores present.
  6 workers = 5
  7 
  8 # Number of threads per worker process
  9 threads = 3
  10 
  11 # Timeout (in seconds) for a request to complete
  12 timeout = 120
  13 
  14 # The maximum number of requests a worker can handle before being respawned
  15 max_requests = 5000
  16 max_requests_jitter = 500
  17
  [end of contrib/gunicorn.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/contrib/gunicorn.py b/contrib/gunicorn.py
  --- a/contrib/gunicorn.py
  +++ b/contrib/gunicorn.py
  @@ -14,3 +14,7 @@
   # The maximum number of requests a worker can handle before being respawned
   max_requests = 5000
   max_requests_jitter = 500
  +
  +# Uncomment this line to accept HTTP headers containing underscores, e.g. for remote
  +# authentication support. See https://docs.gunicorn.org/en/stable/settings.html#header-map
  +# header-map = 'dangerous'
  
verification_info: {"golden_diff": "diff --git a/contrib/gunicorn.py b/contrib/gunicorn.py\n--- a/contrib/gunicorn.py\n+++ b/contrib/gunicorn.py\n@@ -14,3 +14,7 @@\n # The maximum number of requests a worker can handle before being respawned\n max_requests = 5000\n max_requests_jitter = 500\n+\n+# Uncomment this line to accept HTTP headers containing underscores, e.g. for remote\n+# authentication support. See https://docs.gunicorn.org/en/stable/settings.html#header-map\n+# header-map = 'dangerous'\n", "issue": "OpenIDC SSO through apache stopped working after update to 3.7.6\n### Deployment Type\n\nSelf-hosted\n\n### NetBox Version\n\nv3.7.6\n\n### Python Version\n\n3.9\n\n### Steps to Reproduce\n\nThis is a longstanding NetBox instance. It runs under gunicorn, proxied through apache which is configured to use mod_auth_openid for authentication. \r\n\r\nNetBox's configuration includes:\r\nREMOTE_AUTH_ENABLED = True\r\nREMOTE_AUTH_BACKEND = 'netbox.authentication.RemoteUserBackend'\r\nREMOTE_AUTH_HEADER = 'HTTP_OIDC_CLAIM_PREFERRED_USERNAME'\r\nREMOTE_AUTH_AUTO_CREATE_USER = True\r\n\r\nThis was working fine until the update to 3.7.6 following our usual procedure:\r\n\r\nPull and checkout v3.7.6.\r\n\r\nRun upgrade.sh\r\n\r\nRestart NetBox gunicorn service, netbox-rq and apache\r\n\r\nSince the upgrade, NetBox has presented a login box instead of logging in as the REMOTE_AUTH_HEADER user. Using tcpdump, I can see the \"OIDC_CLAIM_preferred_username\" header is being sent to gunicorn. Other instances using the same OpenIDC configuration are working.\r\n\n\n### Expected Behavior\n\nREMOTE_AUTH login using OpenIDC credentials.\n\n### Observed Behavior\n\nThe web frontend prompts for username and password.\n", "before_files": [{"content": "# The IP address (typically localhost) and port that the NetBox WSGI process should listen on\nbind = '127.0.0.1:8001'\n\n# Number of gunicorn workers to spawn. This should typically be 2n+1, where\n# n is the number of CPU cores present.\nworkers = 5\n\n# Number of threads per worker process\nthreads = 3\n\n# Timeout (in seconds) for a request to complete\ntimeout = 120\n\n# The maximum number of requests a worker can handle before being respawned\nmax_requests = 5000\nmax_requests_jitter = 500\n", "path": "contrib/gunicorn.py"}]}