check auth  return value
This commit is contained in:
snoop 2017-06-06 19:53:17 +09:00
parent f68d1e6900
commit e91d23aeac
2 changed files with 26 additions and 0 deletions

View File

@ -28,6 +28,11 @@ type NoAuthAgent struct {
HostName string `json:"hostName,omitempty"` HostName string `json:"hostName,omitempty"`
} }
const (
AUTHSTATUS_WAIT = "WAIT"
AUTHSTATUS_ACCEPT = "ACCEPT"
AUTHSTATUS_REFUSE = "REFUSE"
)
@ -75,6 +80,12 @@ func(as *NoAuthAgentService)CheckAuth(tempKey string) (string,error) {
out := proxy.InvokeDB("noauthAgent", "findByTempKey", memMap); out := proxy.InvokeDB("noauthAgent", "findByTempKey", memMap);
nn := NoAuthAgent{}
err = json.Unmarshal([]byte(out), &nn)
if err != nil {
return "", err
}
return out,nil; return out,nil;
} }

View File

@ -88,3 +88,18 @@ func TestRequestAuth(t *testing.T) {
} }
t.Log(newone) t.Log(newone)
} }
func TestCheckAuth(t *testing.T) {
ns := NewNoAuthAgentService()
str, err := ns.CheckAuth("3398473-90847903874")
if err != nil {
t.Fatal(err)
}
t.Log(str)
}