/
obj_security.go
61 lines (50 loc) · 1.53 KB
/
obj_security.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
package objects
import (
. "github.com/zubairhamed/betwixt"
)
type SecurityObject struct {
Model ObjectDefinition
}
func (o *SecurityObject) OnExecute(instanceId int, resourceId int, req Lwm2mRequest) Lwm2mResponse {
return Unauthorized()
}
func (o *SecurityObject) OnCreate(instanceId int, resourceId int, req Lwm2mRequest) Lwm2mResponse {
return Unauthorized()
}
func (o *SecurityObject) OnDelete(instanceId int, req Lwm2mRequest) Lwm2mResponse {
return Unauthorized()
}
func (o *SecurityObject) OnRead(instanceId int, resourceId int, req Lwm2mRequest) Lwm2mResponse {
return Unauthorized()
}
func (o *SecurityObject) OnWrite(instanceId int, resourceId int, req Lwm2mRequest) Lwm2mResponse {
return Unauthorized()
}
func NewExampleSecurityObject(reg Registry) *SecurityObject {
/*
data.Put("/0/0", "coap://bootstrap.example.com")
data.Put("/0/1", true)
data.Put("/0/2", 0)
data.Put("/0/3", "[identity string]")
data.Put("/0/4", "[secret key data]")
data.Put("/0/10", 0)
data.Put("/0/11", 3600)
data.Put("/1/0", "coap://server1.example.com")
data.Put("/1/1", false)
data.Put("/1/2", 0)
data.Put("/1/3", "[identity string]")
data.Put("/1/4", "[secret key data]")
data.Put("/1/10", 101)
data.Put("/1/11", 0)
data.Put("/2/0", "coap://server2.example.com")
data.Put("/2/1", false)
data.Put("/2/2", 0)
data.Put("/2/3", "[identity string]")
data.Put("/2/4", "[secret key data]")
data.Put("/2/10", 102)
data.Put("/2/11", 0)
*/
return &SecurityObject{
Model: reg.GetDefinition(OMA_OBJECT_LWM2M_SECURITY),
}
}