Skip to content
This repository was archived by the owner on Mar 18, 2024. It is now read-only.

Commit 852b779

Browse files
authoredDec 8, 2023
Merge pull request #85 from w3c/rl-integration
Rl integration
2 parents dfec428 + a63fe0b commit 852b779

File tree

18 files changed

+362
-23
lines changed

18 files changed

+362
-23
lines changed
 

‎.gitignore

+5
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,14 @@ http-mgr-log.txt
2222
servercore-log.txt
2323

2424
#helper files
25+
viss
2526
vsspathlist.json
2627
vss_vissv2.binary
2728
certificate.pem
2829
config.json
2930
feeder
31+
feeder/feeder-rl/config.json
32+
3033

3134
# Test binary, built with `go test -c`
3235
*.test
@@ -50,6 +53,7 @@ http_mgr
5053
agt_server
5154
at_server
5255
mqtt_mgr
56+
vissv2server
5357

5458
# Folders
5559
!server/service_mgr/
@@ -67,3 +71,4 @@ logs/
6771
***workspace.code-workspace
6872
***.vscode
6973
/client/client-1.0/grpc_client/grpc_map_client/static/node_modules/
74+
/client/client-1.0/grpc_client/grpc_client

‎Dockerfile

+6-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# To run with redis as state storage use docker compose. This can be used to build individual images but will not
66
# run.
77

8-
ARG GO_VERSION=1.18
8+
ARG GO_VERSION=1.18.3
99
ARG VSSTREE_NAME="vss_vissv2.binary"
1010
ARG BUILD_IMAGE="golang:latest"
1111
ARG RUNTIME_IMAGE="debian:bullseye-slim"
@@ -17,6 +17,9 @@ WORKDIR /build
1717

1818
#add bin folder to store the compiled files
1919
RUN mkdir bin
20+
#corporate proxy settings can sometimes cause tls verification error. Add root crt to docker container.
21+
COPY testCredGen/cicso-umbrella/cisco.crt /usr/local/share/ca-certificates/cisco.crt
22+
RUN update-ca-certificates
2023

2124
#copy the content of the server and utils dir and .mod/.sum files to builder
2225
COPY redis/redis.conf ./etc/
@@ -74,9 +77,9 @@ COPY --from=builder /build/bin/vissv2server .
7477
COPY --from=builder /build/server/transport_sec/transportSec.json ../transport_sec/transportSec.json
7578
COPY --from=builder /build/server/vissv2server/atServer/purposelist.json atServer/purposelist.json
7679
COPY --from=builder /build/server/vissv2server/atServer/scopelist.json atServer/scopelist.json
77-
COPY --from=builder /build/server/vissv2server/feeder-registration.json .
80+
COPY --from=builder /build/server/vissv2server/feeder-registration.docker.json feeder-registration.json
7881
COPY --from=builder /build/server/vissv2server/vss_vissv2.binary .
79-
82+
COPY --from=builder /build/server/agt_server/agt_public_key.rsa .
8083

8184
ENTRYPOINT ["/app/vissv2server","-s","redis"]
8285

‎client/client-1.0/Javascript/agtclient.html

