cancel
Showing results for 
Search instead for 
Did you mean: 

Get Last login datetime of user

sp2
Elite Collaborator
Elite Collaborator

Hi,

I want to record users last login datetime.

Which component I need to override? I am using SSO with Azure so need to consider this in mind before implementing any solution.

Help will appreciate.

@angelborroy 

2 REPLIES 2

LeoMattioli
Employee
Employee

Hi, you need to activate audit. See docs

I once created an audit application configuration for that, I'm not sure it's still correct, but you can use it as a base

<?xml version='1.0' encoding='UTF-8'?>
<Audit
xmlns="http://www.alfresco.org/repo/audit/model/3.2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.alfresco.org/repo/audit/model/3.2 alfresco-audit-3.2.xsd"
>

<DataGenerators>
<DataGenerator name="currentUser" registeredName="auditModel.generator.user"/>
</DataGenerators>

<PathMappings>
<!-- AlfrescoNTLM logins & REST with Basic Auth (REST calls with ticket does not create a login) -->
<PathMap source="/alfresco-api/post/AuthenticationService/authenticate/no-error" target="/audit-basic-logins/login"/>
<!-- LDAP Logins -->
<PathMap source="/alfresco-api/post/ticketComponent/validateTicket" target="/audit-basic-logins/login"/>
<!-- Kerberos -->
<PathMap source="/alfresco-api/post/AuthenticationService/getCurrentUserName/no-error" target="/audit-basic-logins/login"/>
</PathMappings>

<Application name="Audit-Succesfull-Login" key="audit-basic-logins">
<AuditPath key="login">
<GenerateValue key="user" dataGenerator="currentUser"/>
</AuditPath>
</Application>
</Audit>

There's also this addon https://github.com/Acosix/alfresco-audit/tree/master that has a customization for generating some info that are not OOTB available


Leo Mattioli - Technical Account Manager @Hyland.

Great reply Leo!
I just fixed your link at the bottom.  It had a comma at the end of it.
Cheers!
Alan