-
Notifications
You must be signed in to change notification settings - Fork 88
/
Copy pathserver.go
50 lines (45 loc) · 1.99 KB
/
server.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
package server
import (
"time"
"github.com/interuss/dss/pkg/auth"
"github.com/interuss/dss/pkg/rid/application"
)
var (
// Scopes bundles up auth scopes for the remote-id server.
Scopes = struct {
ISA struct {
Write auth.Scope
Read auth.Scope
}
}{
ISA: struct {
Write auth.Scope
Read auth.Scope
}{
Write: "dss.write.identification_service_areas",
Read: "dss.read.identification_service_areas",
},
}
)
// Server implements ridpb.DiscoveryAndSynchronizationService.
type Server struct {
App application.App
Timeout time.Duration
Locality string
EnableHTTP bool
}
// AuthScopes returns a map of endpoint to required Oauth scope.
func (s *Server) AuthScopes() map[auth.Operation]auth.KeyClaimedScopesValidator {
return map[auth.Operation]auth.KeyClaimedScopesValidator{
"/ridpb.DiscoveryAndSynchronizationService/CreateIdentificationServiceArea": auth.RequireAllScopes(Scopes.ISA.Write),
"/ridpb.DiscoveryAndSynchronizationService/DeleteIdentificationServiceArea": auth.RequireAllScopes(Scopes.ISA.Write),
"/ridpb.DiscoveryAndSynchronizationService/GetIdentificationServiceArea": auth.RequireAllScopes(Scopes.ISA.Read),
"/ridpb.DiscoveryAndSynchronizationService/SearchIdentificationServiceAreas": auth.RequireAllScopes(Scopes.ISA.Read),
"/ridpb.DiscoveryAndSynchronizationService/UpdateIdentificationServiceArea": auth.RequireAllScopes(Scopes.ISA.Write),
"/ridpb.DiscoveryAndSynchronizationService/CreateSubscription": auth.RequireAllScopes(Scopes.ISA.Read),
"/ridpb.DiscoveryAndSynchronizationService/DeleteSubscription": auth.RequireAllScopes(Scopes.ISA.Read),
"/ridpb.DiscoveryAndSynchronizationService/GetSubscription": auth.RequireAllScopes(Scopes.ISA.Read),
"/ridpb.DiscoveryAndSynchronizationService/SearchSubscriptions": auth.RequireAllScopes(Scopes.ISA.Read),
"/ridpb.DiscoveryAndSynchronizationService/UpdateSubscription": auth.RequireAllScopes(Scopes.ISA.Read),
}
}