• Tomcat集成LDAP实现容器管理安全性


    LDAP Server

    openldap

    OpenLDAP安装与配置,参考 : https://www.ilanni.com/?p=13775

     

    tomcat

    修改tomcat/conf/server.xml,添加以下内容

    1             <Realm className="org.apache.catalina.realm.JNDIRealm"
    2                 connectionURL="ldap://127.0.0.1:389" roleBase="ou=Group,dc=ilanni,dc=com"
    3                 roleName="cn" roleSearch="(memberUid={0})" 
    4                 userPattern="uid={0},ou=People,dc=ilanni,dc=com"  
    5                   />

    web.xml

    <?xml version="1.0" encoding="UTF-8"?>
    <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns="http://java.sun.com/xml/ns/javaee"
        xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
        version="2.5">
        <display-name>test01</display-name>
        <welcome-file-list>
            <welcome-file>index.html</welcome-file>
            <welcome-file>index.jsp</welcome-file>
        </welcome-file-list>
    
    
        <security-constraint>
            <web-resource-collection>
                <web-resource-name>admin</web-resource-name>
                <url-pattern>/*</url-pattern>
            </web-resource-collection>
            <auth-constraint>
                <role-name>ldapgroup1</role-name>
                <role-name>ldapgroup2</role-name>
            </auth-constraint>
        </security-constraint>
    
    
        <security-role>
            <role-name>administrator</role-name>
        </security-role>
        <security-role>
            <role-name>ldapgroup1</role-name>
        </security-role>
        <security-role>
            <role-name>ldapgroup2</role-name>
        </security-role>
        <login-config>
            <auth-method>FORM</auth-method>
            <form-login-config>
                <form-login-page>/admin/login.jsp</form-login-page>
                <form-error-page>/admin/login-error.jsp</form-error-page>
            </form-login-config>
        </login-config>
    </web-app>
    View Code

  • 相关阅读:
    React 高阶组件
    Facebook Graph API 接口请求
    (转载)HTML:模拟链接被按下,在新标签页打开页面,不使用window.open(可能被拦截)
    php file_put_contents() 写入回车
    mysql 慢查询开启
    FB接口之 js调用支付窗口
    8 个必备的PHP功能开发
    linux 负载 待读
    大话团队管理。
    API编排
  • 原文地址:https://www.cnblogs.com/imperfectLiu/p/9507166.html
Copyright © 2020-2023  润新知