Project

General

Profile

« Previous | Next » 

Revision 59852

[Login-core]: Add Authorities updater

View differences:

FrontEndLinkURIAuthenticationSuccessHandler.java
9 9
import org.apache.log4j.Logger;
10 10
import org.mitre.openid.connect.model.OIDCAuthenticationToken;
11 11
import org.springframework.security.core.Authentication;
12
import org.springframework.security.core.context.SecurityContextHolder;
12 13
import org.springframework.security.web.authentication.AuthenticationSuccessHandler;
14
import org.springframework.session.FindByIndexNameSessionRepository;
15
import org.springframework.session.Session;
13 16

  
14 17
import javax.servlet.http.Cookie;
15 18
import javax.servlet.http.HttpServletRequest;
......
37 40
    public void onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse response, Authentication authentication) throws IllegalArgumentException, IOException   {
38 41

  
39 42
        OIDCAuthenticationToken authOIDC = (OIDCAuthenticationToken) authentication;
40

  
43
        request.getSession().setAttribute(FindByIndexNameSessionRepository.PRINCIPAL_NAME_INDEX_NAME, authOIDC.getUserInfo().getEmail());
41 44
        try {
42 45

  
43 46
//            Cookie jwt = new Cookie("XCsrfToken", JWTGenerator.generateToken(authOIDC, "my-very-secret"));

Also available in: Unified diff