Skip to content

Commit 9a45487

Browse files
authored
Remove legacy authorization mechanism, allows to remove challenge service as well (#150)
1 parent 150eee4 commit 9a45487

File tree

8 files changed

+12
-403
lines changed

8 files changed

+12
-403
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
44

55
## [[NEXT]](https://github.com/iExecBlockchainComputing/iexec-result-proxy/releases/tag/vNEXT) 2025
66

7+
### Breaking API changes
8+
9+
- Remove legacy authorization mechanism, allows to remove challenge services as well. (#150)
10+
711
### Dependency Upgrades
812

913
- Upgrade to `eclipse-temurin:17.0.13_11-jre-focal`. (#149)

iexec-result-proxy-library/src/main/java/com/iexec/resultproxy/api/ResultProxyClient.java

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2022-2024 IEXEC BLOCKCHAIN TECH
2+
* Copyright 2022-2025 IEXEC BLOCKCHAIN TECH
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -18,7 +18,6 @@
1818

1919
import com.iexec.common.result.ResultModel;
2020
import com.iexec.commons.poco.chain.WorkerpoolAuthorization;
21-
import com.iexec.commons.poco.eip712.entity.EIP712Challenge;
2221
import feign.Headers;
2322
import feign.Param;
2423
import feign.RequestLine;
@@ -32,20 +31,6 @@
3231
*/
3332
public interface ResultProxyClient {
3433

35-
/**
36-
* @deprecated Will be replaced with new flow and removed in v10
37-
*/
38-
@Deprecated(forRemoval = true)
39-
@RequestLine("GET /results/challenge?chainId={chainId}")
40-
EIP712Challenge getChallenge(@Param("chainId") int chainId);
41-
42-
/**
43-
* @deprecated Will be replaced with new flow and removed in v10
44-
*/
45-
@Deprecated(forRemoval = true)
46-
@RequestLine("POST /results/login?chainId={chainId}")
47-
String login(@Param("chainId") int chainId, String token);
48-
4934
@RequestLine("POST /v1/results/token")
5035
@Headers("Authorization: {authorization}")
5136
String getJwt(@Param("authorization") String authorization, WorkerpoolAuthorization workerpoolAuthorization);

src/main/java/com/iexec/resultproxy/challenge/ChallengeService.java

Lines changed: 0 additions & 96 deletions
This file was deleted.

src/main/java/com/iexec/resultproxy/challenge/EIP712ChallengeService.java

Lines changed: 0 additions & 72 deletions
This file was deleted.

src/main/java/com/iexec/resultproxy/proxy/ProxyController.java

Lines changed: 3 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2020-2024 IEXEC BLOCKCHAIN TECH
2+
* Copyright 2020-2025 IEXEC BLOCKCHAIN TECH
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -17,11 +17,8 @@
1717
package com.iexec.resultproxy.proxy;
1818

1919
import com.iexec.common.result.ResultModel;
20-
import com.iexec.common.security.SignedChallenge;
2120
import com.iexec.commons.poco.chain.WorkerpoolAuthorization;
22-
import com.iexec.commons.poco.eip712.entity.EIP712Challenge;
2321
import com.iexec.resultproxy.authorization.AuthorizationService;
24-
import com.iexec.resultproxy.challenge.ChallengeService;
2522
import com.iexec.resultproxy.ipfs.task.IpfsNameService;
2623
import com.iexec.resultproxy.jwt.JwtService;
2724
import lombok.extern.slf4j.Slf4j;
@@ -37,56 +34,24 @@
3734
public class ProxyController {
3835

3936
private final AuthorizationService authorizationService;
40-
private final ChallengeService challengeService;
4137
private final JwtService jwtService;
4238
private final ProxyService proxyService;
4339
private final IpfsNameService ipfsNameService;
4440

4541
public ProxyController(AuthorizationService authorizationService,
46-
ChallengeService challengeService,
4742
JwtService jwtService,
4843
ProxyService proxyService,
4944
IpfsNameService ipfsNameService) {
5045
this.authorizationService = authorizationService;
51-
this.challengeService = challengeService;
5246
this.jwtService = jwtService;
5347
this.proxyService = proxyService;
5448
this.ipfsNameService = ipfsNameService;
5549
}
5650

57-
/**
58-
* @deprecated Use new endpoint with valid {@code WorkerpoolAuthorization}
59-
*/
60-
@Deprecated(forRemoval = true)
61-
@GetMapping(value = "/results/challenge")
62-
public ResponseEntity<EIP712Challenge> getChallenge(@RequestParam(name = "chainId") Integer chainId) {
63-
EIP712Challenge eip712Challenge = challengeService.createChallenge(chainId);
64-
return ResponseEntity.ok(eip712Challenge);
65-
}
66-
67-
/**
68-
* @deprecated Use new endpoint with valid {@code WorkerpoolAuthorization}
69-
*/
70-
@Deprecated(forRemoval = true)
71-
@PostMapping(value = "/results/login")
72-
public ResponseEntity<String> login(@RequestParam(name = "chainId") Integer chainId,
73-
@RequestBody String token) {
74-
SignedChallenge signedChallenge = challengeService.tokenToSignedChallengeObject(token);
75-
if (!challengeService.isSignedChallengeValid(signedChallenge)) {
76-
return ResponseEntity.status(HttpStatus.UNAUTHORIZED).build();
77-
}
78-
79-
String jwtString = jwtService.getOrCreateJwt(signedChallenge.getWalletAddress());
80-
if (jwtString == null || jwtString.isEmpty()) {
81-
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).build();
82-
}
83-
84-
challengeService.invalidateChallenge(signedChallenge.getChallengeHash());
85-
return ResponseEntity.ok(jwtString);
86-
}
87-
8851
/**
8952
* Logs against Result Proxy with valid {@code WorkerpoolAuthorization}.
53+
* <p>
54+
* The address of the signer needs to be stored in the {@code workerWallet} field of {@code WorkerpoolAuthorization}
9055
*/
9156
@PostMapping("/v1/results/token")
9257
public ResponseEntity<String> getJwt(@RequestHeader("Authorization") String authorization,
@@ -104,16 +69,6 @@ public ResponseEntity<String> getJwt(@RequestHeader("Authorization") String auth
10469
return ResponseEntity.ok(jwtString);
10570
}
10671

107-
/**
108-
* @deprecated Use {@code /v1/results} endpoint, will be removed in v10
109-
*/
110-
@Deprecated(forRemoval = true)
111-
@PostMapping("/")
112-
public ResponseEntity<String> addResultDeprecated(@RequestHeader("Authorization") String token,
113-
@RequestBody ResultModel model) {
114-
return addResult(token, model);
115-
}
116-
11772
/**
11873
* Push result on IPFS through iExec Result Proxy.
11974
*
@@ -152,16 +107,6 @@ public ResponseEntity<String> addResult(@RequestHeader("Authorization") String t
152107
return ok(resultLink);
153108
}
154109

155-
/**
156-
* @deprecated Use {@code /v1/results/{chainTaskId}} endpoint, will be removed in v10
157-
*/
158-
@Deprecated(forRemoval = true)
159-
@RequestMapping(method = RequestMethod.HEAD, path = "/results/{chainTaskId}")
160-
public ResponseEntity<String> isResultUploadedDeprecated(@PathVariable(name = "chainTaskId") String chainTaskId,
161-
@RequestHeader("Authorization") String token) {
162-
return isResultUploaded(chainTaskId, token);
163-
}
164-
165110
/**
166111
* Checks if a given task has been uploaded on IPFS through the current iExec Result Proxy instance.
167112
*
@@ -186,15 +131,6 @@ public ResponseEntity<String> isResultUploaded(@PathVariable(name = "chainTaskId
186131
return ResponseEntity.status(status).build();
187132
}
188133

189-
/**
190-
* @deprecated Use {@code /v1/results/{chainTaskId}/ipfshash} endpoint, will be removed in v10
191-
*/
192-
@Deprecated(forRemoval = true)
193-
@GetMapping("/results/{chainTaskId}/ipfshash")
194-
public ResponseEntity<String> getIpfsHashForTaskDeprecated(@PathVariable("chainTaskId") String chainTaskId) {
195-
return getIpfsHashForTask(chainTaskId);
196-
}
197-
198134
/**
199135
* Retrieves ipfsHash for taskId if required
200136
*

0 commit comments

Comments
 (0)