您的位置:首页 > 其它

cas 封装ticket的部分函数

2016-07-29 00:00 183 查看
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.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: