# infrastructure/longhorn/ui-ingress/middleware.yaml
apiVersion: traefik.io/v1alpha1
kind: Middleware
metadata:
  name: longhorn-basicauth
  namespace: longhorn-system
spec:
  basicAuth:
    secret: longhorn-basic-auth
    realm: "Longhorn Dashboard"

---

apiVersion: traefik.io/v1alpha1
kind: Middleware
metadata:
  name: longhorn-headers
  namespace: longhorn-system
spec:
  headers:
    customRequestHeaders:
      X-Forwarded-Proto: "https"

---

apiVersion: traefik.io/v1alpha1
kind: Middleware
metadata:
  name: longhorn-forward-auth
  namespace: longhorn-system
spec:
  forwardAuth:
    address: https://auth.bstein.dev/oauth2/auth
    trustForwardHeader: true
    authResponseHeaders:
      - Authorization
      - X-Auth-Request-Email
      - X-Auth-Request-User
      - X-Auth-Request-Groups
