Author: ilgrosso Date: Thu Jun 19 08:50:52 2014 New Revision: 1603763 URL: http://svn.apache.org/r1603763 Log: [SYNCOPE-507] Reworking provided patch
Modified: syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/security/SyncopeAuthenticationProvider.java syncope/branches/1_1_X/core/src/main/resources/content.xml syncope/branches/1_1_X/core/src/test/resources/content.xml Modified: syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/security/SyncopeAuthenticationProvider.java URL: http://svn.apache.org/viewvc/syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/security/SyncopeAuthenticationProvider.java?rev=1603763&r1=1603762&r2=1603763&view=diff ============================================================================== --- syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/security/SyncopeAuthenticationProvider.java (original) +++ syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/security/SyncopeAuthenticationProvider.java Thu Jun 19 08:50:52 2014 @@ -147,7 +147,7 @@ public class SyncopeAuthenticationProvid LOG.debug("User {} successfully authenticated, with roles {}", authentication.getPrincipal(), token.getAuthorities()); - if (user != null) { + if (user != null && Boolean.valueOf(confDAO.find("log.lastlogindate", Boolean.toString(true)).getValue())) { user.setLastLoginDate(new Date()); user.setFailedLogins(0); userDAO.save(user); Modified: syncope/branches/1_1_X/core/src/main/resources/content.xml URL: http://svn.apache.org/viewvc/syncope/branches/1_1_X/core/src/main/resources/content.xml?rev=1603763&r1=1603762&r2=1603763&view=diff ============================================================================== --- syncope/branches/1_1_X/core/src/main/resources/content.xml (original) +++ syncope/branches/1_1_X/core/src/main/resources/content.xml Thu Jun 19 08:50:52 2014 @@ -32,6 +32,8 @@ under the License. <SyncopeConf confKey="notification.maxRetries" confValue="0"/> <!-- when needing to provide more values, use '|' as separator and no spaces --> <SyncopeConf confKey="authentication.statuses" confValue="active"/> + <!-- Save user login date upon successful authentication --> + <SyncopeConf confKey="log.lastlogindate" confValue="true"/> <!-- Authentication and authorization --> <Entitlement name="SCHEMA_CREATE"/> Modified: syncope/branches/1_1_X/core/src/test/resources/content.xml URL: http://svn.apache.org/viewvc/syncope/branches/1_1_X/core/src/test/resources/content.xml?rev=1603763&r1=1603762&r2=1603763&view=diff ============================================================================== --- syncope/branches/1_1_X/core/src/test/resources/content.xml (original) +++ syncope/branches/1_1_X/core/src/test/resources/content.xml Thu Jun 19 08:50:52 2014 @@ -32,6 +32,8 @@ under the License. <SyncopeConf confKey="notification.maxRetries" confValue="3"/> <!-- when needing to provide more values, use '|' as separator and no spaces --> <SyncopeConf confKey="authentication.statuses" confValue="created|active"/> + <!-- Save user login date upon successful authentication --> + <SyncopeConf confKey="log.lastlogindate" confValue="true"/> <!-- sample policies --> <Policy DTYPE="SyncPolicy" id="1" description="sync policy 1" type="GLOBAL_SYNC" specification="%3Corg.apache.syncope.common.types.SyncPolicySpec%2F%3E"/>