created hwsauth module
This commit is contained in:
22
hwsauth/ignorepaths.go
Normal file
22
hwsauth/ignorepaths.go
Normal file
@@ -0,0 +1,22 @@
|
||||
package hwsauth
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/url"
|
||||
)
|
||||
|
||||
func (auth *Authenticator[T]) IgnorePaths(paths ...string) error {
|
||||
for _, path := range paths {
|
||||
u, err := url.Parse(path)
|
||||
valid := err == nil &&
|
||||
u.Scheme == "" &&
|
||||
u.Host == "" &&
|
||||
u.RawQuery == "" &&
|
||||
u.Fragment == ""
|
||||
if !valid {
|
||||
return fmt.Errorf("Invalid path: '%s'", path)
|
||||
}
|
||||
}
|
||||
auth.ignoredPaths = paths
|
||||
return nil
|
||||
}
|
||||
Reference in New Issue
Block a user