diff --git a/middleware/basic_auth.go b/middleware/basic_auth.go index bf8e8bc3..be321fd5 100644 --- a/middleware/basic_auth.go +++ b/middleware/basic_auth.go @@ -17,7 +17,8 @@ type ( // Required. Validator BasicAuthValidator - // Realm is a string to define realm attribute of BasicAuth + // Realm is a string to define realm attribute of BasicAuth. + // Default value "Restricted". Realm string } @@ -87,7 +88,7 @@ func BasicAuthWithConfig(config BasicAuthConfig) echo.MiddlewareFunc { } } - var realm string + realm := "" if config.Realm == defaultRealm { realm = defaultRealm } else { diff --git a/website/content/middleware/basic-auth.md b/website/content/middleware/basic-auth.md index e6379abc..bd853074 100644 --- a/website/content/middleware/basic-auth.md +++ b/website/content/middleware/basic-auth.md @@ -41,6 +41,10 @@ BasicAuthConfig struct { // Validator is a function to validate BasicAuth credentials. // Required. Validator BasicAuthValidator + + // Realm is a string to define realm attribute of BasicAuth. + // Default value "Restricted". + Realm string } ```