Christian Weichel da4cafd5e5
Gitpod OIDC Identity Provider (#16482)
* Prototype IDP provider

* [gp cli] Add IDP commands

* [public-api] Remove zitadel based IDP implementation

* [gitpod-cli] Add IDP support for Vault

* [idp] Remove per-org IDP

* [idp] Add key cache and random key IDs

* [idp] Defer GetIDToken authorisation to server

* [idp] Add Redis public key cache

* [gitpod-cli] Hide IDP commands

* [idp] Add key ID to JWT

* [idp] Add unit tests

* [idp] Adress review comments

* [public-api-server] Use logging middleware globally

* [public-api-server] Simplify service registration

* [idp] Add Redis outage resilience
2023-03-03 17:11:01 +01:00

34 lines
800 B
Go

// Copyright (c) 2022 Gitpod GmbH. All rights reserved.
// Licensed under the GNU Affero General Public License (AGPL).
// See License.AGPL.txt in the project root for license information.
package middleware
import (
"net/http"
"time"
"github.com/gitpod-io/gitpod/common-go/log"
"github.com/sirupsen/logrus"
)
type Middleware func(handler http.Handler) http.Handler
func NewLoggingMiddleware() Middleware {
return func(next http.Handler) http.Handler {
logging := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
start := time.Now()
next.ServeHTTP(w, r)
duration := time.Since(start)
log.WithFields(logrus.Fields{
"uri": r.RequestURI,
"method": r.Method,
"duration": duration,
}).Debug("Handled HTTP request")
})
return logging
}
}