Skip to content

Commit

Permalink
todo: ValidateEmail on AuthenticatedUser like BuiltinUser #2512
Browse files Browse the repository at this point in the history
  • Loading branch information
pdurbin committed Sep 14, 2015
1 parent fede448 commit 72ca330
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/main/java/edu/harvard/iq/dataverse/Shib.java
Original file line number Diff line number Diff line change
Expand Up @@ -474,6 +474,7 @@ public enum DevShibAccountType {
TESTSHIB1,
HARVARD1,
HARVARD2,
TWO_EMAILS,
};

private DevShibAccountType getDevShibAccountType() {
Expand Down Expand Up @@ -533,6 +534,10 @@ private void possiblyMutateRequestInDev() {
mutateRequestForDevConstantHarvard2();
break;

case TWO_EMAILS:
mutateRequestForDevConstantTwoEmails();
break;

default:
logger.info("Should never reach here");
break;
Expand Down Expand Up @@ -902,4 +907,13 @@ private void mutateRequestForDevConstantHarvard2() {
request.setAttribute(usernameAttribute, "ghopper");
}

private void mutateRequestForDevConstantTwoEmails() {
request.setAttribute(shibIdpAttribute, "https://fake.example.com/idp/shibboleth");
request.setAttribute(uniquePersistentIdentifier, "twoEmails");
request.setAttribute(firstNameAttribute, "Eric");
request.setAttribute(lastNameAttribute, "Allman");
request.setAttribute(emailAttribute, "eric1@mailinator.com;eric2@mailinator.com");
request.setAttribute(usernameAttribute, "eallman");
}

}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package edu.harvard.iq.dataverse.authorization.users;

import edu.harvard.iq.dataverse.DatasetLock;
import edu.harvard.iq.dataverse.ValidateEmail;
import edu.harvard.iq.dataverse.authorization.AuthenticatedUserDisplayInfo;
import edu.harvard.iq.dataverse.authorization.AuthenticatedUserLookup;
import edu.harvard.iq.dataverse.authorization.RoleAssigneeDisplayInfo;
Expand Down Expand Up @@ -47,6 +48,11 @@ public class AuthenticatedUser implements User, Serializable {
@Column(nullable = false, unique=true)
private String userIdentifier;

/**
* @todo Uncomment the ValidateEmail annotation below for consistency with
* the annotation on BuiltinUser.
*/
// @ValidateEmail(message = "Please enter a valid email address.")
@NotNull
@Column(nullable = false, unique=true)
private String email;
Expand Down

0 comments on commit 72ca330

Please sign in to comment.