Revision 57907
Added by Ioannis Diplas over 4 years ago
BrokerController.java | ||
---|---|---|
7 | 7 |
import io.swagger.annotations.Api; |
8 | 8 |
import io.swagger.annotations.ApiParam; |
9 | 9 |
import org.json.JSONException; |
10 |
import org.mitre.openid.connect.model.OIDCAuthenticationToken; |
|
10 | 11 |
import org.springframework.beans.factory.annotation.Autowired; |
11 | 12 |
import org.springframework.http.MediaType; |
12 | 13 |
import org.springframework.http.ResponseEntity; |
13 | 14 |
import org.springframework.security.access.prepost.PreAuthorize; |
15 |
import org.springframework.security.core.context.SecurityContextHolder; |
|
14 | 16 |
import org.springframework.web.bind.annotation.*; |
15 | 17 |
|
16 | 18 |
import java.io.IOException; |
... | ... | |
35 | 37 |
@ApiParam(value = "Include shared datasources", required = true , defaultValue = "false") String includeShared, |
36 | 38 |
@RequestParam("includeByOthers") |
37 | 39 |
@ApiParam(value = "Include datasources of other", required = true,defaultValue = "false") String includeByOthers) throws JSONException { |
40 |
user = ((OIDCAuthenticationToken) SecurityContextHolder.getContext().getAuthentication()).getUserInfo().getEmail(); |
|
38 | 41 |
return brokerService.getDatasourcesOfUser(user, includeShared, includeByOthers); |
39 | 42 |
} |
40 | 43 |
|
... | ... | |
75 | 78 |
@ResponseBody |
76 | 79 |
@PreAuthorize("hasRole('ROLE_USER')") |
77 | 80 |
public Map<String, List<SimpleSubscriptionDesc>> getSimpleSubscriptionsOfUser(@PathVariable("userEmail") String userEmail) throws BrokerException{ |
81 |
userEmail = ((OIDCAuthenticationToken) SecurityContextHolder.getContext().getAuthentication()).getUserInfo().getEmail(); |
|
78 | 82 |
return brokerService.getSimpleSubscriptionsOfUser(userEmail); |
79 | 83 |
} |
80 | 84 |
|
Also available in: Unified diff
New mapping for RepositorySnippet + Using SecurityContext to get the email of user