浏览代码

added intraApiConfig

master
Patrick Peng Sun 8 年前
父节点
当前提交
aa30a6e8f2
共有 1 个文件被更改,包括 8 次插入15 次删除
  1. +8
    -15
      main.go

+ 8
- 15
main.go 查看文件

@@ -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")
}

}

正在加载...
取消
保存