|
1 | 1 | /* |
2 | | - * Copyright 2024-2024 IEXEC BLOCKCHAIN TECH |
| 2 | + * Copyright 2024-2025 IEXEC BLOCKCHAIN TECH |
3 | 3 | * |
4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
5 | 5 | * you may not use this file except in compliance with the License. |
@@ -64,7 +64,7 @@ public AuthorizationService(AuthorizationRepository authorizationRepository, Iex |
64 | 64 | * @param workerpoolAuthorization The authorization to check |
65 | 65 | * @return the reason if unauthorized, an empty {@code Optional} otherwise |
66 | 66 | */ |
67 | | - public Optional<AuthorizationError> isAuthorizedOnExecutionWithDetailedIssue(WorkerpoolAuthorization workerpoolAuthorization) { |
| 67 | + public Optional<AuthorizationError> isAuthorizedOnExecutionWithDetailedIssue(final WorkerpoolAuthorization workerpoolAuthorization) { |
68 | 68 | if (workerpoolAuthorization == null || StringUtils.isEmpty(workerpoolAuthorization.getChainTaskId())) { |
69 | 69 | log.error("Not authorized with empty params"); |
70 | 70 | return Optional.of(EMPTY_PARAMS_UNAUTHORIZED); |
@@ -112,19 +112,19 @@ public Optional<AuthorizationError> isAuthorizedOnExecutionWithDetailedIssue(Wor |
112 | 112 | return Optional.empty(); |
113 | 113 | } |
114 | 114 |
|
115 | | - public boolean isSignedByHimself(String message, String signature, String address) { |
| 115 | + public boolean isSignedByHimself(final String message, final String signature, final String address) { |
116 | 116 | return SignatureUtils.isSignatureValid(BytesUtils.stringToBytes(message), new Signature(signature), address); |
117 | 117 | } |
118 | 118 |
|
119 | | - public String getChallengeForWorker(WorkerpoolAuthorization workerpoolAuthorization) { |
| 119 | + public String getChallengeForWorker(final WorkerpoolAuthorization workerpoolAuthorization) { |
120 | 120 | return HashUtils.concatenateAndHash( |
121 | 121 | workerpoolAuthorization.getWorkerWallet(), |
122 | 122 | workerpoolAuthorization.getChainTaskId(), |
123 | 123 | workerpoolAuthorization.getEnclaveChallenge()); |
124 | 124 | } |
125 | 125 |
|
126 | 126 | // region workerpool authorization cache |
127 | | - public boolean checkEnclaveSignature(ResultModel model, String walletAddress) { |
| 127 | + public boolean checkEnclaveSignature(final ResultModel model, final String walletAddress) { |
128 | 128 | if (ResultModel.EMPTY_WEB3_SIG.equals(model.getEnclaveSignature())) { |
129 | 129 | log.warn("Empty enclave signature {}", walletAddress); |
130 | 130 | return false; |
@@ -154,7 +154,7 @@ public boolean checkEnclaveSignature(ResultModel model, String walletAddress) { |
154 | 154 | return isSignedByEnclave; |
155 | 155 | } |
156 | 156 |
|
157 | | - public void putIfAbsent(WorkerpoolAuthorization workerpoolAuthorization) { |
| 157 | + public void putIfAbsent(final WorkerpoolAuthorization workerpoolAuthorization) { |
158 | 158 | try { |
159 | 159 | authorizationRepository.save(new Authorization(workerpoolAuthorization)); |
160 | 160 | log.debug("Workerpool authorization entry added [chainTaskId:{}, workerWallet:{}]", |
|
0 commit comments