mirror of
https://github.com/zitadel/zitadel.git
synced 2025-03-01 17:27:24 +00:00

# Which Problems Are Solved - Adds infrastructure code (basic implementation, error handling, middlewares, ...) to implement the SCIM v2 interface - Adds support for the user create SCIM v2 endpoint # How the Problems Are Solved - Adds support for the user create SCIM v2 endpoint under `POST /scim/v2/{orgID}/Users` # Additional Context Part of #8140
27 lines
1.1 KiB
Go
27 lines
1.1 KiB
Go
package middleware
|
|
|
|
import "net/http"
|
|
|
|
// HandlerFuncWithError is a http handler func which can return an error
|
|
// the error should then get handled later on in the pipeline by an error handler
|
|
// the error handler can be dependent on the interface standard (e.g. SCIM, Problem Details, ...)
|
|
type HandlerFuncWithError = func(w http.ResponseWriter, r *http.Request) error
|
|
|
|
// MiddlewareWithErrorFunc is a http middleware which can return an error
|
|
// the error should then get handled later on in the pipeline by an error handler
|
|
// the error handler can be dependent on the interface standard (e.g. SCIM, Problem Details, ...)
|
|
type MiddlewareWithErrorFunc = func(HandlerFuncWithError) HandlerFuncWithError
|
|
|
|
// ErrorHandlerFunc handles errors and returns a regular http handler
|
|
type ErrorHandlerFunc = func(HandlerFuncWithError) http.Handler
|
|
|
|
func ChainedWithErrorHandler(errorHandler ErrorHandlerFunc, middlewares ...MiddlewareWithErrorFunc) func(HandlerFuncWithError) http.Handler {
|
|
return func(next HandlerFuncWithError) http.Handler {
|
|
for i := len(middlewares) - 1; i >= 0; i-- {
|
|
next = middlewares[i](next)
|
|
}
|
|
|
|
return errorHandler(next)
|
|
}
|
|
}
|