X-Git-Url: http://git.argeo.org/?a=blobdiff_plain;f=security%2Fruntime%2Forg.argeo.security.core%2Fsrc%2Fmain%2Fjava%2Forg%2Fargeo%2Fsecurity%2Fcore%2FDefaultArgeoSecurity.java;h=47497d182c45a5bccba576a4585ddc621b7df188;hb=10c220cf49f5b146bac50ed7fe2578135cd466f1;hp=494828343f8d5e9649c9ce67aad7867b8fe832d2;hpb=79d37fb873ba8ebaafe64c924f53bc9c76ea6d8c;p=lgpl%2Fargeo-commons.git diff --git a/security/runtime/org.argeo.security.core/src/main/java/org/argeo/security/core/DefaultArgeoSecurity.java b/security/runtime/org.argeo.security.core/src/main/java/org/argeo/security/core/DefaultArgeoSecurity.java index 494828343..47497d182 100644 --- a/security/runtime/org.argeo.security.core/src/main/java/org/argeo/security/core/DefaultArgeoSecurity.java +++ b/security/runtime/org.argeo.security.core/src/main/java/org/argeo/security/core/DefaultArgeoSecurity.java @@ -20,13 +20,25 @@ import org.argeo.security.ArgeoUser; import org.argeo.security.ArgeoSecurity; import org.argeo.security.nature.SimpleUserNature; +/** Holds deployment specific security information. */ public class DefaultArgeoSecurity implements ArgeoSecurity { private String superUsername = "root"; public void beforeCreate(ArgeoUser user) { - SimpleUserNature simpleUserNature = new SimpleUserNature(); - simpleUserNature.setLastName("empty");// to prevent issue with sn in LDAP - user.getUserNatures().put("simple",simpleUserNature); + SimpleUserNature simpleUserNature; + try { + simpleUserNature = SimpleUserNature + .findSimpleUserNature(user, null); + } catch (Exception e) { + simpleUserNature = new SimpleUserNature(); + user.getUserNatures().put("simpleUserNature", simpleUserNature); + } + + if (simpleUserNature.getLastName() == null + || simpleUserNature.getLastName().equals("")) + simpleUserNature.setLastName("empty");// to prevent issue with sn in + // LDAP + } public String getSuperUsername() {