+4-1
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,14 @@ <h2>AGT client example</h2>
3737
function sendPost() {
3838
var xhttp = new XMLHttpRequest();
3939
xhttp.onreadystatechange = function() {
40-
if (this.readyState == 4 && this.status == 200) {
40+
if (this.readyState == 4 && this.status == 201) {
4141
postOutput.innerHTML += "Server: " + this.responseText + "\n";
4242
}
4343
};
4444
var params = postValue.value;
45+
console.log("params: " + params);
46+
console.log("postpath: " + postPath.value);
47+
4548
xhttp.open("POST", "http://" + hostIP + ":7500/" + postPath.value, true);
4649
xhttp.send(params);
4750
postPath.value = "";

‎client/client-1.0/grpc_client/grpc_client.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@ func initCommandList() {
4848
//commandList[1] = `{"action":"subscribe","path":"Vehicle","filter":{"type":"paths","parameter":["Speed", "Chassis/Accelerator/PedalPosition"]},"requestId":"246"}`
4949
//commandList[1] = `{"action":"subscribe","path":"Vehicle/Speed","requestId":"258"}`
5050
commandList[2] = `{"action":"unsubscribe","subscriptionId":"1","requestId":"240"}`
51-
commandList[3] = `{"action":"set", "path":"Vehicle/Body/Lights/IsLeftIndicatorOn", "value":"999", "requestId":"245"}`
51+
commandList[3] = `{"action":"set", "path":"Vehicle/Body/Lights/IsLeftIndicatorOn", "value":"true", "requestId":"245"}`
52+
commandList[1] = `{"action":"subscribe","path":"Vehicle","filter":[{"type":"paths","parameter":["Body.Lights.IsLeftIndicatorOn", "Chassis.Accelerator.PedalPosition"]}, {"type":"change","parameter":{"logic-op":"ne", "diff": "0"}}],"requestId":"285"}`
5253
}
5354

5455
// {"action":"subscribe","path":"Vehicle","filter":{"type":"paths","parameter":["Speed", "Chassis.Accelerator.PedalPosition"]},"requestId":"246"}`

‎docker-compose-rl.yml

+3-2
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,10 @@ services:
4343
target: vissv2server
4444
entrypoint: [ /app/vissv2server,-s,redis]
4545
ports:
46-
- "127.0.0.1:8081:8081"
46+
- "0.0.0.0:8081:8081"
4747
- "127.0.0.1:8888:8888"
48-
- "127.0.0.1:8887:8887"
48+
- "0.0.0.0:8887:8887"
49+
- "0.0.0.0:8600:8600"
4950
volumes:
5051
- ./logs:/app/logs
5152
volumes_from:
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
{
22
"tls": "yes",
3-
"cert_path_name": "certificate.pem",
3+
"cert_path_name": "<path-and-name-goes-here>",
44
"name_spaces": ["vss"],
5-
"broker_url": "personal-l41hw7zrf4-demo-uo7acw3qiq-ez.a.run.app",
5+
"broker_url": "<broker-url-goes-here>",
66
"port":"443",
77
"client_id" : "w3c-vissv2-server",
8-
"api_key": "4CA32399-88237AAA-64EB4EE4-541E1D8F",
8+
"api_key": "<api-key-goes-here>",
99
"vss_tree_path": "../vss/vss-flat-json/normalized-json/vss_n.json",
10-
"signalfilter": ["Vehicle.Speed","Vehicle.Body.Lights.IsLeftIndicatorOn","Vehicle.VehicleIdentification.VIN","Vehicle.CurrentLocation.Latitude","Vehicle.CurrentLocation.Longitude","Vehicle.Chassis.Accelerator.PedalPosition"]
11-
}
12-
10+
"signalfilter": ["Vehicle.Speed","Vehicle.Body.Lights.IsLeftIndicatorOn","Vehicle.VehicleIdentification.VIN","Vehicle.CurrentLocation.Latitude","Vehicle.CurrentLocation.Longitude","Vehicle.Chassis.Accelerator.PedalPosition"],
11+
"publish-separate-connection": "false",
12+
"publish_url": "<where-to-publish-url-goes-here>",
13+
"publish_api-key": "<publish-api-key-goes-here>"
14+
}

‎go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ require (
3232
github.com/gorilla/mux v1.8.0
3333
github.com/gorilla/websocket v1.4.2
3434
github.com/mattn/go-sqlite3 v1.14.14
35-
github.com/petervolvowinz/viss-rl-interfaces v0.0.6
35+
github.com/petervolvowinz/viss-rl-interfaces v0.0.8
3636
github.com/sirupsen/logrus v1.9.3
3737
google.golang.org/grpc v1.57.0
3838
google.golang.org/protobuf v1.31.0

‎go.sum

+2-2
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ github.com/mattn/go-sqlite3 v1.14.14/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4
3434
github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE=
3535
github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE=
3636
github.com/onsi/gomega v1.18.1 h1:M1GfJqGRrBrrGGsbxzV5dqM2U2ApXefZCQpkukxYRLE=
37-
github.com/petervolvowinz/viss-rl-interfaces v0.0.6 h1:2nAyhfTuTIxPqKTVolAiuHLLvJNeM0uBoInqtlzJp10=
38-
github.com/petervolvowinz/viss-rl-interfaces v0.0.6/go.mod h1:7jOb8sy+8GhzonzaTzgcVV9XCKXMWkRDWqFHY6RnXH4=
37+
github.com/petervolvowinz/viss-rl-interfaces v0.0.8 h1:fTcAQVfRCt3jPA9IcqDRgnavPq1REAYfYL7YSj8MrhA=
38+
github.com/petervolvowinz/viss-rl-interfaces v0.0.8/go.mod h1:7jOb8sy+8GhzonzaTzgcVV9XCKXMWkRDWqFHY6RnXH4=
3939
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
4040
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
4141
github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ=

‎server/agt_server/agt_server.go

+1
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ func makeAgtServerHandler(serverChannel chan string) func(http.ResponseWriter, *
8484
} else {
8585
w.Header().Set("Access-Control-Allow-Origin", "*")
8686
w.Header().Set("Content-Type", "application/json")
87+
w.WriteHeader(201) // USE 201 when responding to succesful POST requests
8788
w.Write([]byte(response))
8889
}
8990
}

‎server/server

0 Bytes
Binary file not shown.

‎server/vissv2server/atServer/README.md

+11
Original file line numberDiff line numberDiff line change
@@ -120,3 +120,14 @@ In case it is not valid, a set of error codes has been defined:
120120
#### 60-69 Permission Errors
121121
- 60: Permission error: no access allowed with that purpose
122122
- 61: Permission error: read-only access trying to write
123+
124+
125+
**Unit tests**
126+
127+
Testing the Access Grant Token server and the Access Token server can be done running access_control_test.go
128+
The default feeder can be used but also a rl-feeder with recorded data playback. The AGT server must currently
129+
be started manually. Test cases can also be built and run,debugged individually. Recommend to use an IDE with debugger
130+
for this.
131+
132+
133+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,257 @@
1+
/******** Peter Winzell (c), 11/27/23 *********************************************/
2+
3+
package atServer
4+
5+
import (
6+
"bytes"
7+
"crypto/rsa"
8+
"encoding/json"
9+
"github.com/w3c/automotive-viss2/utils"
10+
"log"
11+
_ "log"
12+
"net/http"
13+
"strconv"
14+
"testing"
15+
)
16+
17+
//Prequisites: AGT Server and Vissv2 Server should be up and running (0.0.0.0 in docker)
18+
type TResponse struct {
19+
Token string `json:"token"`
20+
}
21+
22+
const agt_posttesturl = "http://0.0.0.0:7500/agts"
23+
const at_url = "http://0.0.0.0:8600/ats"
24+
const SHORT_TERM_TOKEN_LENGTH = 14400
25+
const LONG_TERM_TOKEN_LENGTH = 345600
26+
27+
func getShortTermAGTResponse() (*http.Response, error) {
28+
body := []byte(`{"vin":"GEO001","context":"Independent+OEM+Cloud","proof":"ABC","key":"DEF"}`)
29+
30+
r, err := http.NewRequest("POST", agt_posttesturl, bytes.NewBuffer(body))
31+
if err != nil {
32+
panic(err)
33+
}
34+
r.Header.Add("Content-Type", "application/json")
35+
client := &http.Client{}
36+
res, err := client.Do(r)
37+
if err != nil {
38+
panic(err)
39+
}
40+
return res, err
41+
}
42+
43+
func getLongTermAGTResponse() (*http.Response, error) {
44+
var privKey *rsa.PrivateKey
45+
err := utils.ImportRsaKey(PRIV_KEY_DIRECTORY, &privKey)
46+
if err != nil {
47+
return nil, err
48+
}
49+
50+
popToken := utils.PopToken{}
51+
token, err := popToken.GenerateToken(privKey) // generate a proof-of-possession-token to get a LT token.
52+
53+
agtP := agtPayload{
54+
Vin: "GEO001",
55+
Context: "Independent+OEM+Cloud",
56+
Proof: "ABC",
57+
Key: popToken.Jwk.Thumb, // Thumb print need to match.
58+
}
59+
60+
body, err := json.Marshal(agtP) // POST a acces grant token request
61+
62+
r, err := http.NewRequest("POST", agt_posttesturl, bytes.NewBuffer(body))
63+
if err != nil {
64+
return nil, err
65+
}
66+
r.Header.Add("Content-Type", "application/json")
67+
r.Header.Add("PoP", token) // add the Pop as a proof of possesion.
68+
69+
client := &http.Client{}
70+
71+
return client.Do(r)
72+
}
73+
74+
func TestShortTermTokenAccess(t *testing.T) {
75+
76+
res, err := getShortTermAGTResponse()
77+
if err != nil {
78+
t.Error(err)
79+
}
80+
81+
defer res.Body.Close()
82+
83+
post := &TResponse{}
84+
derr := json.NewDecoder(res.Body).Decode(post)
85+
if derr != nil {
86+
panic(derr)
87+
}
88+
89+
if res.StatusCode != http.StatusCreated {
90+
t.Error("status code expected to be 201 , got: ", res.StatusCode)
91+
}
92+
93+
log.Printf("got token = %s", post.Token)
94+
var Agt utils.ExtendedJwt
95+
err = Agt.DecodeFromFull(post.Token) // parsing the JWT token
96+
vin := Agt.PayloadClaims["vin"]
97+
ctx := Agt.PayloadClaims["clx"]
98+
iat, err := strconv.Atoi(Agt.PayloadClaims["iat"])
99+
exp, err := strconv.Atoi(Agt.PayloadClaims["exp"])
100+
101+
//test that it is correct length
102+
if (exp - iat) != SHORT_TERM_TOKEN_LENGTH {
103+
t.Error("short term token error: ", exp-iat)
104+
}
105+
//test vin and context
106+
if vin != "GEO001" {
107+
t.Error("Vin does not match => ", vin)
108+
}
109+
if ctx != "Independent+OEM+Cloud" {
110+
t.Error("roles fails to match => ", ctx)
111+
}
112+
113+
}
114+
115+
const PRIV_KEY_DIRECTORY = "../../agt_server/agt_private_key.rsa"
116+
117+
//TODO this should reside in utils somwhere , duplicate code.
118+
type agtPayload struct {
119+
Vin string `json:"vin"`
120+
Context string `json:"context"`
121+
Proof string `json:"proof"`
122+
//Key utils.JsonWebKey `json:"key"`
123+
Key string `json:"key"`
124+
}
125+
126+
func TestLongTermTokenAccess(t *testing.T) {
127+
128+
res, err := getLongTermAGTResponse()
129+
if err != nil {
130+
panic(err)
131+
}
132+
133+
defer res.Body.Close()
134+
135+
post := &TResponse{}
136+
derr := json.NewDecoder(res.Body).Decode(post)
137+
if derr != nil {
138+
panic(derr)
139+
}
140+
141+
if res.StatusCode != http.StatusCreated {
142+
t.Error("status code expected to be 201 , got: ", res.StatusCode)
143+
}
144+
145+
log.Printf("got token = %s", post.Token)
146+
var Agt utils.ExtendedJwt
147+
err = Agt.DecodeFromFull(post.Token) // parsing the JWT token
148+
vin := Agt.PayloadClaims["vin"]
149+
ctx := Agt.PayloadClaims["clx"]
150+
iat, err := strconv.Atoi(Agt.PayloadClaims["iat"])
151+
exp, err := strconv.Atoi(Agt.PayloadClaims["exp"])
152+
153+
//test that it is correct length
154+
if (exp - iat) != LONG_TERM_TOKEN_LENGTH {
155+
t.Error("short term token error: ", exp-iat)
156+
}
157+
//test vin and context
158+
if vin != "GEO001" {
159+
t.Error("Vin does not match => ", vin)
160+
}
161+
if ctx != "Independent+OEM+Cloud" {
162+
t.Error("roles fails to match => ", ctx)
163+
}
164+
165+
}
166+
167+
type atRequest struct {
168+
Token string `json:string "token"`
169+
Purpose string `json:string "purpose"`
170+
Pop string `json:string "pop"`
171+
}
172+
173+
func getAtToken(agttoken string) (*http.Response, error) {
174+
175+
atReq := &atRequest{
176+
Token: agttoken,
177+
Purpose: "fuel-status",
178+
Pop: "GHI",
179+
}
180+
body, err := json.Marshal(atReq)
181+
if err != nil {
182+
return nil, err
183+
}
184+
185+
r, err := http.NewRequest("POST", at_url, bytes.NewBuffer(body))
186+
if err != nil {
187+
return nil, err
188+
}
189+
190+
r.Header.Add("Content-Type", "application/json")
191+
client := &http.Client{}
192+
res, err := client.Do(r)
193+
if err != nil {
194+
return nil, err
195+
}
196+
return res, err
197+
}
198+
199+
func parseATToken(res http.Response, t *testing.T) *TResponse {
200+
201+
defer res.Body.Close()
202+
203+
post := &TResponse{}
204+
derr := json.NewDecoder(res.Body).Decode(post)
205+
if derr != nil {
206+
t.Error("could not parse http response")
207+
return nil
208+
}
209+
210+
if res.StatusCode != http.StatusCreated {
211+
t.Error("status code expected to be 201 , got: ", res.StatusCode)
212+
213+
}
214+
215+
return post
216+
}
217+
218+
// Viss server must be up and running
219+
func TestAtTokenAccess_ST(t *testing.T) {
220+
res_ag, err := getShortTermAGTResponse() // Get Access Grant Token
221+
if err != nil {
222+
t.Error(err)
223+
}
224+
225+
res, err := getAtToken(parseATToken(*res_ag, t).Token) // Get Access token
226+
227+
if err != nil {
228+
t.Error(err)
229+
}
230+
if res.StatusCode != http.StatusCreated {
231+
t.Error("status code expected to be 201 , got: ", res.StatusCode)
232+
} else {
233+
attokenpost := &TResponse{}
234+
derr := json.NewDecoder(res.Body).Decode(attokenpost)
235+
236+
if derr != nil {
237+
t.Error(derr)
238+
}
239+
log.Println(attokenpost.Token)
240+
}
241+
242+
}
243+
244+
func TestAtTokenAccess_LT(t *testing.T) {
245+
t.Error("not implemented yet")
246+
247+
}
248+
249+
// Test actual requests against server, server and a feeder for south-bound must be running.
250+
251+
func TestGetAccessControlST(t *testing.T) {
252+
t.Error("not implemented yet")
253+
}
254+
255+
func TestGetAccessControlLT(t *testing.T) {
256+
t.Error("not implemented yet")
257+
}

‎server/vissv2server/atServer/atServer.go

+9-5
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ const GAP = 3 // Used for PoP check
3535
const LIFETIME = 5 // Used for PoP check
3636

3737
const theAtSecret = "averysecretkeyvalue2" //not shared
38-
const AGT_PUB_KEY_DIRECTORY = "atServer/agt_public_key.rsa"
38+
const AGT_PUB_KEY_DIRECTORY = "agt_public_key.rsa"
3939
const PORT = 8600
4040
const AT_DURATION = 1 * 60 * 60 // 1 hour
4141

@@ -164,6 +164,7 @@ func makeAtServerHandler(serverChannel chan string) func(http.ResponseWriter, *h
164164
} else {
165165
w.Header().Set("Access-Control-Allow-Origin", "*")
166166
// w.Header().Set("Content-Type", "application/json")
167+
w.WriteHeader(201) // USE 201 when responding to succesful POST requests
167168
w.Write([]byte(response))
168169
}
169170
}
@@ -190,7 +191,7 @@ func initAtServer(serverChannel chan string, muxServer *http.ServeMux) {
190191
utils.Error.Fatal(server.ListenAndServeTLS("../transport_sec/"+utils.SecureConfiguration.ServerSecPath+"server.crt",
191192
"../transport_sec/"+utils.SecureConfiguration.ServerSecPath+"server.key"))
192193
} else { // No TLSmtvacuc14uma
193-
utils.Info.Printf("initAtServer():Starting AT Server without TLS on %s/ats", PORT)
194+
//utils.Info.Printf("initAtServer():Starting AT Server without TLS on %s/ats", PORT)
194195
utils.Error.Fatal(http.ListenAndServe(":"+strconv.Itoa(PORT), muxServer))
195196
}
196197
}
@@ -315,6 +316,9 @@ func noScopeResponse(input string) string {
315316
return `{"no_access":` + res + `}`
316317
}
317318

