refactor to improve database operability in hwsauth
This commit is contained in:
@@ -5,7 +5,15 @@ import (
|
||||
"net/url"
|
||||
)
|
||||
|
||||
func (auth *Authenticator[T]) IgnorePaths(paths ...string) error {
|
||||
// IgnorePaths excludes specified paths from authentication middleware.
|
||||
// Paths must be valid URL paths (relative paths without scheme or host).
|
||||
//
|
||||
// Example:
|
||||
//
|
||||
// auth.IgnorePaths("/", "/login", "/register", "/public", "/static")
|
||||
//
|
||||
// Returns an error if any path is invalid.
|
||||
func (auth *Authenticator[T, TX]) IgnorePaths(paths ...string) error {
|
||||
for _, path := range paths {
|
||||
u, err := url.Parse(path)
|
||||
valid := err == nil &&
|
||||
|
||||
Reference in New Issue
Block a user