use of com.tremolosecurity.saml.Attribute in project OpenUnison by TremoloSecurity.
the class JITBasicDBCreateGroups method init.
@Override
public void init(WorkflowTask task, Map<String, Attribute> params) throws ProvisioningException {
this.task = task;
Attribute attr = params.get("targetName");
if (attr == null) {
throw new ProvisioningException("targetName not set");
}
this.targetName = attr.getValues().get(0);
this.loadGroupData();
}
use of com.tremolosecurity.saml.Attribute in project OpenUnison by TremoloSecurity.
the class LoadAttributes method doTask.
@Override
public boolean doTask(User user, Map<String, Object> request) throws ProvisioningException {
StringBuffer filter = new StringBuffer();
ArrayList<String> params = new ArrayList<String>();
params.addAll(this.attrs);
try {
if (this.base == null) {
this.base = this.cfg.getCfg().getLdapRoot();
}
LDAPSearchResults res = this.cfg.getMyVD().search(this.base, 2, equal(this.nameAttr, user.getUserID()).toString(), params);
if (res.hasMore()) {
LDAPEntry entry = res.next();
LDAPAttributeSet attrs = entry.getAttributeSet();
for (Object obj : attrs) {
LDAPAttribute attr = (LDAPAttribute) obj;
Attribute userAttr = new Attribute(attr.getName());
for (String val : attr.getStringValueArray()) {
userAttr.getValues().add(val);
}
user.getAttribs().put(attr.getName(), userAttr);
}
}
} catch (LDAPException e) {
throw new ProvisioningException("Could not load user : " + user.getUserID(), e);
}
return true;
}
use of com.tremolosecurity.saml.Attribute in project OpenUnison by TremoloSecurity.
the class LoadAuditDBAttributes method init.
@Override
public void init(WorkflowTask task, Map<String, Attribute> params) throws ProvisioningException {
this.attrs = new HashSet<String>();
Attribute cfgAttrs = params.get("name");
for (String name : cfgAttrs.getValues()) {
attrs.add(name);
}
this.nameAttr = params.get("nameAttr").getValues().get(0);
this.cfg = task.getConfigManager();
this.task = task;
}
use of com.tremolosecurity.saml.Attribute in project OpenUnison by TremoloSecurity.
the class MapJitGroups method doTask.
@Override
public boolean doTask(User user, Map<String, Object> request) throws ProvisioningException {
Attribute groupAttr = user.getAttribs().get(this.attributeName);
Set<String> groupDNs = new HashSet<String>();
if (groupAttr != null) {
for (String dnFromAttr : groupAttr.getValues()) {
groupDNs.add(new DN(dnFromAttr).toString().toLowerCase());
}
}
for (DN groupDN : groupMap.keySet()) {
if (groupDNs.contains(groupDN.toString().toLowerCase())) {
user.getGroups().addAll(groupMap.get(groupDN));
} else {
user.getGroups().removeAll(groupMap.get(groupDN));
}
}
return true;
}
use of com.tremolosecurity.saml.Attribute in project OpenUnison by TremoloSecurity.
the class WorkflowImpl method executeWorkflow.
/* (non-Javadoc)
* @see com.tremolosecurity.provisioning.core.Workflow#executeWorkflow(com.tremolosecurity.provisioning.service.util.WFCall)
*/
@Override
public Map<String, Object> executeWorkflow(WFCall call) throws ProvisioningException {
TremoloUser userFromCall = call.getUser();
String uidAttr = call.getUidAttributeName();
HashMap<String, Attribute> attrs = new HashMap<String, Attribute>();
for (Attribute attr : userFromCall.getAttributes()) {
attrs.put(attr.getName(), attr);
}
Attribute uid = attrs.get(uidAttr);
if (uid == null) {
throw new ProvisioningException("No uid attribute " + uidAttr);
}
User user = new User(uid.getValues().get(0));
user.getGroups().addAll(userFromCall.getGroups());
user.getAttribs().putAll(attrs);
if (userFromCall.getUserPassword() != null) {
user.setPassword(userFromCall.getUserPassword());
}
if (call.getReason() != null) {
user.setRequestReason(call.getReason());
}
return this.executeWorkflow(user, call.getRequestParams(), call.getRequestor());
}
Aggregations