Forced to reauthenticate after N days after the login:
Business scenario- If users are not logged In in salesforce from the last one week, He/She has to re-authenticate the system even though he/she logged in from the same IP range.
Solution- When you logged in Salesforce 1st time, Salesforce asks the authentication, once you authenticate, you don't need to provide the authentication if you try to login with the same IP. This happens to be salesforce maintains the IP history in the LoginIP table. In order to take care of this requirement, the developer can write the scheduled class every day. The class will check if LoginIP record CreatedDate is the last 7 days, if no record found then the system will delete all LoginIP records for that user.
Use the following to retrieve the activation records for the last N days in a batch process and delete them.
SELECT ChallengeSentDate, CreatedDate, IsAuthenticated, Id, SourceIp, UsersId FROM LoginIp where CreatedDate = LAST_N_DAYS:7
At every login, the IP address of the login request is checked against the validated IP addresses using LoginIp. A match means the login IP address is a known IP address. If there’s no match, the address is unknown, and the user is asked to confirm their identity.
No comments:
Post a Comment