我使用 Spring Security 编写了功能SwitchUserFilter。在应用程序中,我可以使用 URL 切换用户/j_spring_security_switch_user?j_username=xxx并返回到之前使用/j_spring_security_exit_user. 我还实现了几种取决于切换用户事实的方法,所以我想为它们编写单元测试。因此我的问题是如何在 jUnit 测试环境中切换用户?
SwitchUserFilter
/j_spring_security_switch_user?j_username=xxx
/j_spring_security_exit_user
java junit spring spring-security
java ×1
junit ×1
spring ×1
spring-security ×1