Hi everybody,
We're currently migrating to 4.5 (laugh)...
Our application has its own login mechanism, using a quite standard JEE login
servlet configured in our web.xml and connected to our corporate LDAP
infrastruture.
I'm losing my last hair since a couple of hours trying to understand how the
whole thing is implemented within 4.5. I didn't find any documentation, or
maybe I failed to understand where I can find it.
With 4.4 we had a custom jaas.config pointing to a custom
ContainerAuthenticationModule, in which we used to create the Entity and set
the roles and groups:
[code]
@Override
public void setEntity() {
EntityImpl entity = new EntityImpl();
entity.addProperty(Entity.NAME, getRequest().getUserPrincipal().getName());
this.subject.getPrincipals().add(entity);
HttpServletRequest request = getRequest();
Collection<Group> groups = groupManager.getAllGroups();
for (Group group : groups) {
if (request.isUserInRole(group.getName())) {
processGroup(group);
}
}
}
private void processGroup(Group group) {
addGroupName(group.getName());
for (String roleName : group.getRoles()) {
addRoleName(roleName);
}
for (String subGroupName : group.getGroups()) {
Group subGroup;
try {
subGroup = groupManager.getGroup(subGroupName);
processGroup(subGroup);
}
catch (Exception e) {
throw new IllegalStateException(e);
}
}
}
[/code]
Now with 4.5, the EntityImpl class is marked as deprecated (without any comment
about what I should do to avoid to use it), so that I can suppose the concept
behind the whole thing is totally different. But what should I do ?
I've decided to use EntityImpl further on as a first step. To be conform with
the new API I then use my own ExternalUserManager in order to create my
ExternalUser:
[code]
Map<String, String> properties = new HashMap<String, String>();
properties.put("name", getRequest().getUserPrincipal().getName());
properties.put("language", "de"); // TODO
User user = new MyOwnUserManager().getUser(properties, groupList, roleList);
this.subject.getPrincipals().add(usr);
[/code]
MyOwnUserManager:
[code]
@Override
public User getUser(Map<String, String> properties, GroupList groupList,
RoleList roleList)
throws UnsupportedOperationException {
return new MyExternalUser(properties, groupList, roleList);
}
[/code]
As you cann see I fill the properties with the user name and its language.
Everything fine so far, but now when I try to make it run I get a
NullPointerException in the class DefaultRepositoryStrategy at the following
line of code:
return new SimpleCredentials(user.getName(), user.getPassword().toCharArray());
It seems that the user name is known (the one I set before in my
ContainerAuthenticationModule), but the password is empty. And of course I
don't know the user's password and am unable to set it !
I think I'm following a totally wrong way and I'm about to find myself a job in
an other industry (wine, music ?)
Or could maybe somebody help me ? Are there already user experiences with
ExternalUsers and Magnolia 4.5 ?
Thanks a lot and cheers.
Fabrice
--
Context is everything:
http://forum.magnolia-cms.com/forum/thread.html?threadId=7f03895a-d94f-445a-a734-c0ab920d85d0
----------------------------------------------------------------
For list details, see http://www.magnolia-cms.com/community/mailing-lists.html
Alternatively, use our forums: http://forum.magnolia-cms.com/
To unsubscribe, E-mail to: <[email protected]>
----------------------------------------------------------------