private void setSessionPrincipal()

in src/main/java/com/microsoft/aad/oidcpoc/AuthFlow.java [237:251]


    private void setSessionPrincipal(HttpServletRequest httpRequest,
                                     AuthenticationResult result, HttpServletResponse httpResponse) throws Exception, Exception {
        httpRequest.getSession().setAttribute(AuthHelper.PRINCIPAL_SESSION_NAME, result);
        
        String uri = httpRequest.getRequestURI(); 
        if (! uri.equalsIgnoreCase("/secure/linkaccounts")) {
        	//exempting the linkaccounts call from linked account checking to avoid a loop here
            String uniqueId = result.getUserInfo().getUniqueId();
            if (!AuthHelper.SetAADSession(httpRequest, uniqueId)) {
                httpResponse.sendRedirect(((HttpServletRequest) httpRequest)
                        .getContextPath() + "/secure/linkaccounts");
                return;
            }
        }
    }