diff --git a/orcid-web/src/main/java/org/orcid/frontend/spring/ShibbolethAjaxAuthenticationSuccessHandler.java b/orcid-web/src/main/java/org/orcid/frontend/spring/ShibbolethAjaxAuthenticationSuccessHandler.java index 35afa2a2818..c515ff5d4a1 100644 --- a/orcid-web/src/main/java/org/orcid/frontend/spring/ShibbolethAjaxAuthenticationSuccessHandler.java +++ b/orcid-web/src/main/java/org/orcid/frontend/spring/ShibbolethAjaxAuthenticationSuccessHandler.java @@ -11,11 +11,15 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import org.orcid.core.common.manager.EventManager; import org.orcid.core.manager.InstitutionalSignInManager; +import org.orcid.core.togglz.Features; +import org.orcid.core.utils.EventType; import org.orcid.frontend.web.exception.FeatureDisabledException; import org.orcid.pojo.RemoteUser; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.security.core.Authentication; @@ -30,10 +34,16 @@ public class ShibbolethAjaxAuthenticationSuccessHandler extends AjaxAuthenticati @Resource private InstitutionalSignInManager institutionalSignInManager; + + @Autowired + EventManager eventManager; public void onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse response, Authentication authentication) throws IOException, ServletException { linkShibbolethAccount(request, response); String targetUrl = getTargetUrl(request, response, authentication); + if (Features.EVENTS.isActive()) { + eventManager.createEvent(EventType.SIGN_IN, request); + } response.setContentType("application/json"); response.getWriter().println("{\"success\": true, \"url\": \"" + targetUrl.replaceAll("^/", "") + "\"}"); }