Commit 0854efab authored by michael.simon's avatar michael.simon
Browse files

Change initial user registration to show more data

parent efa3686a
......@@ -77,7 +77,7 @@ public class AttributeMapHelper implements Serializable {
}
if (sb.length() > 0) {
sb.setLength(sb.length() - 1);
sb.setLength(sb.length() - separator.length());
}
return sb.toString();
......
......@@ -12,6 +12,11 @@ package edu.kit.scc.webreg.bean;
import java.io.IOException;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;
......@@ -30,6 +35,7 @@ import edu.kit.scc.webreg.service.SamlIdpMetadataService;
import edu.kit.scc.webreg.service.SamlSpConfigurationService;
import edu.kit.scc.webreg.service.UserCreateService;
import edu.kit.scc.webreg.service.UserService;
import edu.kit.scc.webreg.service.impl.AttributeMapHelper;
import edu.kit.scc.webreg.session.SessionManager;
import edu.kit.scc.webreg.util.FacesMessageGenerator;
......@@ -56,6 +62,9 @@ public class RegisterUserBean implements Serializable {
@Inject
private SamlSpConfigurationService spService;
@Inject
private AttributeMapHelper attrHelper;
@Inject
private FacesMessageGenerator messageGenerator;
......@@ -66,6 +75,10 @@ public class RegisterUserBean implements Serializable {
private Boolean errorState = false;
private Map<String, String> printableAttributesMap;
private Map<String, String> unprintableAttributesMap;
private List<String> printableAttributesList;
public void preRenderView(ComponentSystemEvent ev) {
idpEntity = idpService.findById(sessionManager.getIdpId());
spConfigEntity = spService.findById(sessionManager.getSpId());
......@@ -85,6 +98,67 @@ public class RegisterUserBean implements Serializable {
messageGenerator.addResolvedErrorMessage("eppn-blocked", "eppn-blocked-detail", true);
}
printableAttributesMap = new HashMap<String, String>();
unprintableAttributesMap = new HashMap<String, String>();
printableAttributesList = new ArrayList<String>();
for (Entry<String, List<Object>> entry : sessionManager.getAttributeMap().entrySet()) {
if (entry.getKey().equals("urn:oid:0.9.2342.19200300.100.1.3")){
printableAttributesList.add("email");
printableAttributesMap.put("email", attrHelper.attributeListToString(entry.getValue(), ","));
}
else if (entry.getKey().equals("urn:oid:1.3.6.1.4.1.5923.1.1.1.6")){
printableAttributesList.add("eppn");
printableAttributesMap.put("eppn", attrHelper.getSingleStringFirst(entry.getValue()));
}
else if (entry.getKey().equals("urn:oid:2.5.4.42")){
printableAttributesList.add("given_name");
printableAttributesMap.put("given_name", attrHelper.getSingleStringFirst(entry.getValue()));
}
else if (entry.getKey().equals("urn:oid:2.5.4.4")){
printableAttributesList.add("sur_name");
printableAttributesMap.put("sur_name", attrHelper.getSingleStringFirst(entry.getValue()));
}
else if (entry.getKey().equals("urn:oid:1.3.6.1.1.1.1.1")){
printableAttributesList.add("gid_number");
printableAttributesMap.put("gid_number", attrHelper.getSingleStringFirst(entry.getValue()));
}
else if (entry.getKey().equals("http://bwidm.de/bwidmCC")){
printableAttributesList.add("primary_group");
printableAttributesMap.put("primary_group", attrHelper.getSingleStringFirst(entry.getValue()));
}
else if (entry.getKey().equals("http://bwidm.de/bwidmOrgId")){
printableAttributesList.add("bwidm_org_id");
printableAttributesMap.put("bwidm_org_id", attrHelper.getSingleStringFirst(entry.getValue()));
}
else if (entry.getKey().equals("memberOf")){
printableAttributesList.add("groups");
printableAttributesMap.put("groups", attrHelper.attributeListToString(entry.getValue(), ", "));
}
else if (entry.getKey().equals("http://bwidm.de/bwidmMemberOf")){
printableAttributesList.add("groups");
printableAttributesMap.put("groups", attrHelper.attributeListToString(entry.getValue(), ", "));
}
else if (entry.getKey().equals("urn:oid:1.3.6.1.4.1.5923.1.1.1.7")){
printableAttributesList.add("entitlement");
printableAttributesMap.put("entitlement", attrHelper.attributeListToString(entry.getValue(), ", "));
}
else if (entry.getKey().equals("urn:oid:0.9.2342.19200300.100.1.1")){
printableAttributesList.add("uid");
printableAttributesMap.put("uid", attrHelper.getSingleStringFirst(entry.getValue()));
}
else if (entry.getKey().equals("urn:oid:1.3.6.1.1.1.1.0")){
printableAttributesList.add("uid_number");
printableAttributesMap.put("uid_number", attrHelper.getSingleStringFirst(entry.getValue()));
}
else if (entry.getKey().equals("urn:oid:1.3.6.1.4.1.5923.1.1.1.9")){
printableAttributesList.add("affiliation");
printableAttributesMap.put("affiliation", attrHelper.attributeListToString(entry.getValue(), ", "));
}
else {
unprintableAttributesMap.put(entry.getKey(), attrHelper.attributeListToString(entry.getValue(), ", "));
}
}
}
public String save() {
......@@ -132,5 +206,17 @@ public class RegisterUserBean implements Serializable {
this.errorState = errorState;
}
public Map<String, String> getPrintableAttributesMap() {
return printableAttributesMap;
}
public Map<String, String> getUnprintableAttributesMap() {
return unprintableAttributesMap;
}
public List<String> getPrintableAttributesList() {
return printableAttributesList;
}
}
......@@ -4,7 +4,7 @@ secondary_groups=Sekund\u00E4re Gruppen
saml_values=SAML Werte
full_reconsiliation=Volle Reconsiliation
deregister_desc_long=Wenn Sie diesen Dialog best\u00E4tigen, k\u00F6nnen Sie nicht mehr auf den Dienst zugreifen.
welcome_head=bwDienste am KIT - Registrierung
welcome_head=F\u00F6derierte Dienste am KIT - Registrierung
more_properties=Weitere Eigenschaften
no_approval=Keine Approval Prozess
......@@ -359,4 +359,7 @@ set_new_password=Neues Passwort setzen
hash_password=Passwort hashen
delete_group=Gruppe l\u00F6schen
remove_all_members=Alle Mitglieder entfernen
uid=Lokale User ID
bwidm_org_id=Organisationsk\u00FCrzel
affiliation=Zugeh\u00F6rigkeit
......@@ -4,7 +4,7 @@ secondary_groups=Secondary Groups
saml_values=SAML Values
full_reconsiliation=Full Reconsiliation
deregister_desc_long=If you confirm this dialog, you will no longer be able to use this service.
welcome_head=bwServices at KIT - Registration Server
welcome_head=Federated Services at KIT - Registration
more_properties=More Properties
no_approval=No approval process
......@@ -359,4 +359,7 @@ set_new_password=Set new Password
hash_password=Hash password
delete_group=Delete group
remove_all_members=Remove all members
uid=Local user ID
bwidm_org_id=Org short name
affiliation=Affiliation
......@@ -31,15 +31,17 @@
<div class="panel">
<h3><h:outputText value="#{messages.my_data}:"/></h3>
<p:panelGrid id="baseData" columns="2">
<bw:outputText label="#{messages.eppn}" value="#{registerUserBean.entity.eppn}" />
<bw:outputText label="#{messages.email}" value="#{registerUserBean.entity.email}" />
<bw:outputText label="#{messages.sur_name}" value="#{registerUserBean.entity.surName}" />
<bw:outputText label="#{messages.given_name}" value="#{registerUserBean.entity.givenName}" />
<bw:outputText label="#{messages.persistent_id}" value="#{registerUserBean.entity.persistentId}" />
<bw:outputText label="#{messages.issued_by}" value="#{registerUserBean.entity.persistentIdpId}" />
<bw:outputText label="#{messages.issued_for}" value="#{registerUserBean.entity.persistentSpId}" />
</p:panelGrid>
<p:dataTable var="key" value="#{registerUserBean.printableAttributesList}">
<p:column headerText="#{messages.name}">
#{resourceBundleHelper.resolveMessage(key)}
</p:column>
<p:column headerText="#{messages.value}">
#{registerUserBean.printableAttributesMap[key]}
</p:column>
</p:dataTable>
<p:dataList var="key" value="#{registerUserBean.unprintableAttributesMap.keySet().toArray()}">
#{key}: #{registerUserBean.unprintableAttributesMap[key]}
</p:dataList>
<p:commandButton id="save" action="#{registerUserBean.save}" value="#{messages.confirm}" ajax="false"
disabled="#{registerUserBean.errorState}"/>
</div>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment