@@ -11,16 +11,7 @@ listener http:Listener jwtListenerEP = new(9090, config = {
1111 }
1212});
1313
14- listener http : Listener jwkListenerEP = new (9091 , config = {
15- secureSocket : {
16- keyStore : {
17- path : " resources/ballerinaKeystore.p12" ,
18- password : " ballerina"
19- }
20- }
21- });
22-
23- service /orders on jwtListenerEP, jwkListenerEP {
14+ service /orders9090 on jwtListenerEP {
2415
2516 @http :ResourceConfig {
2617 auth : [
@@ -39,7 +30,67 @@ service /orders on jwtListenerEP, jwkListenerEP {
3930 }
4031 },
4132 scopes : [" view-order" ]
42- },
33+ }
34+ ]
35+ }
36+ resource function get view() returns json {
37+ json inventory = {
38+ " items " : [
39+ {
40+ " code" : uuid :createType4AsString (),
41+ " qty" : checkpanic random :createIntInRange (1 , 100 )
42+ }
43+ ]
44+ };
45+ return inventory ;
46+ }
47+
48+ @http :ResourceConfig {
49+ auth : [
50+ {
51+ jwtValidatorConfig : {
52+ issuer : " wso2is" ,
53+ audience : " 3VTwFk7u1i366wzmvpJ_LZlfAV4a" ,
54+ signatureConfig : {
55+ trustStoreConfig : {
56+ certAlias : " wso2carbon" ,
57+ trustStore : {
58+ path : " resources/wso2Truststore.p12" ,
59+ password : " wso2carbon"
60+ }
61+ }
62+ }
63+ },
64+ scopes : [" add-order" ]
65+ }
66+ ]
67+ }
68+ resource function get add() returns json {
69+ json inventory = {
70+ " items " : [
71+ {
72+ " code" : uuid :createType4AsString (),
73+ " qty" : checkpanic random :createIntInRange (1 , 100 )
74+ }
75+ ]
76+ };
77+ return inventory ;
78+ }
79+ }
80+
81+ listener http : Listener jwkListenerEP = new (9091 , config = {
82+ secureSocket : {
83+ keyStore : {
84+ path : " resources/ballerinaKeystore.p12" ,
85+ password : " ballerina"
86+ }
87+ }
88+ });
89+
90+ service /orders9091 on jwkListenerEP {
91+
92+ @http :ResourceConfig {
93+ auth : [
4394 {
4495 jwtValidatorConfig : {
4596 issuer : " wso2is" ,
@@ -76,22 +127,6 @@ service /orders on jwtListenerEP, jwkListenerEP {
76127
77128 @http :ResourceConfig {
78129 auth : [
79- {
80- jwtValidatorConfig : {
81- issuer : " wso2is" ,
82- audience : " 3VTwFk7u1i366wzmvpJ_LZlfAV4a" ,
83- signatureConfig : {
84- trustStoreConfig : {
85- certAlias : " wso2carbon" ,
86- trustStore : {
87- path : " resources/wso2Truststore.p12" ,
88- password : " wso2carbon"
89- }
90- }
91- }
92- },
93- scopes : [" add-order" ]
94- },
95130 {
96131 jwtValidatorConfig : {
97132 issuer : " wso2is" ,
@@ -126,3 +161,4 @@ service /orders on jwtListenerEP, jwkListenerEP {
126161 return inventory ;
127162 }
128163}
164+
0 commit comments