Skip to content

Commit

Permalink
Fow now, fixes #535
Browse files Browse the repository at this point in the history
  • Loading branch information
oharsta committed Oct 31, 2024
1 parent 0d41780 commit 31b282a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
4 changes: 2 additions & 2 deletions myconext-server/src/main/java/myconext/model/User.java
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public class User implements Serializable, UserDetails {
private List<EduID> eduIDS = new ArrayList<>();

private long created;
private long updatedAt = System.currentTimeMillis() / 1000L;
private long updatedAt;
@Setter
@Indexed
private String trackingUuid;
Expand Down Expand Up @@ -116,7 +116,6 @@ public User(String uid, String email, String chosenName, String givenName, Strin
}
this.newUser = true;
this.created = System.currentTimeMillis() / 1000L;
this.updatedAt = created;
}

public User(String uid, String email, String chosenName, String givenName, String familyName,
Expand Down Expand Up @@ -186,6 +185,7 @@ public String computeEduIdForIdentityProviderProviderIfAbsent(RemoteProvider rem
}

private String doComputeEduIDIfAbsent(ServiceProvider serviceProvider, Manage manage) {
this.updatedAt = System.currentTimeMillis();
serviceProvider.setLastLogin(new Date());
String institutionGuid = serviceProvider.getInstitutionGuid();
String entityId = serviceProvider.getEntityId();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,18 @@ public void newUserProvisioned() throws IOException {
User user = user("[email protected]", "Mary", "Doe", "en");

MagicLinkResponse magicLinkResponse = magicLinkRequest(user, HttpMethod.POST);
assertEquals(user.getGivenName(), userRepository.findUserByEmail(user.getEmail()).get().getGivenName());
User userFromDB = userRepository.findUserByEmail(user.getEmail()).get();
assertEquals(0L, userFromDB.getLastSeenAppNudge());
assertEquals(user.getGivenName(), userFromDB.getGivenName());

String samlResponse = samlResponse(magicLinkResponse);
assertTrue(samlResponse.contains("[email protected]"));

User userFromAfter = userRepository.findUserByEmail(user.getEmail()).get();
long appNudgeDiff = System.currentTimeMillis() - userFromAfter.getLastSeenAppNudge();
int days = (int) Math.floor((double) appNudgeDiff / (1000 * 60 * 60 * 24));
assertEquals(6, days);

when()
.get("/myconext/api/idp/resend_magic_link_request?id=" + magicLinkResponse.authenticationRequestId)
.then()
Expand Down

0 comments on commit 31b282a

Please sign in to comment.