【发布时间】:2013-12-11 16:01:17
【问题描述】:
在我的 junit 中,我希望能够注销用户。
这是我的junit登录功能:
protected void loginPlayer(String loginName) {
System.out.println("Logging in player: " + loginName);
Player player = this.playerRepository.findPlayerByLoginName(loginName);
UserDetails playerSession = new PlayerSession(player.getId(), loginName, player.getPassword());
Authentication auth = new UsernamePasswordAuthenticationToken(playerSession, null, playerSession.getAuthorities());
SecurityContextHolder.getContext().setAuthentication(auth);
}
如何使用类似的方法实现注销?
【问题讨论】:
标签: java spring junit spring-security