Revision 52781
Added by Panagiotis Kanakakis almost 6 years ago
BrokerApiImpl.java | ||
---|---|---|
9 | 9 |
import eu.dnetlib.repo.manager.shared.broker.*; |
10 | 10 |
import io.swagger.annotations.ApiParam; |
11 | 11 |
import org.json.JSONException; |
12 |
import org.json.JSONObject; |
|
13 | 12 |
import org.springframework.beans.factory.annotation.Autowired; |
14 | 13 |
import org.springframework.beans.factory.annotation.Value; |
15 | 14 |
import org.springframework.core.ParameterizedTypeReference; |
16 |
import org.springframework.http.HttpEntity; |
|
17 |
import org.springframework.http.HttpHeaders; |
|
18 |
import org.springframework.http.HttpMethod; |
|
19 |
import org.springframework.http.ResponseEntity; |
|
15 |
import org.springframework.http.*; |
|
20 | 16 |
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; |
21 | 17 |
import org.springframework.security.access.prepost.PreAuthorize; |
22 | 18 |
import org.springframework.stereotype.Component; |
... | ... | |
284 | 280 |
} |
285 | 281 |
|
286 | 282 |
@Override |
287 |
@PreAuthorize("hasRole('ROLE_USER')") |
|
283 |
@PreAuthorize("hasRole('ROLE_USER') ")
|
|
288 | 284 |
public Subscription subscribe(@RequestBody OpenaireSubscription obj) throws BrokerException { |
289 | 285 |
final String service = "/subscribe"; |
290 | 286 |
|
... | ... | |
316 | 312 |
|
317 | 313 |
@Override |
318 | 314 |
@PreAuthorize("hasRole('ROLE_USER')") |
319 |
public void unsubscribe(@PathVariable("subscriptionId") String subscriptionId) throws BrokerException {
|
|
315 |
public ResponseEntity<Object> unsubscribe(@PathVariable("subscriptionId") String subscriptionId) throws BrokerException {
|
|
320 | 316 |
final String service = "/subscriptions/" + subscriptionId; |
321 | 317 |
|
322 | 318 |
//build the uri params |
... | ... | |
335 | 331 |
emailUtils.reportException(e); |
336 | 332 |
throw new BrokerException(e); |
337 | 333 |
} |
334 |
return new ResponseEntity<>("OK",HttpStatus.OK); |
|
338 | 335 |
} |
339 | 336 |
|
340 | 337 |
@Override |
Also available in: Unified diff
1. Dockerize service
2. Add authorization checks
3. Handle exceptions ( controller advice, exception package)
4. Login-logout operations bug fixes