| @@ -35,6 +35,12 @@ func main() { | |||
| 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() | |||
| setupRootFileServer() | |||
| startSessionManager(2048) | |||
| @@ -98,24 +104,11 @@ func dumpReuestHandler(w http.ResponseWriter, r *http.Request) { | |||
| func supplyAccessToken(w http.ResponseWriter, r *http.Request) { | |||
| 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() | |||
| fmt.Fprint(w, atk) | |||
| } else { | |||
| fmt.Fprint(w, "fuck this world") | |||
| fmt.Fprint(w, "errortoken") | |||
| } | |||
| } | |||