use of org.orcid.persistence.jpa.entities.ProfileEntity in project ORCID-Source by ORCID.
the class OrcidClientCredentialsCheckerTest method setupMocks.
private void setupMocks(String clientId, String memberId) {
ClientDetailsEntity clientDetailsEntity = new ClientDetailsEntity();
Set<ClientScopeEntity> scopes = new HashSet<ClientScopeEntity>(3);
scopes.add(new ClientScopeEntity(ScopePathType.ORCID_WORKS_UPDATE.value()));
scopes.add(new ClientScopeEntity(ScopePathType.ORCID_BIO_READ_LIMITED.value()));
scopes.add(new ClientScopeEntity(ScopePathType.ORCID_PROFILE_CREATE.value()));
clientDetailsEntity.setClientScopes(scopes);
clientDetailsEntity.setGroupProfileId(memberId);
ProfileEntity profile = new ProfileEntity(memberId);
profile.setRecordLocked(false);
when(clientDetailsService.loadClientByClientId(clientId)).thenReturn(clientDetailsEntity);
when(clientDetailsEntityCacheManager.retrieve(clientId)).thenReturn(clientDetailsEntity);
}
use of org.orcid.persistence.jpa.entities.ProfileEntity in project ORCID-Source by ORCID.
the class ProfileLastModifiedAspect method updateProfileLastModified.
@AfterReturning(POINTCUT_DEFINITION_BASE + " && args(profileAware, ..)")
public void updateProfileLastModified(JoinPoint joinPoint, ProfileAware profileAware) {
if (!enabled) {
return;
}
ProfileEntity profile = profileAware.getProfile();
if (profile != null) {
String orcid = profile.getId();
updateProfileLastModified(joinPoint, orcid);
}
}
use of org.orcid.persistence.jpa.entities.ProfileEntity in project ORCID-Source by ORCID.
the class ClaimController method resendClaimEmail.
@RequestMapping(value = "/resend-claim.json", method = RequestMethod.POST)
@ResponseBody
public EmailRequest resendClaimEmail(@RequestBody EmailRequest resendClaimRequest) {
String email = resendClaimRequest.getEmail();
List<String> errors = new ArrayList<>();
resendClaimRequest.setErrors(errors);
if (!validateEmailAddress(email)) {
errors.add(getMessage("Email.resetPasswordForm.invalidEmail"));
return resendClaimRequest;
}
if (!emailManager.emailExists(email)) {
errors.add(getMessage("orcid.frontend.reset.password.email_not_found", email));
return resendClaimRequest;
}
String orcid = emailManager.findOrcidIdByEmail(email);
ProfileEntity profile = profileEntityCacheManager.retrieve(orcid);
if (profile != null && profile.getClaimed()) {
errors.add(getMessage("orcid.frontend.security.already_claimed_with_link"));
return resendClaimRequest;
}
notificationManager.sendApiRecordCreationEmail(email, orcid);
resendClaimRequest.setSuccessMessage(getMessage("resend_claim.successful_resend"));
return resendClaimRequest;
}
use of org.orcid.persistence.jpa.entities.ProfileEntity in project ORCID-Source by ORCID.
the class GroupAdministratorController method resetClientSecret.
/**
* Reset client secret
* */
@RequestMapping(value = "/reset-client-secret.json", method = RequestMethod.POST)
@ResponseBody
public boolean resetClientSecret(@RequestBody String clientId) {
//Verify this client belongs to the member
ClientDetailsEntity clientDetails = clientDetailsManager.findByClientId(clientId);
if (clientDetails == null)
return false;
ProfileEntity groupProfile = profileEntityCacheManager.retrieve(clientDetails.getGroupProfileId());
if (groupProfile == null)
return false;
if (!groupProfile.getId().equals(getCurrentUserOrcid()))
return false;
return orcidSSOManager.resetClientSecret(clientId);
}
use of org.orcid.persistence.jpa.entities.ProfileEntity in project ORCID-Source by ORCID.
the class DeveloperToolsController method resetClientSecret.
@RequestMapping(value = "/reset-client-secret", method = RequestMethod.POST)
@ResponseBody
public boolean resetClientSecret(@RequestBody String clientId) {
//Verify this client belongs to the user
ClientDetailsEntity clientDetails = clientDetailsManager.findByClientId(clientId);
if (clientDetails == null)
return false;
ProfileEntity groupProfile = profileEntityCacheManager.retrieve(clientDetails.getGroupProfileId());
if (groupProfile == null)
return false;
if (!groupProfile.getId().equals(getCurrentUserOrcid()))
return false;
return orcidSSOManager.resetClientSecret(clientId);
}
Aggregations