Bläddra i källkod

added intraApiConfig

master
Patrick Peng Sun 8 år sedan
förälder
incheckning
aa30a6e8f2
1 ändrade filer med 8 tillägg och 15 borttagningar
  1. +8
    -15
      main.go

+ 8
- 15
main.go Visa fil

log.Fatal("unable to read crm_config.json, program quit") log.Fatal("unable to read crm_config.json, program quit")
} }


err = IntraAPIConfig.readConfig()
if err != nil {
log.Println(err)
log.Fatal("unable to read intra-api-config, program quit")
}

initAllProc() initAllProc()
setupRootFileServer() setupRootFileServer()
startSessionManager(2048) startSessionManager(2048)


func supplyAccessToken(w http.ResponseWriter, r *http.Request) { func supplyAccessToken(w http.ResponseWriter, r *http.Request) {
logRequestDebug(httputil.DumpRequest(r, true)) logRequestDebug(httputil.DumpRequest(r, true))
signature := ""
nonce := ""
timestamp := ""
for _, c := range r.Cookies() {
switch c.Name {
case "signature":
signature = c.Value
case "nonce":
nonce = c.Value
case "timestamp":
timestamp = c.Value
}
}
if verifySignature(signature, timestamp, nonce, IntraAPIConfig.CRMSecrete) {
if checkSignatureByToken(r, IntraAPIConfig.CRMSecrete) {
atk, _ := GetAccessToken() atk, _ := GetAccessToken()
fmt.Fprint(w, atk) fmt.Fprint(w, atk)
} else { } else {
fmt.Fprint(w, "fuck this world")
fmt.Fprint(w, "errortoken")
} }


} }

Laddar…
Avbryt
Spara