Revision 57907
Added by Ioannis Diplas over 4 years ago
DashboardController.java | ||
---|---|---|
7 | 7 |
import eu.dnetlib.repo.manager.service.RepositoryService; |
8 | 8 |
import io.swagger.annotations.Api; |
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.security.access.prepost.PreAuthorize; |
14 |
import org.springframework.security.core.context.SecurityContextHolder; |
|
13 | 15 |
import org.springframework.web.bind.annotation.*; |
14 | 16 |
|
15 | 17 |
import java.util.List; |
... | ... | |
38 | 40 |
public List<RepositorySummaryInfo> getRepositoriesSummaryInfo(@PathVariable("userEmail") String userEmail, |
39 | 41 |
@PathVariable("page") String page, |
40 | 42 |
@PathVariable("size") String size) throws JSONException { |
43 |
userEmail = ((OIDCAuthenticationToken) SecurityContextHolder.getContext().getAuthentication()).getUserInfo().getEmail(); |
|
41 | 44 |
return dashboardService.getRepositoriesSummaryInfo(userEmail, page, size); |
42 | 45 |
} |
43 | 46 |
|
... | ... | |
84 | 87 |
public BrokerSummary getBrokerSummary( |
85 | 88 |
@PathVariable("email") String email, |
86 | 89 |
@PathVariable("ds_name") String datasourceName) throws BrokerException { |
90 |
email = ((OIDCAuthenticationToken) SecurityContextHolder.getContext().getAuthentication()).getUserInfo().getEmail(); |
|
87 | 91 |
return new BrokerSummary(brokerService.getSimpleSubscriptionsOfUser(email), brokerService.getTopicsForDatasource(datasourceName)); |
88 | 92 |
} |
89 | 93 |
|
Also available in: Unified diff
New mapping for RepositorySnippet + Using SecurityContext to get the email of user