use of org.orcid.pojo.ThirdPartyRedirect in project ORCID-Source by ORCID.
the class WorkspaceController method getSourceGrantReadWizard.
@RequestMapping(value = "/my-orcid/sourceGrantReadWizard.json", method = RequestMethod.GET)
@ResponseBody
public ThirdPartyRedirect getSourceGrantReadWizard() {
ThirdPartyRedirect tpr = new ThirdPartyRedirect();
ProfileEntity profile = profileEntityCacheManager.retrieve(getEffectiveUserOrcid());
if (profile.getSource() == null || profile.getSource().getSourceId() == null) {
return tpr;
}
String sourcStr = profile.getSource().getSourceId();
// Check that the cache is up to date
evictThirdPartyLinkManagerCacheIfNeeded();
// Get list of clients
List<OrcidClient> orcidClients = thirdPartyLinkManager.findOrcidClientsWithPredefinedOauthScopeReadAccess();
for (OrcidClient orcidClient : orcidClients) {
if (sourcStr.equals(orcidClient.getClientId())) {
RedirectUri ru = orcidClient.getRedirectUris().getRedirectUri().get(0);
String redirect = getBaseUri() + "/oauth/authorize?client_id=" + orcidClient.getClientId() + "&response_type=code&scope=" + ru.getScopeAsSingleString() + "&redirect_uri=" + ru.getValue();
tpr.setUrl(redirect);
tpr.setDisplayName(orcidClient.getDisplayName());
tpr.setShortDescription(orcidClient.getShortDescription());
return tpr;
}
}
return tpr;
}
Aggregations