Skip to content

Commit

Permalink
Merge branch 'main' into TogglzCleanup3
Browse files Browse the repository at this point in the history
  • Loading branch information
amontenegro committed Dec 19, 2023
2 parents 12e1cd1 + a5bf77d commit d548fc6
Show file tree
Hide file tree
Showing 29 changed files with 332 additions and 231 deletions.
23 changes: 23 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,26 @@
## v2.47.1 - 2023-12-18

[Full Changelog](https://github.com/ORCID/ORCID-Source/compare/v2.47.0...v2.47.1)

- [#6951](https://github.com/ORCID/ORCID-Source/pull/6951): Remove old togglz from FTL

## v2.47.0 - 2023-12-18

[Full Changelog](https://github.com/ORCID/ORCID-Source/compare/v2.46.0...v2.47.0)

- [#6949](https://github.com/ORCID/ORCID-Source/pull/6949): feature: Add encourage user to add works to email events log

### Feature

- Add log for sending `add works reminder` to `profile_event` table
- Add encourage user to add works to email events log

## v2.46.0 - 2023-12-14

[Full Changelog](https://github.com/ORCID/ORCID-Source/compare/v2.45.7...v2.46.0)

- [#6948](https://github.com/ORCID/ORCID-Source/pull/6948): Togglz cleanup

## v2.45.7 - 2023-12-14

[Full Changelog](https://github.com/ORCID/ORCID-Source/compare/v2.45.6...v2.45.7)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
import org.orcid.persistence.dao.GenericDao;
import org.orcid.persistence.dao.NotificationDao;
import org.orcid.persistence.dao.ProfileDao;
import org.orcid.persistence.dao.ProfileEventDao;
import org.orcid.persistence.jpa.entities.ActionableNotificationEntity;
import org.orcid.persistence.jpa.entities.ClientDetailsEntity;
import org.orcid.persistence.jpa.entities.ClientRedirectUriEntity;
Expand Down Expand Up @@ -83,7 +84,7 @@ public class NotificationManagerImpl extends ManagerReadOnlyBaseImpl implements
private EncryptionManager encryptionManager;

@Resource
private GenericDao<ProfileEventEntity, Long> profileEventDao;
private ProfileEventDao profileEventDao;

@Resource
private ProfileDao profileDao;
Expand Down Expand Up @@ -128,7 +129,7 @@ public void setEncryptionManager(EncryptionManager encryptionManager) {
this.encryptionManager = encryptionManager;
}

public void setProfileEventDao(GenericDao<ProfileEventEntity, Long> profileEventDao) {
public void setProfileEventDao(ProfileEventDao profileEventDao) {
this.profileEventDao = profileEventDao;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
import org.orcid.core.manager.TwoFactorAuthenticationManager;
import org.orcid.core.manager.read_only.EmailManagerReadOnly;
import org.orcid.jaxb.model.record_v2.Email;
import org.orcid.persistence.dao.GenericDao;
import org.orcid.persistence.dao.ProfileDao;
import org.orcid.persistence.dao.ProfileEventDao;
import org.orcid.persistence.jpa.entities.ProfileEntity;
import org.orcid.persistence.jpa.entities.ProfileEventEntity;
import org.orcid.persistence.jpa.entities.ProfileEventType;
Expand All @@ -40,7 +40,7 @@ public class TwoFactorAuthenticationManagerImpl implements TwoFactorAuthenticati
private BackupCodeManager backupCodeManager;

@Resource
private GenericDao<ProfileEventEntity, Long> profileEventDao;
private ProfileEventDao profileEventDao;

@Resource
private ProfileDao profileDao;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
import org.orcid.persistence.dao.GenericDao;
import org.orcid.persistence.dao.NotificationDao;
import org.orcid.persistence.dao.ProfileDao;
import org.orcid.persistence.dao.ProfileEventDao;
import org.orcid.persistence.jpa.entities.ActionableNotificationEntity;
import org.orcid.persistence.jpa.entities.ClientDetailsEntity;
import org.orcid.persistence.jpa.entities.ClientRedirectUriEntity;
Expand Down Expand Up @@ -101,7 +102,7 @@ public class NotificationManagerImpl extends ManagerReadOnlyBaseImpl implements
private EncryptionManager encryptionManager;

@Resource
private GenericDao<ProfileEventEntity, Long> profileEventDao;
private ProfileEventDao profileEventDao;

@Resource
private ProfileDao profileDao;
Expand Down Expand Up @@ -175,7 +176,7 @@ public void setEncryptionManager(EncryptionManager encryptionManager) {
this.encryptionManager = encryptionManager;
}

public void setProfileEventDao(GenericDao<ProfileEventEntity, Long> profileEventDao) {
public void setProfileEventDao(ProfileEventDao profileEventDao) {
this.profileEventDao = profileEventDao;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,6 @@ private boolean isEqual(String str1, String str2) {

@Override
protected boolean hostMatches(String registered, String requested) {
return isEqual(registered, requested) || (requested != null && requested.endsWith("." + registered));
return isEqual(registered, requested);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,15 @@
import org.kohsuke.args4j.CmdLineException;
import org.kohsuke.args4j.CmdLineParser;
import org.kohsuke.args4j.Option;
import org.orcid.core.manager.NotificationManager;
import org.orcid.core.manager.TemplateManager;
import org.orcid.core.manager.impl.OrcidUrlManager;
import org.orcid.core.manager.v3.RecordNameManager;
import org.orcid.jaxb.model.notification_v2.NotificationType;
import org.orcid.persistence.dao.GenericDao;
import org.orcid.persistence.dao.NotificationDao;
import org.orcid.persistence.dao.ProfileDao;
import org.orcid.persistence.dao.ProfileEventDao;
import org.orcid.persistence.dao.impl.ProfileEventDaoImpl;
import org.orcid.persistence.jpa.entities.NotificationServiceAnnouncementEntity;
import org.orcid.persistence.jpa.entities.ProfileEntity;
import org.orcid.persistence.jpa.entities.ProfileEventEntity;
Expand Down Expand Up @@ -54,7 +55,7 @@ public class EmailFrequencyServiceAnnouncement2018 {

private TemplateManager templateManager;

private GenericDao<ProfileEventEntity, Long> profileEventDao;
private ProfileEventDao profileEventDao;

private NotificationDao notificationDao;

Expand Down Expand Up @@ -100,7 +101,7 @@ private void init() {
profileDaoReadOnly = (ProfileDao) context.getBean("profileDaoReadOnly");
messages = (MessageSource) context.getBean("messageSource");
templateManager = (TemplateManager) context.getBean("templateManager");
profileEventDao = (GenericDao) context.getBean("profileEventDao");
profileEventDao = (ProfileEventDao) context.getBean("profileEventDao");
notificationDao = (NotificationDao) context.getBean("notificationDao");
orcidUrlManager = (OrcidUrlManager) context.getBean("orcidUrlManager");
recordNameManager = (RecordNameManager) context.getBean("recordNameManagerV3");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
import org.kohsuke.args4j.CmdLineException;
import org.kohsuke.args4j.CmdLineParser;
import org.kohsuke.args4j.Option;
import org.orcid.persistence.dao.GenericDao;
import org.orcid.persistence.dao.ProfileDao;
import org.orcid.persistence.dao.ProfileEventDao;
import org.orcid.persistence.jpa.entities.ProfileEventEntity;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand All @@ -37,7 +37,7 @@ public class ProfileEventManager {
private ProfileDao profileDao;

@Resource
private GenericDao<ProfileEventEntity, Long> profileEventDao;
private ProfileEventDao profileEventDao;

@Resource
private TransactionTemplate transactionTemplate;
Expand Down Expand Up @@ -136,11 +136,11 @@ public void setProfileDao(ProfileDao profileDao) {
this.profileDao = profileDao;
}

public GenericDao<ProfileEventEntity, Long> getProfileEventDao() {
public ProfileEventDao getProfileEventDao() {
return profileEventDao;
}

public void setProfileEventDao(GenericDao<ProfileEventEntity, Long> profileEventDao) {
public void setProfileEventDao(ProfileEventDao profileEventDao) {
this.profileEventDao = profileEventDao;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import org.orcid.persistence.dao.GenericDao;
import org.orcid.persistence.dao.NotificationDao;
import org.orcid.persistence.dao.ProfileDao;
import org.orcid.persistence.dao.ProfileEventDao;
import org.orcid.persistence.jpa.entities.EmailFrequencyEntity;
import org.orcid.persistence.jpa.entities.NotificationTipEntity;
import org.orcid.persistence.jpa.entities.ProfileEntity;
Expand All @@ -41,7 +42,7 @@ public abstract class QuarterlyNotificationsManager {

private static Logger LOG = LoggerFactory.getLogger(QuarterlyNotificationsManager.class);

private GenericDao<ProfileEventEntity, Long> profileEventDao;
private ProfileEventDao profileEventDao;

private ProfileDao profileDaoReadOnly;

Expand Down Expand Up @@ -89,7 +90,7 @@ public QuarterlyNotificationsManager(ProfileEventType created, ProfileEventType
notificationDao = (NotificationDao) context.getBean("notificationDao");
orcidUrlManager = (OrcidUrlManager) context.getBean("orcidUrlManager");
emailFrequencyDao = (EmailFrequencyDao) context.getBean("emailFrequencyDao");
profileEventDao = (GenericDao) context.getBean("profileEventDao");
profileEventDao = (ProfileEventDao) context.getBean("profileEventDao");
encryptionManager = (EncryptionManager) context.getBean("encryptionManager");
messages = (MessageSource) context.getBean("messageSource");
transactionTemplate = (TransactionTemplate) context.getBean("transactionTemplate");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
import org.orcid.persistence.dao.GenericDao;
import org.orcid.persistence.dao.NotificationDao;
import org.orcid.persistence.dao.ProfileDao;
import org.orcid.persistence.dao.ProfileEventDao;
import org.orcid.persistence.dao.impl.NotificationDaoImpl;
import org.orcid.persistence.jpa.entities.ClientDetailsEntity;
import org.orcid.persistence.jpa.entities.NotificationEntity;
Expand All @@ -80,7 +81,7 @@ public class NotificationManagerTest extends DBUnitTest {


@Mock
private GenericDao<ProfileEventEntity, Long> profileEventDao;
private ProfileEventDao profileEventDao;

@Mock
private SourceManager sourceManager;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import org.orcid.jaxb.model.record_v2.Email;
import org.orcid.persistence.dao.GenericDao;
import org.orcid.persistence.dao.ProfileDao;
import org.orcid.persistence.dao.ProfileEventDao;
import org.orcid.persistence.jpa.entities.ProfileEntity;
import org.orcid.persistence.jpa.entities.ProfileEventEntity;

Expand All @@ -49,7 +50,7 @@ public class TwoFactorAuthenticationManagerTest {
private ProfileDao profileDao;

@Mock
private GenericDao<ProfileEventEntity, Long> profileEventDao;
private ProfileEventDao profileEventDao;

@InjectMocks
private TwoFactorAuthenticationManagerImpl twoFactorAuthenticationManager;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
import org.orcid.persistence.dao.GenericDao;
import org.orcid.persistence.dao.NotificationDao;
import org.orcid.persistence.dao.ProfileDao;
import org.orcid.persistence.dao.ProfileEventDao;
import org.orcid.persistence.dao.impl.NotificationDaoImpl;
import org.orcid.persistence.jpa.entities.ClientDetailsEntity;
import org.orcid.persistence.jpa.entities.EmailEventEntity;
Expand All @@ -90,7 +91,7 @@ public class NotificationManagerTest extends DBUnitTest {
"/data/BiographyEntityData.xml");

@Mock
private GenericDao<ProfileEventEntity, Long> profileEventDao;
private ProfileEventDao profileEventDao;

@Mock
private SourceManager mockSourceManager;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Random;
import java.util.Set;

import javax.annotation.Resource;
Expand Down Expand Up @@ -42,6 +43,8 @@ public class OrcidRefreshTokenTokenGranterTest extends DBUnitTest {
private static final String CLIENT_ID_2 = "APP-5555555555555556";
private static final String USER_ORCID = "0000-0000-0000-0001";

private Random random = new Random(System.currentTimeMillis());

@Resource
private OrcidOauth2TokenDetailService orcidOauth2TokenDetailService;

Expand Down Expand Up @@ -119,8 +122,8 @@ public void createRefreshTokenTest() {
// should be equal
long time = System.currentTimeMillis();
String scope = "/activities/update";
String tokenValue = "parent-token-" + time;
String refreshTokenValue = "refresh-token-" + time;
String tokenValue = "parent-token-" + random.nextLong();
String refreshTokenValue = "refresh-token-" + random.nextLong();
Boolean revokeOld = null;
Date parentTokenExpiration = new Date(time + 10000);
Long expireIn = null;
Expand Down Expand Up @@ -154,8 +157,8 @@ public void createRefreshTokenWithNarrowerScopesTest() {
long time = System.currentTimeMillis();
String parentScope = "/activities/update";
String refreshScope = "/orcid-works/create";
String tokenValue = "parent-token-" + time;
String refreshTokenValue = "refresh-token-" + time;
String tokenValue = "parent-token-" + random.nextLong();
String refreshTokenValue = "refresh-token-" + random.nextLong();
Boolean revokeOld = true;
Date parentTokenExpiration = new Date(time + 10000);
Long expireIn = null;
Expand Down Expand Up @@ -188,8 +191,8 @@ public void createRefreshTokenWithoutRevokeParent() {
// should be enabled, refresh should be enabled
long time = System.currentTimeMillis();
String parentScope = "/activities/update /read-limited";
String tokenValue = "parent-token-" + time;
String refreshTokenValue = "refresh-token-" + time;
String tokenValue = "parent-token-" + random.nextLong();
String refreshTokenValue = "refresh-token-" + random.nextLong();
Boolean revokeOld = false;
Date parentTokenExpiration = new Date(time + 10000);
Long expireIn = null;
Expand Down Expand Up @@ -228,8 +231,8 @@ public void createRefreshTokenWithoutRevokeParentAndWithNarrowerScopes() {
long time = System.currentTimeMillis();
String parentScope = "/person/read-limited";
String refreshScope = "/orcid-bio/read-limited";
String tokenValue = "parent-token-" + time;
String refreshTokenValue = "refresh-token-" + time;
String tokenValue = "parent-token-" + random.nextLong();
String refreshTokenValue = "refresh-token-" + random.nextLong();
Boolean revokeOld = false;
Date parentTokenExpiration = new Date(time + 10000);
Long expireIn = null;
Expand Down Expand Up @@ -262,8 +265,8 @@ public void createRefreshTokenWithExpirationOf10Secs() {
long time = System.currentTimeMillis();
String parentScope = "/person/read-limited";
String refreshScope = "/orcid-bio/read-limited";
String tokenValue = "parent-token-" + time;
String refreshTokenValue = "refresh-token-" + time;
String tokenValue = "parent-token-" + random.nextLong();
String refreshTokenValue = "refresh-token-" + random.nextLong();
Boolean revokeOld = false;
Date parentTokenExpiration = new Date(time + 10000);
Long expireIn = 5L;
Expand Down Expand Up @@ -299,8 +302,8 @@ public void tryToCreateRefreshTokenWithInvalidScopesTest() {
long time = System.currentTimeMillis();
String parentScope = "/person/update";
String refreshScope = "/orcid-works/read-limited";
String tokenValue = "parent-token-" + time;
String refreshTokenValue = "refresh-token-" + time;
String tokenValue = "parent-token-" + random.nextLong();
String refreshTokenValue = "refresh-token-" + random.nextLong();
Boolean revokeOld = true;
Date parentTokenExpiration = new Date(time + 10000);
Long expireIn = null;
Expand All @@ -322,8 +325,8 @@ public void tryToCreateRefreshTokenWithThatExpireAfterParentTokenTest() {
// token, fail
long time = System.currentTimeMillis();
String parentScope = "/person/update";
String tokenValue = "parent-token-" + time;
String refreshTokenValue = "refresh-token-" + time;
String tokenValue = "parent-token-" + random.nextLong();
String refreshTokenValue = "refresh-token-" + random.nextLong();
Boolean revokeOld = true;
Date parentTokenExpiration = new Date(time + 10000);
Long expireIn = time + (15000);
Expand All @@ -345,8 +348,8 @@ public void tryToCreateRefreshTokenWithInvalidClientTest() {
// client # 2, fail
long time = System.currentTimeMillis();
String parentScope = "/person/update";
String tokenValue = "parent-token-" + time;
String refreshTokenValue = "refresh-token-" + time;
String tokenValue = "parent-token-" + random.nextLong();
String refreshTokenValue = "refresh-token-" + random.nextLong();
Boolean revokeOld = true;
Date parentTokenExpiration = new Date(time + 10000);
Long expireIn = null;
Expand All @@ -367,8 +370,8 @@ public void tryToCreateRefreshTokenWithInvalidClientTest() {
public void tryToRefreshAnExpiredTokenTest() {
long time = System.currentTimeMillis();
String parentScope = "/person/update";
String tokenValue = "parent-token-" + time;
String refreshTokenValue = "refresh-token-" + time;
String tokenValue = "parent-token-" + random.nextLong();
String refreshTokenValue = "refresh-token-" + random.nextLong();
Boolean revokeOld = true;
Date parentTokenExpiration = new Date(time - 10000);
Long expireIn = null;
Expand All @@ -390,8 +393,8 @@ public void tryToCreateRefreshTokenWithInvalidRefreshTokenTest() {
// fail
long time = System.currentTimeMillis();
String parentScope = "/person/update";
String tokenValue = "parent-token-" + time;
String refreshTokenValue = "refresh-token-" + time;
String tokenValue = "parent-token-" + random.nextLong();
String refreshTokenValue = "refresh-token-" + random.nextLong();
Boolean revokeOld = true;
Date parentTokenExpiration = new Date(time + 10000);
Long expireIn = null;
Expand All @@ -415,8 +418,8 @@ public void tryToCreateRefreshTokenWithInvalidParentTokenValueTest() {
// value, fail
long time = System.currentTimeMillis();
String parentScope = "/person/update";
String tokenValue = "parent-token-" + time;
String refreshTokenValue = "refresh-token-" + time;
String tokenValue = "parent-token-" + random.nextLong();
String refreshTokenValue = "refresh-token-" + random.nextLong();
Boolean revokeOld = true;
Date parentTokenExpiration = new Date(time + 15000);
Long expireIn = null;
Expand All @@ -428,7 +431,7 @@ public void tryToCreateRefreshTokenWithInvalidParentTokenValueTest() {
// We shouldn't care about the access token, it's not required and
// shouldn't really be there. If the refresh token and client
// credentials are good, we can generate the refresh token.
assertNotNull(refreshedToken);
assertNotNull(refreshedToken);
}

}
Loading

0 comments on commit d548fc6

Please sign in to comment.