上次更新日期:
2021年4月29日
Issue
In AEM6.2, when LDAP users log in and go to /welcome.html, the Classic UI Welcome screen shows their full LDAP DN next to the "sign-out" link on the upper right of the screen.
Cause
This is an issue with Classic UI in AEM6.2.
Resolution
To fix this problem, you can modify the product code by adding an overlay of welcome.jsp.
- Go to http://host:port/crx/de/index.jsp and log in as admin.
- Browse to /apps and create the folder structure /apps/cq/core/components.
- Click Save All.
- Browse to /libs/cq/core/components.
- Right click the welcome subnode and select Copy.
- Browse back to /apps/cq/core/components.
- Right click the components node and select Paste.
- Open the file /apps/cq/core/components/welcome/welcome.jsp for editing.
- Add this code [1] after these lines [2].
- Click Save All.
When users log in, they see their full names displayed.
[1]
org.apache.jackrabbit.api.security.user.UserManager userManager = resourceResolver.adaptTo(org.apache.jackrabbit.api.security.user.UserManager.class); org.apache.jackrabbit.api.security.user.Authorizable authorizable = userManager.getAuthorizable(auth.getPrincipal()); if (authorizable.hasProperty("profile/familyName")) { name = authorizable.getProperty("profile/familyName")[0].getString(); } if (authorizable.hasProperty("profile/givenName")) { name = authorizable.getProperty("profile/givenName")[0].getString() + ((name.length() > 0)?" " + name:""); }
[2]
String name = auth == null ? null : auth.getPrincipal().getName(); if (name == null) { // workaround if user manager service is not ready yet. name = session.getUserID(); }
下载