From 175da8f22cd791e81338fe61e6099125868cf5a0 Mon Sep 17 00:00:00 2001 From: Melonai Date: Mon, 26 Jul 2021 23:50:43 +0200 Subject: Basic Authentication and Authorization --- config.go | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'config.go') 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 +} -- cgit 1.4.1