about summary refs log tree commit diff
path: root/fun/watchblob/urls.go
diff options
context:
space:
mode:
authorVincent Ambo <tazjin@google.com>2019-12-21T01·11+0000
committerVincent Ambo <tazjin@google.com>2019-12-21T01·11+0000
commit96b82a8033ba1ccae89226cd99f64018f223b7ea (patch)
tree3a000a1741fa666a461435f5e757fdc6ad2b74f4 /fun/watchblob/urls.go
parent58f2f6f12da5a7b3bda6fa44d2ae4ffd70a0735e (diff)
parent24b075bdeba5457a96965ceb705ffc8d57f03388 (diff)
merge(watchblob): Integrate at //fun/watchblob r/266
Diffstat (limited to 'fun/watchblob/urls.go')
-rw-r--r--fun/watchblob/urls.go37
1 files changed, 37 insertions, 0 deletions
diff --git a/fun/watchblob/urls.go b/fun/watchblob/urls.go
new file mode 100644
index 000000000000..37f65e0faef4
--- /dev/null
+++ b/fun/watchblob/urls.go
@@ -0,0 +1,37 @@
+package main
+
+import (
+	"fmt"
+	"net/url"
+	"strconv"
+)
+
+const urlFormat string = "https://%s%s"
+const uriFormat = "/?%s"
+
+func templateChallengeTriggerUri(username *string, password *string) string {
+	v := url.Values{}
+	v.Set("action", "sslvpn_logon")
+	v.Set("style", "fw_logon_progress.xsl")
+	v.Set("fw_logon_type", "logon")
+	v.Set("fw_domain", "Firebox-DB")
+	v.Set("fw_username", *username)
+	v.Set("fw_password", *password)
+
+	return fmt.Sprintf(uriFormat, v.Encode())
+}
+
+func templateResponseUri(logonId int, token *string) string {
+	v := url.Values{}
+	v.Set("action", "sslvpn_logon")
+	v.Set("style", "fw_logon_progress.xsl")
+	v.Set("fw_logon_type", "response")
+	v.Set("response", *token)
+	v.Set("fw_logon_id", strconv.Itoa(logonId))
+
+	return fmt.Sprintf(uriFormat, v.Encode())
+}
+
+func templateUrl(baseUrl *string, uri string) string {
+	return fmt.Sprintf(urlFormat, *baseUrl, uri)
+}