Project

General

Profile

« Previous | Next » 

Revision 59733

overview authentication fixed. Edit and Register common form improved

View differences:

OverviewServlet.java
14 14
    public void doGet(HttpServletRequest request, HttpServletResponse response)
15 15
            throws ServletException, IOException {
16 16

  
17
        OIDCAuthenticationToken authentication = (OIDCAuthenticationToken) SecurityContextHolder.getContext().getAuthentication();
18
        request.getSession().setAttribute("authenticated",
19
                !authentication.getPrincipal().toString()
20
                        .equals("anonymousUser"));
21
        StringBuilder name = new StringBuilder().append(authentication.getUserInfo().getGivenName().charAt(0));
22
        name.append(authentication.getUserInfo().getFamilyName().charAt(0));
23
        request.getSession().setAttribute("name", name.toString());
17
        boolean isAuthenticated = !SecurityContextHolder.getContext().getAuthentication().getPrincipal().toString()
18
                .equals("anonymousUser");
19

  
20
        if (isAuthenticated) {
21
            OIDCAuthenticationToken authentication = (OIDCAuthenticationToken) SecurityContextHolder.getContext().getAuthentication();
22
            StringBuilder name = new StringBuilder().append(authentication.getUserInfo().getGivenName().charAt(0));
23
            name.append(authentication.getUserInfo().getFamilyName().charAt(0));
24
            request.getSession().setAttribute("name", name.toString());
25
        }
26

  
24 27
        response.setContentType("text/html");
25 28
        request.getRequestDispatcher("./overview.jsp").include(request, response);
26 29
    }

Also available in: Unified diff