summary refs log tree commit diff
path: root/config.go
diff options
context:
space:
mode:
authorMelonai <einebeere@gmail.com>2021-07-26 23:50:43 +0200
committerMelonai <einebeere@gmail.com>2021-07-26 23:50:43 +0200
commit175da8f22cd791e81338fe61e6099125868cf5a0 (patch)
tree91a234d8aafd54be34aae5ff5b948b34e52fb020 /config.go
parent83a8214119eccb39f4c38e7b1ae54daebdeb0184 (diff)
downloadportgate-175da8f22cd791e81338fe61e6099125868cf5a0.tar.zst
portgate-175da8f22cd791e81338fe61e6099125868cf5a0.zip
Basic Authentication and Authorization
Diffstat (limited to 'config.go')
-rw-r--r--config.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/config.go b/config.go
index b4e0754..7630e87 100644
--- a/config.go
+++ b/config.go
@@ -13,6 +13,10 @@ type Config struct {
 
 	allowedPorts   []int
 	forbiddenPorts []int
+
+	key string
+
+	jwtSecret string
 }
 
 // GetConfig creates the Portgate config from outside sources such as
@@ -25,6 +29,8 @@ func GetConfig() (Config, error) {
 
 		allowedPorts:   []int{80},
 		forbiddenPorts: []int{},
+
+		key: "password",
 	}, nil
 }
 
@@ -43,3 +49,8 @@ func (c *Config) MakeUrl(p Path) string {
 	// TODO: Figure out what to do with TLS
 	return fmt.Sprintf("http://%s:%d%s", c.targetHost, p.DestinationIdentifier, p.ResourcePath)
 }
+
+// CheckKey checks whether the givenKey matches the one in the config.
+func (c *Config) CheckKey(givenKey string) bool {
+	return c.key == givenKey
+}