有没有人在 springboot 应用程序中有这样的工作示例?
- /auth Controller ,用户在其中提供 ActiveDirectory 凭据(通过基本身份验证或 POST json)并在提供有效 AD 凭据时接收 JWT token 。不应涉及 LDIF 文件,Springboot 应用程序将根据 ldaps://ActiveDirectoryhost:636 端点验证凭据
- /myapi Controller ,仅当来自步骤 1(上文)的有效 JWT token 在“授权承载”标题中发送时才有效
我没有找到任何关于此设置的示例博客/指南,但我相信这将是一个常见的安全设置,除非我弄错了? 不应涉及 jpa/hibernate/persistence/mysql/postgres/H2db 连接 我在网上找到的所有示例要么只是 JWT,要么只是 LDAP,要么使用 LDIF,要么使用一些 H2/postgres 来存储凭据。
最佳答案
这有效:
JWT 来自 https://github.com/merugu/springsecurity/tree/master/ldapauthenticationjwttoken
广告来自 https://medium.com/@dmarko484/spring-boot-active-directory-authentication-5ea04969f220
必须将 github jwt repo 升级到 springboot 2.0.5 并将 setSearchFilter {1} ( https://docs.spring.io/spring-security/site/docs/current/api/org/springframework/security/ldap/authentication/ad/ActiveDirectoryLdapAuthenticationProvider.html ) 添加到 AD
第二个选项也适用于 Springboot 1.5: Spring security switch to Ldap authentication and database authorities ( https://stackoverflow.com/a/34658755 ) 在 https://github.com/cnapagoda/spring-boot-basic-auth 之上
关于java - spring boot - 基本的 Active Directory 身份验证然后是 JWT token ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53019106/