changed
check auth return value
This commit is contained in:
parent
f68d1e6900
commit
e91d23aeac
|
@ -28,6 +28,11 @@ type NoAuthAgent struct {
|
|||
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);
|
||||
|
||||
nn := NoAuthAgent{}
|
||||
err = json.Unmarshal([]byte(out), &nn)
|
||||
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return out,nil;
|
||||
}
|
||||
|
|
|
@ -88,3 +88,18 @@ func TestRequestAuth(t *testing.T) {
|
|||
}
|
||||
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)
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user