mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-17 06:53:09 +00:00
[CST-5669] Removed check on first name and last name during ORCID authentication
This commit is contained in:
@@ -221,8 +221,16 @@ public class OrcidAuthenticationBean implements AuthenticationMethod {
|
|||||||
eperson.setNetid(orcid);
|
eperson.setNetid(orcid);
|
||||||
|
|
||||||
eperson.setEmail(email);
|
eperson.setEmail(email);
|
||||||
eperson.setFirstName(context, getFirstName(person));
|
|
||||||
eperson.setLastName(context, getLastName(person));
|
Optional<String> firstName = getFirstName(person);
|
||||||
|
if (firstName.isPresent()) {
|
||||||
|
eperson.setFirstName(context, firstName.get());
|
||||||
|
}
|
||||||
|
|
||||||
|
Optional<String> lastName = getLastName(person);
|
||||||
|
if (lastName.isPresent()) {
|
||||||
|
eperson.setLastName(context, lastName.get());
|
||||||
|
}
|
||||||
eperson.setCanLogIn(true);
|
eperson.setCanLogIn(true);
|
||||||
eperson.setSelfRegistered(true);
|
eperson.setSelfRegistered(true);
|
||||||
|
|
||||||
@@ -282,18 +290,16 @@ public class OrcidAuthenticationBean implements AuthenticationMethod {
|
|||||||
return Optional.ofNullable(emails.get(0).getEmail());
|
return Optional.ofNullable(emails.get(0).getEmail());
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getFirstName(Person person) {
|
private Optional<String> getFirstName(Person person) {
|
||||||
return Optional.ofNullable(person.getName())
|
return Optional.ofNullable(person.getName())
|
||||||
.map(name -> name.getGivenNames())
|
.map(name -> name.getGivenNames())
|
||||||
.map(givenNames -> givenNames.getContent())
|
.map(givenNames -> givenNames.getContent());
|
||||||
.orElseThrow(() -> new IllegalStateException("The found ORCID person has no first name"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getLastName(Person person) {
|
private Optional<String> getLastName(Person person) {
|
||||||
return Optional.ofNullable(person.getName())
|
return Optional.ofNullable(person.getName())
|
||||||
.map(name -> name.getFamilyName())
|
.map(name -> name.getFamilyName())
|
||||||
.map(givenNames -> givenNames.getContent())
|
.map(givenNames -> givenNames.getContent());
|
||||||
.orElseThrow(() -> new IllegalStateException("The found ORCID person has no last name"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean canSelfRegister() {
|
private boolean canSelfRegister() {
|
||||||
|
Reference in New Issue
Block a user