我想要替换如下的java字符串值.下面的代码不起作用.
cleanInst.replaceAll("[<i>]", "");
cleanInst.replaceAll("[</i>]", "");
cleanInst.replaceAll("[//]", "/");
cleanInst.replaceAll("[\bPhysics Dept.\b]", "Physics Department");
cleanInst.replaceAll("[\b/n\b]", ";");
cleanInst.replaceAll("[\bDEPT\b]", "The Department");
cleanInst.replaceAll("[\bDEPT.\b]", "The Department");
cleanInst.replaceAll("[\bThe Dept.\b]", "The Department");
cleanInst.replaceAll("[\bthe dept.\b]", "The Department");
cleanInst.replaceAll("[\bThe Dept\b]", "The Department");
cleanInst.replaceAll("[\bthe dept\b]", "The Department");
cleanInst.replaceAll("[\bDept.\b]", "The Department");
cleanInst.replaceAll("[\bdept.\b]", "The Department");
cleanInst.replaceAll("[\bdept\b]", "The Department");
Run Code Online (Sandbox Code Playgroud)
实现上述替换的最简单方法是什么?
我已将Spring Security配置为针对LDAP服务器进行身份验证.
<security:authentication-manager >
<security:ldap-authentication-provider user-dn-pattern="uid={0}" />
</security:authentication-manager>
Run Code Online (Sandbox Code Playgroud)
身份验证后,我想从本地数据库为同一用户加载角色.如何使用"ldap-authentication-provider"加载本地数据库角色?
如果我添加第二个身份验证提供程序如下:
<security:authentication-manager >
<security:ldap-authentication-provider user-dn-pattern="uid={0}" />
<security:authentication-provider ref="daoAuthenticationProvider" />
</security:authentication-manager>
Run Code Online (Sandbox Code Playgroud)
daoAuthenticationProvider添加了,但是当第一个auth提供程序对用户进行身份验证时,Spring不使用第二个提供程序.只有当第一个auth提供程序无法对其进行身份验证时,才会在列表中接下来.
所以基本上看起来我们必须定制
<security:ldap-authentication-provider user-dn-pattern="uid={0}" />
Run Code Online (Sandbox Code Playgroud)
从本地数据库加载ROLE.
有什么建议?该如何实施?