forked from Ivasoft/opds-proxy
feat: "local only" automatic authentication
Often you want to expose your library publicly, which requires authentication to prevent unknown users from seeing your content. In my case, I also expose the library on a local domain using a local DNS server which doesn't have these security issues. This change adds a `local_only` option to the feed auth config which will only supply the provided username/password when the request comes from a private IP address. Omitting `local_only` or setting to false will keep the current logic of sending the credentials no matter the origin of the request.
This commit is contained in:
13
main.go
13
main.go
@@ -28,10 +28,15 @@ type AuthConfig struct {
|
||||
}
|
||||
|
||||
type FeedConfig struct {
|
||||
Name string `koanf:"name"`
|
||||
Url string `koanf:"url"`
|
||||
Username string `koanf:"username"`
|
||||
Password string `koanf:"password"`
|
||||
Name string `koanf:"name"`
|
||||
Url string `koanf:"url"`
|
||||
Auth *FeedConfigAuth `koanf:"auth"`
|
||||
}
|
||||
|
||||
type FeedConfigAuth struct {
|
||||
Username string `koanf:"username"`
|
||||
Password string `koanf:"password"`
|
||||
LocalOnly bool `koanf:"local_only"`
|
||||
}
|
||||
|
||||
func main() {
|
||||
|
||||
Reference in New Issue
Block a user