public String establishLink()

in src/main/java/com/microsoft/aad/oidcpoc/LoginController.java [59:76]


	public String establishLink(ModelMap model, HttpServletRequest httpRequest) throws ClassNotFoundException, Exception {
		String userName = httpRequest.getParameter("j_username");
		String password = httpRequest.getParameter("j_password");
		
		DBUser user = AuthHelper.AuthLocalUser(httpRequest, userName, password, false); 
		if (user != null) {
			AuthenticationResult res = AuthHelper.getAuthSessionObject(httpRequest);
			UserInfo info = res.getUserInfo();
			String uniqueId = info.getUniqueId();
			int userId = user.UserId;
			AuthHelper.LinkAccounts(httpRequest, uniqueId, userId);
			
			return "redirect:/";
		} else {
			model.addAttribute("error", "Sorry, we could not validate your account. Please try again.");
			return "/secure/linkaccounts";
		}
	}