【问题标题】:Azure AD Authentication with spring boot使用 Spring Boot 进行 Azure AD 身份验证
【发布时间】:2020-06-04 11:17:07
【问题描述】:

我有一个应用程序,它同时具有角度 Web 部件和弹簧支架后端。我想与 Azure AD 集成,并在 angular 中使用 microsoft-adal-angular6,在 spring 部分使用 AADAuthenticationFilter。我需要首先使用 Azure AD 进行身份验证,然后需要检查该用户是否存在于我的应用程序连接到的本地数据库中。是否有进行此两级身份验证的最佳实践?或者更确切地说,我怎样才能做到这一点?请任何人帮助.....

【问题讨论】:

    标签: spring-boot authentication azure-active-directory


    【解决方案1】:

    你可以看看:

    <dependency>
        <groupId>org.springframework.security</groupId>
        <artifactId>spring-security-ldap</artifactId>
    </dependency>
    

    在您的安全配置中,您可以配置它,无需从头开始编写,您可以从:https://www.baeldung.com/spring-security-ldap

    【讨论】:

    • 在我的应用程序中,我使用了以下依赖项com.microsoft.azureazure-active-directory-spring-boot-starterorg.springframework.securityspring-security-oauth2-clientorg.springframework.security groupId> spring-security-oauth2-jose
    • 因此,如果您与 AD 建立了连接,那么您只需在 securityConfig 中链接调用
    • 借助 angular 中的 microsoft-adal-angular6 模块,我可以对 Azure AD 进行身份验证并获得 IDToken。有了这个 IDToken,我调用了其余的 api。我的数据库中有一些用户特定的数据。因此,对于每次登录,我还需要使用本地数据库进行身份验证。但它应该只执行一次(出于安全原因检查本地数据库)。对于我的其余 api 调用,它应该绕过数据库检查。
    猜你喜欢
    • 2018-11-17
    • 1970-01-01
    • 2021-05-25
    • 2019-04-22
    • 2020-03-27
    • 2019-06-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多