繁体   English   中英

使用@service类中的LDAP服务器(已配置)对用户进行身份验证

[英]Authenticate User using LDAP server (configured) from @service class

我正在使用spring boot rest URL“ / login”进行用户登录,并使用用户凭据从前端访问此URL。 我的spring boot服务与LDAP服务器配置在一起,并且在显示任何结果之前正在对所有所需的请求进行身份验证。 但是现在,我希望它在不显示其他登录页面的情况下对用户进行身份验证,因为当我从前端本身发送用户凭据时。

LDAP配置:

@Override
    protected void configure(HttpSecurity http) throws Exception {
        http
            .authorizeRequests()
                .anyRequest().fullyAuthenticated()
                .and()
            .formLogin();
    }

控制器:

    @RequestMapping(value = "/login", method = RequestMethod.POST)

    public ResponseEntity<?> authenticateUser(@Valid @ModelAttribute LoginRequest loginRequest, BindingResult result){
        ResponseEntity<?> errorMap = mapValidationErrorService.getMapValidationErrors(result);
        if(errorMap != null) return errorMap;
        String jwt = null;

在LoginRequest pojo内部,我提供了我的用户凭据。 我需要做的就是直接从ldap服务器验证这些详细信息,而无需任何进一步的重定向。

请提供建议/帮助。 提前致谢!

尝试这个

@Override
    protected void configure(HttpSecurity http) throws Exception {
        http
            .authorizeRequests().
                .antMatchers("/login").permitAll()
                .anyRequest().fullyAuthenticated();
    }

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM