11-29-2017 03:03 AM
Hello everyone. I am trying to do something like -
All user passwords should expire every 90 days.
Users should be forced to reset their expired passwords upon login to share with last password.
anybody have any idea, how to do it ?
thanks in advance.
09-30-2019 11:35 PM
this worked..
var userNodeQuery = "TYPE:\"usr:user\""; var userNodeQueryDef = { query: userNodeQuery , language: "fts-alfresco" , store: "user://alfrescoUserStore" }; userNodes = search.query(userNodeQueryDef);
11-29-2017 01:56 PM
As always with any functionality that is not provided out-of-the-box you need to do significant custom implementation to achieve this. Luckily, Alfresco already provides the Java-level API to manage, store and validate expiration dates on authentications. Whenever a user is created or a new password is set, you could use a policy / behaviour to automatically set the expiration date back to 90 days in the future.
With that in place, you'd "only" need to implement all the missing UI functionality, i.e. displaying expiration reminders and handling the password change prompt. Unfortunately, since Alfresco is a web application, you cannot force users to change their password - I mean, you can force the dialog upon them, but they can always opt not to change the password by simply closing the browser, or they could use browser tools to hide / disable the popup.
01-02-2018 12:47 AM
Thank you so much for your help. I have tried something -
I have created a behaviour to set a custom date(90 days from current date) to property ContentModel.PROP_CREDENTIALS_EXPIRY_DATE.
Calendar now = Calendar.getInstance();
now.add(Calendar.DATE, 90);
passwordExpiryDate = now.getTime();
nodeService.setProperty(nodeRef, ContentModel.PROP_CREDENTIALS_EXPIRY_DATE, passwordExpiryDate);
and then trying to fetch this property just to check whether it is set or not.
logger.debug("PROP_CREDENTIALS_EXPIRY_DATE : " + nodeService.getProperty(nodeRef, ContentModel.PROP_CREDENTIALS_EXPIRY_DATE));
it is showing the correct value on console.
then, I have created a sceduler to run a .js file everyday to fetch this property. Its showing null.
not sure, why its showing null if the proprty is alredy set.
then, to check this I did
Calendar now = Calendar.getInstance();
now.add(Calendar.DATE, 90);
passwordExpiryDate = now.getTime();
nodeService.setProperty(nodeRef, ContentModel.PROP_CREDENTIALS_EXPIRY_DATE, passwordExpiryDate);
to another java file (which triggers when a new user is created) and
logger.debug("PROP_CREDENTIALS_EXPIRY_DATE : " + nodeService.getProperty(nodeRef, ContentModel.PROP_CREDENTIALS_EXPIRY_DATE));
to the same behaviour.
now property PROP_CREDENTIALS_EXPIRY_DATE is setting while creating a new user, but when behaviour triggers, logs is showing NULL value.
don't know what mistake I am doing, whether PROP_CREDENTIALS_EXPIRY_DATE property can directly be used or not. If yes, then how.
could you please help me with this.
Please let know If there is another way to do it or this way is correct and I am making some mistake.
thanks in advance.
01-02-2018 01:37 AM
Keep in mind that there are two nodes for each locally-maintained user. A cmerson node (which also exists for LDAP/AD synchronised users) which is accessed by most APIs, and the usr:user which contains the local authentication data (password + expiry). So be careful which of these two nodes you are accessing in your code.
01-02-2018 02:19 AM
yes, thank you.. I have checked, the custom behaviour is having a user type nodeRef and the another class is having a person type nodeRef.
so, How do I get the user type nodeRef from a person type nodeRef ? do you have any idea ? which API can help me to get this ?
Explore our Alfresco products with the links below. Use labels to filter content by product module.