Skip to content

Commit

Permalink
fix: Add missing capture event in shibboleth account link
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielPalafox committed Nov 16, 2023
1 parent 4bf960c commit 37b49e6
Showing 1 changed file with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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("^/", "") + "\"}");
}
Expand Down

0 comments on commit 37b49e6

Please sign in to comment.