2017-02-11 12:27:12 +01:00
|
|
|
package main
|
|
|
|
|
2017-02-13 09:55:24 +01:00
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"net/url"
|
|
|
|
"strconv"
|
|
|
|
)
|
2017-02-11 12:27:12 +01:00
|
|
|
|
|
|
|
const urlFormat string = "https://%s%s"
|
2017-02-13 09:55:24 +01:00
|
|
|
const uriFormat = "/?%s"
|
2017-02-11 12:27:12 +01:00
|
|
|
|
|
|
|
func templateChallengeTriggerUri(username *string, password *string) string {
|
2017-02-13 09:55:24 +01:00
|
|
|
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())
|
2017-02-11 12:27:12 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
func templateResponseUri(logonId int, token *string) string {
|
2017-02-13 09:55:24 +01:00
|
|
|
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())
|
2017-02-11 12:27:12 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
func templateUrl(baseUrl *string, uri string) string {
|
2017-02-13 09:55:24 +01:00
|
|
|
return fmt.Sprintf(urlFormat, *baseUrl, uri)
|
2017-02-11 12:27:12 +01:00
|
|
|
}
|