Documentation
¶
Index ¶
- Variables
- func DoPostToGetToken(uri string, args ...string) (status int, rv string)
- func GetJWTToken() string
- func GuranteeCurrentToken()
- func HasPort(s string) bool
- func RemoveEmptyPort(host string) string
- func SetCommon(ttlp *int, mx *sync.Mutex)
- func Setup(cfg *ProxyApiConfigType, dbf map[string]bool, lfp *os.File)
- type ExtractTokenType
- type ProxyApiConfigType
- type ProxyConfig
- type ProxyList
Constants ¶
This section is empty.
Variables ¶
var DbFlags map[string]bool
var ProxyListData = map[string]ProxyList{ "Animal": ProxyList{AuthReq: true}, "Batch": ProxyList{AuthReq: true}, "Bulk": ProxyList{AuthReq: true}, "Carcass": ProxyList{AuthReq: true}, "Event": ProxyList{AuthReq: true}, "Location": ProxyList{AuthReq: true}, "Log": ProxyList{AuthReq: true}, "Participant": ProxyList{AuthReq: true}, "Product": ProxyList{AuthReq: true}, "Role": ProxyList{AuthReq: true}, "User": ProxyList{AuthReq: true}, "UserRole": ProxyList{AuthReq: true}, }
Functions ¶
func DoPostToGetToken ¶
curl -X POST "http://18.236.106.250:31415/api/Token" -H "accept: application/json" -H "Content-Type: application/json-patch+json" -d "{ \"username\": \"enduser\", \"password\": \"...\"}"
func GetJWTToken ¶
func GetJWTToken() string
func HasPort ¶
Given a string of the form "host", "host:port", or "[ipv6::address]:port", return true if the string includes a port.
func RemoveEmptyPort ¶
RemoveEmptyPort strips the empty port in ":port" to "" as mandated by RFC 3986 Section 6.2.3.
Types ¶
type ExtractTokenType ¶
type ExtractTokenType struct {
JWTToken string `json:"token"`
}
type ProxyApiConfigType ¶
type ProxyApiConfigType struct {
// Post JSON to this with un/pw to get a JWT token - use that as an "Authentication: Bearrer"
// This will need to run in a go-routine and time out after the number of seconds. A new request
// with re-auth.
JWTTokenUser string `json:"jwt_token_user" default:"$ENV$JWT_TOKEN_USER"`
JWTTokenAuth string `json:"jwt_token_auth" default:"$ENV$JWT_TOKEN_AUTH_KEY"`
GetJWTTimeSec int `json:"get_jwt_time" default:"1700"`
GetJWTTOken string `json:"get_jwt" default:"http://dev.2c-why.com:48484/api/Token"`
}
--------------------------------------------------------------------------------------------------------- Proxy Setup - config - shuld be moved out to a "proxy" thing ---------------------------------------------------------------------------------------------------------
type ProxyConfig ¶
type ProxyConfig struct {
Target string
}
func SetupRedirectTo ¶
func SetupRedirectTo(target string) (rv *ProxyConfig)
func (*ProxyConfig) HandleRedirectToProxyClosure ¶
func (proxyConfig *ProxyConfig) HandleRedirectToProxyClosure() (fx func(w http.ResponseWriter, r *http.Request))
func (*ProxyConfig) ServeHTTP ¶
func (p *ProxyConfig) ServeHTTP(wr http.ResponseWriter, req *http.Request)