【问题标题】:Spring boot - authenticate list of active directory users present in configSpring boot - 验证配置中存在的活动目录用户列表
【发布时间】:2017-11-22 18:47:35
【问题描述】:

它是一个简单的 Spring MVC 应用程序,只有一个控制器。我只需要 2-3 人就可以访问这个控制器。用户的活动目录名称将存储在 config.xml 中。我们认为不需要 ldap 身份验证。有什么建议吗?

【问题讨论】:

    标签: java authentication spring-security


    【解决方案1】:

    您可以将用户服务配置为

    <authentication-manager>
        <authentication-provider>
            <user-service properties="classpath:users.properties</userservice>
        </authentication-provider>
    </authentication-manager>
    

    这将是一个内存提供程序,它不提供在更改时重新加载属性文件并期望重新启动服务器的选项。 要限制会话,您可以使用:

    <session-management>
        <concurrency-control max-sessions="1" expired-url="/your-page-here" />
    </session-management>
    

    为了限制您创建的用户,属性文件中的用户数为

    username=password,grantedAuthority[,grantedAuthority][,enabled|disabled]
    

    例如:

    Jay=123Welcome,ROLE_USER,ROLE_ADMIN,enabled
    Mike=SuperUser@123,ROLE_USER,enabled
    

    【讨论】:

      猜你喜欢
      • 2015-06-20
      • 2014-08-18
      • 2021-02-23
      • 1970-01-01
      • 2018-01-29
      • 2021-05-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多