@@ -57,17 +57,20 @@ class MockAccessGrantServer {
5757 private static final String SCENARIO_STATE_REVOKED = "Revoked" ;
5858
5959 private final WireMockServer wireMockServer ;
60- private final String webId ;
60+ private final String ownerWebId ;
61+ private final String requesterWebId ;
6162 private final String sharedResource ;
6263
6364 private final String authorisationServerUrl ;
6465
6566 public MockAccessGrantServer (
66- final URI webId ,
67+ final URI ownerWebId ,
68+ final URI requesterWebId ,
6769 final URI sharedResource ,
6870 final String authorisationServerUrl
6971 ) {
70- this .webId = webId .toString ();
72+ this .ownerWebId = ownerWebId .toString ();
73+ this .requesterWebId = requesterWebId .toString ();
7174 this .sharedResource = sharedResource .toString ();
7275 this .authorisationServerUrl = authorisationServerUrl ;
7376 wireMockServer = new WireMockServer (WireMockConfiguration .options ().dynamicPort ());
@@ -87,15 +90,15 @@ private void setupMocks() {
8790 .withStatus (Utils .SUCCESS )
8891 .withHeader (Utils .CONTENT_TYPE , Utils .APPLICATION_JSON )
8992 .withBody (getResource ("/vc-grant.json" , wireMockServer .baseUrl (),
90- this .webId , this .sharedResource ))));
93+ this .requesterWebId , this . ownerWebId , this .sharedResource ))));
9194
9295 wireMockServer .stubFor (get (urlPathEqualTo ("/vc-request" ))
9396 .withHeader (USER_AGENT_HEADER , equalTo (USER_AGENT ))
9497 .willReturn (aResponse ()
9598 .withStatus (Utils .SUCCESS )
9699 .withHeader (Utils .CONTENT_TYPE , Utils .APPLICATION_JSON )
97100 .withBody (getResource ("/vc-request.json" , wireMockServer .baseUrl (),
98- this .webId , this .sharedResource ))));
101+ this .requesterWebId , this . ownerWebId , this .sharedResource ))));
99102
100103 wireMockServer .stubFor (delete (urlPathMatching ("/vc-grant" ))
101104 .withHeader (USER_AGENT_HEADER , equalTo (USER_AGENT ))
@@ -120,7 +123,7 @@ private void setupMocks() {
120123 .withStatus (Utils .SUCCESS )
121124 .withHeader (Utils .CONTENT_TYPE , Utils .APPLICATION_JSON )
122125 .withBody (getResource ("/vc-request.json" , wireMockServer .baseUrl (),
123- this .webId , this .sharedResource ))));
126+ this .requesterWebId , this . ownerWebId , this .sharedResource ))));
124127
125128 wireMockServer .stubFor (post (urlEqualTo (ISSUE ))
126129 .inScenario (SCENARIO_ACCESS_GRANT )
@@ -134,7 +137,7 @@ private void setupMocks() {
134137 .withStatus (Utils .SUCCESS )
135138 .withHeader (Utils .CONTENT_TYPE , Utils .APPLICATION_JSON )
136139 .withBody (getResource ("/vc-grant.json" , wireMockServer .baseUrl (),
137- this .webId , this .sharedResource ))));
140+ this .requesterWebId , this . ownerWebId , this .sharedResource ))));
138141
139142 wireMockServer .stubFor (post (urlEqualTo (ISSUE ))
140143 .atPriority (1 )
@@ -145,7 +148,7 @@ private void setupMocks() {
145148 .withStatus (Utils .SUCCESS )
146149 .withHeader (Utils .CONTENT_TYPE , Utils .APPLICATION_JSON )
147150 .withBody (getResource ("/vc-request.json" , wireMockServer .baseUrl (),
148- this .webId , this .sharedResource ))));
151+ this .requesterWebId , this . ownerWebId , this .sharedResource ))));
149152
150153 wireMockServer .stubFor (post (urlEqualTo (ISSUE ))
151154 .inScenario (SCENARIO_ACCESS_GRANT )
@@ -158,7 +161,7 @@ private void setupMocks() {
158161 .withStatus (Utils .SUCCESS )
159162 .withHeader (Utils .CONTENT_TYPE , Utils .APPLICATION_JSON )
160163 .withBody (getResource ("/vc-grant.json" , wireMockServer .baseUrl (),
161- this .webId , this .sharedResource ))));
164+ this .requesterWebId , this . ownerWebId , this .sharedResource ))));
162165
163166 wireMockServer .stubFor (post (urlEqualTo (ISSUE ))
164167 .atPriority (1 )
@@ -169,7 +172,7 @@ private void setupMocks() {
169172 .withStatus (Utils .SUCCESS )
170173 .withHeader (Utils .CONTENT_TYPE , Utils .APPLICATION_JSON )
171174 .withBody (getResource ("/vc-request.json" , wireMockServer .baseUrl (),
172- this .webId , this .sharedResource ))));
175+ this .requesterWebId , this . ownerWebId , this .sharedResource ))));
173176
174177 // Require UMA authentication for the /verify endpoint
175178 wireMockServer .stubFor (post (urlEqualTo (VERIFY ))
@@ -229,7 +232,7 @@ private void setupMocks() {
229232 .withStatus (Utils .SUCCESS )
230233 .withHeader (Utils .CONTENT_TYPE , Utils .APPLICATION_JSON )
231234 .withBody (getResource ("/query_response.json" , wireMockServer .baseUrl (),
232- this .webId , this .sharedResource ))));
235+ this .requesterWebId , this . ownerWebId , this .sharedResource ))));
233236
234237 wireMockServer .stubFor (post (urlEqualTo (DERIVE ))
235238 .atPriority (1 )
@@ -241,7 +244,7 @@ private void setupMocks() {
241244 .withStatus (Utils .SUCCESS )
242245 .withHeader (Utils .CONTENT_TYPE , Utils .APPLICATION_JSON )
243246 .withBody (getResource ("/query_response.json" , wireMockServer .baseUrl (),
244- this .webId , this .sharedResource ))));
247+ this .requesterWebId , this . ownerWebId , this .sharedResource ))));
245248
246249 wireMockServer .stubFor (post (urlEqualTo (DERIVE ))
247250 .atPriority (2 )
@@ -265,10 +268,11 @@ private static String getResource(final String path, final String baseUrl) {
265268 return getResource (path ).replace ("{{baseUrl}}" , baseUrl );
266269 }
267270
268- private static String getResource (final String path , final String baseUrl , final String webId ,
269- final String sharedFile ) {
271+ private static String getResource (final String path , final String baseUrl , final String requesterWebId ,
272+ final String ownerWebId , final String sharedFile ) {
270273 return getResource (path ).replace ("{{baseUrl}}" , baseUrl )
271- .replace ("{{webId}}" , webId )
274+ .replace ("{{requesterWebId}}" , requesterWebId )
275+ .replace ("{{ownerWebId}}" , ownerWebId )
272276 .replace ("{{sharedFile}}" , sharedFile );
273277 }
274278
0 commit comments