319+
// Validates an access token, returns validation message.
320+
// The only validation done is the one regarding the Access Token List
321+
318322
func tokenValidationResponse(input string) string {
319323
var inputMap map[string]interface{}
320324
err := json.Unmarshal([]byte(input), &inputMap)
@@ -356,7 +360,7 @@ func searchCache(token string) (string, bool) {
356360
return tokenCache[i].Token, true
357361
}
358362
}
359-
return token, false
363+
return token, false
360364
}
361365

362366
func cacheToken(token string, isCached bool) string {
@@ -381,7 +385,7 @@ func extractSignature(token string) string {
381385
if lastDotIndex != -1 {
382386
return token[lastDotIndex+1:]
383387
}
384-
utils.Error.Printf("extractSignature:Signature not found in token=%s")
388+
utils.Error.Printf("extractSignature:Signature not found in token=%s", token)
385389
return ""
386390
}
387391

@@ -627,7 +631,7 @@ func validateRequest(payload AtGenPayload) (bool, string) {
627631
return false, `{"error": "AG token exp timestamp malformed"}`
628632
}
629633
if !validateTokenTimestamps(iat, exp) {
630-
utils.Info.Printf("validateRequest:invalid token timestamps, iat=%d, exp=%d", payload.Agt.PayloadClaims["iat"], payload.Agt.PayloadClaims["exp"])
634+
//utils.Info.Printf("validateRequest:invalid token timestamps, iat=%d, exp=%d", payload.Agt.PayloadClaims["iat"], payload.Agt.PayloadClaims["exp"])
631635
return false, `{"error": "AG token timestamp validation failed"}`
632636
}
633637
// POP Checking

‎testCredGen/README.md

+11
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
**TLS**
2+
13
The testCredGen script can be used to generate credentials for server and client(s) communication over HTTPS and WSS.
24

35
It uses openSSL for the generation, so this package must be installed on the computer if not there already.
@@ -66,4 +68,13 @@ to the corresponding ca and client directories in that repo,
6668
and change the "transportSec" parameter in the corresponding transportSec.json file to "yes".
6769

6870

71+
**Docker and TLS build verification**
72+
73+
In the directory cisco-umbrella we have downloaded a cisco - https://docs.umbrella.com/deployment-umbrella/docs/install-cisco-umbrella-root-certificate - root certificate and included that in the docker file. Sometimes
74+
corporate proxy settings are updated so that the build machines certificates does not recognize external repos. Including
75+
a root certificate in the docker file allows the build to use tls verification on these repos.
76+
77+
78+
79+
6980

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
-----BEGIN CERTIFICATE-----
2+
MIIDJjCCAg6gAwIBAgIIUW6l3kYeVMEwDQYJKoZIhvcNAQELBQAwMTEOMAwGA1UE
3+
ChMFQ2lzY28xHzAdBgNVBAMTFkNpc2NvIFVtYnJlbGxhIFJvb3QgQ0EwHhcNMTYw
4+
NjI4MTUzNzUzWhcNMzYwNjI4MTUzNzUzWjAxMQ4wDAYDVQQKEwVDaXNjbzEfMB0G
5+
A1UEAxMWQ2lzY28gVW1icmVsbGEgUm9vdCBDQTCCASIwDQYJKoZIhvcNAQEBBQAD
6+
ggEPADCCAQoCggEBAO7ZjfBSCaz5EMYSiWYoXjHPP/w7xFT4bXa82lOZ9CJJXDQw
7+
bZpBdmuqX9UWo769LIAaSUvkYEeZqcTsjrx/7juPKoOErhJY0cPK12LU9PbHXqEd
8+
XESIqBjdOC5oiIFHhTAKuuKRlL7rhPYkYhZtgdll4h0FLIG+xNsMVfzJb7z69X8Y
9+
vF9r1drLkd7oR2xHuRkXgzeblFVpF+DRF7WXNhLy0By38ZxtClxYUSitdz53W0ic
10+
maelG7EyCVNVxARxn5waaphRvki1hkuqqrm3JdlV165zAOdSz3JKzRISQinCTQuT
11+
+RK/w0qLsDTyOVO/mEIVWLXu/Z1NtuXgj/jhegcCAwEAAaNCMEAwDgYDVR0PAQH/
12+
BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFENzAN4kukAaQFQsfXzV
13+
AEiJDHCkMA0GCSqGSIb3DQEBCwUAA4IBAQBIEoceSPZLmo5sLmgDfQA+Fq5BKztL
14+
qg8aAvZdrbdMEKEBr1RDB0OAhuPcaaVxZi6Hjyql1N999Zmp8qIw/lLTt3VSTmEa
15+
29uPgjdMGLl9KyfZjARiA/PPvPdHTwg7TMJOet+w7P5nWabLNW55+Wc/JzCSFE30
16+
+0Kdz/jojxlA/8t0xYLCdS2UK7zC4kuAbojHLJDbIQO3HeEWwVmg4FO89AHVvC4R
17+
Y+V0t7SaEradv6tPG9DHX7PLwjQ/Xs95NGDIJTeFwCRqYUlBu9iZjIvKba0e0tST
18+
Vuyw2+P2HuWazjBPawGrbfyw+uO3KO4WnNGjMutJJ920o8B5M8gW1+Ye
19+
-----END CERTIFICATE-----

‎testCredGen/cicso-umbrella/cisco.crt

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
-----BEGIN CERTIFICATE-----
2+
MIIDJjCCAg6gAwIBAgIIUW6l3kYeVMEwDQYJKoZIhvcNAQELBQAwMTEOMAwGA1UE
3+
ChMFQ2lzY28xHzAdBgNVBAMTFkNpc2NvIFVtYnJlbGxhIFJvb3QgQ0EwHhcNMTYw
4+
NjI4MTUzNzUzWhcNMzYwNjI4MTUzNzUzWjAxMQ4wDAYDVQQKEwVDaXNjbzEfMB0G
5+
A1UEAxMWQ2lzY28gVW1icmVsbGEgUm9vdCBDQTCCASIwDQYJKoZIhvcNAQEBBQAD
6+
ggEPADCCAQoCggEBAO7ZjfBSCaz5EMYSiWYoXjHPP/w7xFT4bXa82lOZ9CJJXDQw
7+
bZpBdmuqX9UWo769LIAaSUvkYEeZqcTsjrx/7juPKoOErhJY0cPK12LU9PbHXqEd
8+
XESIqBjdOC5oiIFHhTAKuuKRlL7rhPYkYhZtgdll4h0FLIG+xNsMVfzJb7z69X8Y
9+
vF9r1drLkd7oR2xHuRkXgzeblFVpF+DRF7WXNhLy0By38ZxtClxYUSitdz53W0ic
10+
maelG7EyCVNVxARxn5waaphRvki1hkuqqrm3JdlV165zAOdSz3JKzRISQinCTQuT
11+
+RK/w0qLsDTyOVO/mEIVWLXu/Z1NtuXgj/jhegcCAwEAAaNCMEAwDgYDVR0PAQH/
12+
BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFENzAN4kukAaQFQsfXzV
13+
AEiJDHCkMA0GCSqGSIb3DQEBCwUAA4IBAQBIEoceSPZLmo5sLmgDfQA+Fq5BKztL
14+
qg8aAvZdrbdMEKEBr1RDB0OAhuPcaaVxZi6Hjyql1N999Zmp8qIw/lLTt3VSTmEa
15+
29uPgjdMGLl9KyfZjARiA/PPvPdHTwg7TMJOet+w7P5nWabLNW55+Wc/JzCSFE30
16+
+0Kdz/jojxlA/8t0xYLCdS2UK7zC4kuAbojHLJDbIQO3HeEWwVmg4FO89AHVvC4R
17+
Y+V0t7SaEradv6tPG9DHX7PLwjQ/Xs95NGDIJTeFwCRqYUlBu9iZjIvKba0e0tST
18+
Vuyw2+P2HuWazjBPawGrbfyw+uO3KO4WnNGjMutJJ920o8B5M8gW1+Ye
19+
-----END CERTIFICATE-----

‎utils/cryptoutils.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ func ImportRsaKey(filename string, privKey **rsa.PrivateKey) error {
193193
return err
194194
}
195195

196-
// Gets rsa public ket from pem file
196+
// Gets rsa public key from pem file
197197
func ImportRsaPubKey(filename string, pubKey **rsa.PublicKey) error {
198198
pubFile, err := os.Open(filename)
199199
if err != nil {

‎utils/datatypes.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ func (popToken *PopToken) Initialize(headerMap, payloadMap map[string]string, pu
289289
}
290290

291291
// Generates popToken using a PrivateKey, can be used even if popToken is not initialized (claims are auto-fulfilled)
292-
func (popToken PopToken) GenerateToken(privKey crypto.PrivateKey) (token string, err error) {
292+
func (popToken *PopToken) GenerateToken(privKey crypto.PrivateKey) (token string, err error) {
293293
// Initialization if is not
294294
if popToken.HeaderClaims == nil {
295295
if rsaPriv, ok := privKey.(*rsa.PrivateKey); ok {
@@ -315,6 +315,8 @@ func (popToken PopToken) GenerateToken(privKey crypto.PrivateKey) (token string,
315315
return
316316
}
317317
popToken.PayloadClaims["jti"] = unparsedId.String()
318+
popToken.PayloadClaims["aud"] = "vissv2/agts"
319+
// popToken.PayloadClaims[""]
318320
// Marshal header (must be in order)
319321
iterator := []string{"typ", "alg", "jwk"}
320322
for _, iter := range iterator {

0 commit comments

Comments
 (0)
This repository has been archived.