changeset 2723:a10022399e24

WFS downloads: Fetch user and password from config.
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Tue, 19 Mar 2019 12:42:43 +0100
parents 1c0307207162
children 5bc657f60fd3
files pkg/controllers/uploadedimports.go pkg/imports/dma.go pkg/imports/fd.go pkg/imports/modelconvert.go pkg/imports/wa.go pkg/imports/wp.go pkg/imports/wx.go
diffstat 7 files changed, 33 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/pkg/controllers/uploadedimports.go	Tue Mar 19 12:28:42 2019 +0100
+++ b/pkg/controllers/uploadedimports.go	Tue Mar 19 12:42:43 2019 +0100
@@ -58,12 +58,17 @@
 				precision = &v
 			}
 
+			user := req.FormValue("user")
+			password := req.FormValue("password")
+
 			return &imports.WaterwayProfiles{
 				Dir:         dir,
 				URL:         url,
 				FeatureType: featureType,
 				SortBy:      sortBy,
 				Precision:   precision,
+				User:        user,
+				Password:    password,
 			}, nil
 		},
 	)
--- a/pkg/imports/dma.go	Tue Mar 19 12:28:42 2019 +0100
+++ b/pkg/imports/dma.go	Tue Mar 19 12:42:43 2019 +0100
@@ -35,6 +35,10 @@
 	FeatureType string `json:"feature-type"`
 	// SortBy sorts the feature by this key.
 	SortBy string `json:"sort-by"`
+	// User is an optional username for Basic Auth.
+	User string `json:"user,omitempty"`
+	// Password is an optional password for Basic Auth.
+	Password string `json:"password,omitempty"`
 }
 
 // DMAJobKind is the import queue type identifier.
--- a/pkg/imports/fd.go	Tue Mar 19 12:28:42 2019 +0100
+++ b/pkg/imports/fd.go	Tue Mar 19 12:42:43 2019 +0100
@@ -39,6 +39,10 @@
 	MaxWidth           int    `json:"max-width"`
 	Depth              int    `json:"depth"`
 	SourceOrganization string `json:"source-organization"`
+	// User is an optional username for Basic Auth.
+	User string `json:"user,omitempty"`
+	// Password is an optional password for Basic Auth.
+	Password string `json:"password,omitempty"`
 }
 
 type fdTime struct{ time.Time }
--- a/pkg/imports/modelconvert.go	Tue Mar 19 12:28:42 2019 +0100
+++ b/pkg/imports/modelconvert.go	Tue Mar 19 12:42:43 2019 +0100
@@ -67,6 +67,8 @@
 			URL:         wxi.URL,
 			FeatureType: wxi.FeatureType,
 			SortBy:      nilString(wxi.SortBy),
+			User:        nilString(wxi.User),
+			Password:    nilString(wxi.Password),
 		}
 	},
 
@@ -76,6 +78,8 @@
 			URL:         wai.URL,
 			FeatureType: wai.FeatureType,
 			SortBy:      nilString(wai.SortBy),
+			User:        nilString(wai.User),
+			Password:    nilString(wai.Password),
 		}
 	},
 
@@ -110,6 +114,8 @@
 			MaxWidth:           fdi.MaxWidth,
 			Depth:              fdi.Depth,
 			SourceOrganization: fdi.SourceOrganization,
+			User:               nilString(fdi.User),
+			Password:           nilString(fdi.Password),
 		}
 	},
 
@@ -119,6 +125,8 @@
 			URL:         dmai.URL,
 			FeatureType: dmai.FeatureType,
 			SortBy:      nilString(dmai.SortBy),
+			User:        nilString(dmai.User),
+			Password:    nilString(dmai.Password),
 		}
 	},
 
--- a/pkg/imports/wa.go	Tue Mar 19 12:28:42 2019 +0100
+++ b/pkg/imports/wa.go	Tue Mar 19 12:42:43 2019 +0100
@@ -38,6 +38,10 @@
 	// SortBy works around misconfigured services to
 	// establish a sort order to get the features.
 	SortBy string `json:"sort-by"`
+	// User is an optional username for Basic Auth.
+	User string `json:"user,omitempty"`
+	// Password is an optional password for Basic Auth.
+	Password string `json:"password,omitempty"`
 }
 
 // WAJobKind is the import queue type identifier.
--- a/pkg/imports/wp.go	Tue Mar 19 12:28:42 2019 +0100
+++ b/pkg/imports/wp.go	Tue Mar 19 12:42:43 2019 +0100
@@ -50,6 +50,10 @@
 	SortBy string `json:"sort-by"`
 	// Precsion of match points to line strings.
 	Precision *float64 `json:"precision,omitempty"`
+	// User is an optional username for Basic Auth.
+	User string `json:"user,omitempty"`
+	// Password is an optional password for Basic Auth.
+	Password string `json:"password,omitempty"`
 }
 
 const WPJobKind JobKind = "wp"
--- a/pkg/imports/wx.go	Tue Mar 19 12:28:42 2019 +0100
+++ b/pkg/imports/wx.go	Tue Mar 19 12:42:43 2019 +0100
@@ -37,6 +37,10 @@
 	// SortBy works around misconfigured services to
 	// establish a sort order to get the features.
 	SortBy string `json:"sort-by"`
+	// User is an optional username for Basic Auth.
+	User string `json:"user,omitempty"`
+	// Password is an optional password for Basic Auth.
+	Password string `json:"password,omitempty"`
 }
 
 // WXJobKind is the import queue type identifier.