cas 封装ticket的部分函数
1.绑定用户信息
protected void bindTicketGrantingTicket(String loginName, String loginPassword, HttpServletRequest request, HttpServletResponse response){ try { UsernamePasswordCredentials credentials = new UsernamePasswordCredentials(); credentials.setUsername(loginName); credentials.setPassword(loginPassword); String ticketGrantingTicket = centralAuthenticationService.createTicketGrantingTicket(credentials); ticketGrantingTicketCookieGenerator.addCookie(request, response, ticketGrantingTicket); } catch (TicketException te) { logger.error("Validate the login name " + loginName + " failure, can't bind the TGT!", te); } catch (Exception e){ logger.error("bindTicketGrantingTicket has exception.", e); } }
2.
authenticationManager这个bean可以配置你的credentials。
If you are using some other kind of credentials than UsernamePasswordCredentials, you will need to replace DefaultCredentialsToPrincipalResolver with a CredentialsToPrincipalResolver that supports the credentials you are using.