mirror of
https://github.com/yusing/godoxy.git
synced 2026-04-21 07:51:28 +02:00
refactor(middleware): replace path prefix checks with function-based approach
Replace simple path prefix-based enforcement/bypass mechanism with a more flexible function-based approach. This allows for more complex conditions to determine when middleware should be enforced or bypassed. - Add checkReqFunc and checkRespFunc types for flexible condition checking - Replace enforcedPathPrefixes with separate enforce and bypass check functions - Add static asset path detection for automatic bypassing - Separate request and response check logic for better granularity
This commit is contained in:
@@ -28,6 +28,10 @@ type oidcMiddleware struct {
|
||||
|
||||
var OIDC = NewMiddleware[oidcMiddleware]()
|
||||
|
||||
func isOIDCAuthPath(r *http.Request) bool {
|
||||
return strings.HasPrefix(r.URL.Path, auth.OIDCAuthBasePath)
|
||||
}
|
||||
|
||||
func (amw *oidcMiddleware) finalize() error {
|
||||
if !auth.IsOIDCEnabled() {
|
||||
log.Error().Msg("OIDC not enabled but OIDC middleware is used")
|
||||
|
||||
Reference in New Issue
Block a user