Spring Security 3 programmatically login

前端 未结 3 2297
闹比i
闹比i 2021-02-06 19:13

I\'m creating a REST web service using spring and I need to implement login/logout functions in it. The url for the functions should be something like .../api/login and .../api/

3条回答
  •  迷失自我
    2021-02-06 19:54

    If you're after the basic authentication manager, the following code will get it in your app without extra xml config:

    @SuppressWarnings({"SpringJavaAutowiringInspection"})
    @Resource(name = "org.springframework.security.authenticationManager")
    private AuthenticationManager authenticationManager;
    

提交回复
热议问题