-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
68 lines (56 loc) · 3.03 KB
/
main.go
File metadata and controls
68 lines (56 loc) · 3.03 KB
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
62
63
64
65
66
67
68
package main
import (
"log"
"net/http"
"github.com/gorilla/mux"
)
func main() {
router := mux.NewRouter()
// Identity Management API
// https://app.swaggerhub.com/apis/NDID/identity/1.0
router.HandleFunc("/identity", CreateIdentity).Methods("POST")
router.HandleFunc("/identity/{namespace}/{identifier}", FetchIdentity).Methods("GET")
router.HandleFunc("/identity/{namespace}/{identifier}", NewIdentifiers).Methods("POST")
router.HandleFunc("/identity/{namespace}/{identifier}/endorsement", FetchEndorsement).Methods("GET")
router.HandleFunc("/identity/{namespace}/{identifier}/endorsement", SubmitEndorsement).Methods("POST")
router.HandleFunc("/identity/{namespace}/{identifier}/accessors", AddAccessorMethod).Methods("POST")
router.HandleFunc("/identity/{namespace}/{identifier}/requests/history", FetchRequestHistory).Methods("GET")
// IDP
// https://app.swaggerhub.com/apis/NDID/identity_provider/1.0
router.HandleFunc("/idp/callback", RetrieveCallbackUrl).Methods("GET")
router.HandleFunc("/idp/callback", SetUrlCallback).Methods("POST")
router.HandleFunc("/idp/response", IdpResponse).Methods("POST")
// RP
// https://app.swaggerhub.com/apis/NDID/relying_party_api/1.0
router.HandleFunc("/rp/requests/{namespace}/{identifier}", RequestToId).Methods("POST")
router.HandleFunc("/rp/requests/{namespace}/{identifier}/{timeout}", RequestToId).Methods("POST")
router.HandleFunc("/rp/requests/{request_id}", FetchRequestStatus).Methods("GET")
router.HandleFunc("/rp/requests/reference/{reference_number}", GetRefNo).Methods("GET")
router.HandleFunc("/rp/requests/data/{request_id}", GetData).Methods("GET")
// AS
// https://app.swaggerhub.com/apis/NDID/authoritative_source_api/1.0
router.HandleFunc("/as/service/{service_id}", AddUpdateAsService).Methods("POST")
router.HandleFunc("/as/service/{service_id}", GetAsServiceInfo).Methods("GET")
// Utility API
// https://app.swaggerhub.com/apis/NDID/utility/1.0
router.HandleFunc("/utility/idp", RetrieveAllIdpId).Methods("GET")
router.HandleFunc("/utility/idp/{namespace}/{identifier}", RetrieveAllIdpNodeId).Methods("GET")
router.HandleFunc("/utility/as/{service_id}", RetrieveListGivenServiceId).Methods("GET")
// DPKI API
// https://app.swaggerhub.com/apis/NDID/dpki/1.0
// Only NDID can use the first two API
//router.HandleFunc("/dpki/node/create", CreatedNodeDpki).Methods("POST")
//router.HandleFunc("/dpki/node/update", UpdateNodeName).Methods("POST")
router.HandleFunc("/dpki/node/register_callback", RegisterCallback).Methods("POST")
router.HandleFunc("/dpki/node/register_callback_master", RegisterCallbackMasterKey).Methods("POST")
// Callback API (not provided by NDID, rather, expected by NDID, implemented by IDP, RP and AS respectively
// IDP Callback
// https://app.swaggerhub.com/apis/NDID/idp_callback/1.0
// RP Callback
// https://app.swaggerhub.com/apis/NDID/rp_callback/1.0
// AS Callback
// https://app.swaggerhub.com/apis/NDID/as_callback/1.0
// DPKI callback
// https://app.swaggerhub.com/apis/NDID/dpki_callback/1.0
log.Fatal(http.ListenAndServe(":8000", router))
}