Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

修改登录方式为数据库+ldap之后,执行job发送邮件phantom一直需要登录 #701

Open
BruceMiao305 opened this issue Mar 24, 2020 · 0 comments

Comments

@BruceMiao305
Copy link

Please follow the below instructions to create a new system bug, otherwise, we can't help you effectively.(请严格遵循下列格式创建系统Bug主题,否则我们可能很难有效帮助到你)

  • What steps will reproduce the problem?(该问题的重现步骤是什么?)
    我认证实现代码:
    public Authentication authenticate(Authentication authentication) throws AuthenticationException {
    String username = authentication.getName();
    String password = (String) authentication.getCredentials();
    UserDetails userDetails = userDetailsService.loadUserByUsername(username);
    /**
    * 通过Ldap方式进行验证
    */
    if(userDetails == null){
    throw new BadCredentialsException("用户名未找到");
    }
    if(userDetails.getUsername().equals("admin")){
    if (authentication instanceof ShareAuthenticationToken) {
    return authentication;
    } else {
    return authenticationProvider.authenticate(authentication);
    }
    }
    else {
    if (!ldapService.validUser(username, password)) {
    throw new BadCredentialsException("Ldap密码不正确");
    }
    Collection<? extends GrantedAuthority> authorities = userDetails.getAuthorities();
    return new UsernamePasswordAuthenticationToken(userDetails, password, authorities);
    }
    执行邮件任务,需要登录
    [INFO][11:33:26][PersistService.lambda$persist$0():69] elapsedTime:2001, [120000]
    [INFO][11:33:28][PersistService.lambda$persist$0():69] elapsedTime:4001, [120000]
    [INFO][11:33:30][PersistService.lambda$persist$0():69] elapsedTime:6001, [120000]

  • What is the expected output? What do you see instead?(你期待的结果是什么?实际看到的又是什么?)

  • What version of the product are you using? On what operating system?(你正在使用产品的哪个版本?在什么操作系统上?)
    windows开发环境,0.4.2

  • Please provide any additional information below.(如果有的话,请在下面提供更多信息。)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant