Hi,
Im working in a proof of concept in order to display some user information based on a group. Follow my jsp snippet.
<%@ page import="java.util.ArrayList,
java.util.Iterator,
java.util.List,
org.apache.jackrabbit.api.security.user.*,
org.apache.jackrabbit.api.*,
org.apache.jackrabbit.core.security.authentication.CryptedSimpleCredentials,
javax.jcr.Credentials" %>
<%
final List<String> members = new ArrayList<String>();
final UserManager userManager = resource.adaptTo(UserManager.class);
final Authorizable auth2 = userManager.getAuthorizable("content-authors");
if (auth2 == null) {
//SOMETHING HERE
} else if (auth2.isGroup()) {
Group group = (Group) auth2;
Iterator<Authorizable> iter = group.getMembers();
while (iter.hasNext()) {
Authorizable auth = iter.next();
if (!auth.isGroup()) {
User user = (User) auth;
Credentials cred = user.getCredentials();
if (cred instanceof CryptedSimpleCredentials) {
//DO THINGS HERE
}
}
}
}
%>
This is the exception i got. Any clues what is the problem?
12.03.2014 17:47:28.336 *ERROR* [127.0.0.1 [1394606848286] GET /content/demo/en/homepage.html HTTP/1.1] com.day.cq.wcm.core.impl.WCMDebugFilter Error during include of SlingRequestPathInfo: path='/content/demo/en/homepage/jcr:content/title', selectorString='null', extension='html', suffix='null' org.apache.sling.api.scripting.ScriptEvaluationException: org.apache.sling.scripting.jsp.jasper.JasperException: Unable to compile class for JSP:
An error occurred at line: 26 in the jsp file: /apps/demo/components/users/users.jsp
CryptedSimpleCredentials cannot be resolved to a type
23: if (!auth.isGroup()) {
24: User user = (User) auth;
25: Credentials cred = user.getCredentials();
26: if (cred instanceof CryptedSimpleCredentials) {
27: //DO SOMETHING HERE
28: }
29: }
at org.apache.sling.scripting.core.impl.DefaultSlingScript.call(DefaultSlingScript.java:388)
at org.apache.sling.scripting.core.impl.DefaultSlingScript.eval(DefaultSlingScript.java:171)