Commit 4f029a2b authored by michael.simon's avatar michael.simon
Browse files

add more options to connect account bean

parent 3e7cb66b
...@@ -21,12 +21,14 @@ import javax.faces.context.FacesContext; ...@@ -21,12 +21,14 @@ import javax.faces.context.FacesContext;
import javax.faces.event.ComponentSystemEvent; import javax.faces.event.ComponentSystemEvent;
import javax.inject.Inject; import javax.inject.Inject;
import edu.kit.scc.webreg.entity.SamlIdpMetadataEntity;
import edu.kit.scc.webreg.entity.UserEntity; import edu.kit.scc.webreg.entity.UserEntity;
import edu.kit.scc.webreg.entity.identity.IdentityEntity; import edu.kit.scc.webreg.entity.identity.IdentityEntity;
import edu.kit.scc.webreg.entity.oidc.OidcRpConfigurationEntity; import edu.kit.scc.webreg.entity.oidc.OidcRpConfigurationEntity;
import edu.kit.scc.webreg.service.UserService; import edu.kit.scc.webreg.service.UserService;
import edu.kit.scc.webreg.service.identity.IdentityService; import edu.kit.scc.webreg.service.identity.IdentityService;
import edu.kit.scc.webreg.service.oidc.OidcRpConfigurationService; import edu.kit.scc.webreg.service.oidc.OidcRpConfigurationService;
import edu.kit.scc.webreg.service.saml.FederationSingletonBean;
import edu.kit.scc.webreg.session.SessionManager; import edu.kit.scc.webreg.session.SessionManager;
import edu.kit.scc.webreg.util.FacesMessageGenerator; import edu.kit.scc.webreg.util.FacesMessageGenerator;
...@@ -48,6 +50,9 @@ public class ConnectAccountBean implements Serializable { ...@@ -48,6 +50,9 @@ public class ConnectAccountBean implements Serializable {
@Inject @Inject
private OidcRpConfigurationService oidcRpService; private OidcRpConfigurationService oidcRpService;
@Inject
private FederationSingletonBean federationBean;
@Inject @Inject
private FacesMessageGenerator messageGenerator; private FacesMessageGenerator messageGenerator;
...@@ -56,6 +61,9 @@ public class ConnectAccountBean implements Serializable { ...@@ -56,6 +61,9 @@ public class ConnectAccountBean implements Serializable {
private List<OidcRpConfigurationEntity> oidcRpList; private List<OidcRpConfigurationEntity> oidcRpList;
private OidcRpConfigurationEntity selectedOidcRp; private OidcRpConfigurationEntity selectedOidcRp;
private List<SamlIdpMetadataEntity> idpList;
private SamlIdpMetadataEntity selectedIdp;
private String pin; private String pin;
...@@ -63,10 +71,12 @@ public class ConnectAccountBean implements Serializable { ...@@ -63,10 +71,12 @@ public class ConnectAccountBean implements Serializable {
if (identity == null) { if (identity == null) {
identity = identityService.findById(sessionManager.getIdentityId()); identity = identityService.findById(sessionManager.getIdentityId());
userList = userService.findByIdentity(identity); userList = userService.findByIdentity(identity);
idpList = federationBean.getAllIdpList();
} }
} }
public void startConnect() { public void startConnectOidc() {
ExternalContext externalContext = FacesContext.getCurrentInstance().getExternalContext(); ExternalContext externalContext = FacesContext.getCurrentInstance().getExternalContext();
if (selectedOidcRp != null && pin != null && pin.matches("^[a-zA-Z0-9]{4,32}$")) { if (selectedOidcRp != null && pin != null && pin.matches("^[a-zA-Z0-9]{4,32}$")) {
...@@ -86,6 +96,12 @@ public class ConnectAccountBean implements Serializable { ...@@ -86,6 +96,12 @@ public class ConnectAccountBean implements Serializable {
} }
public void startConnectSaml() {
ExternalContext externalContext = FacesContext.getCurrentInstance().getExternalContext();
messageGenerator.addErrorMessage("Ein Fehler ist aufgetreten", "Fehler, nicht implementiert");
}
public IdentityEntity getIdentity() { public IdentityEntity getIdentity() {
return identity; return identity;
} }
...@@ -117,4 +133,16 @@ public class ConnectAccountBean implements Serializable { ...@@ -117,4 +133,16 @@ public class ConnectAccountBean implements Serializable {
this.pin = pin; this.pin = pin;
} }
public List<SamlIdpMetadataEntity> getIdpList() {
return idpList;
}
public SamlIdpMetadataEntity getSelectedIdp() {
return selectedIdp;
}
public void setSelectedIdp(SamlIdpMetadataEntity selectedIdp) {
this.selectedIdp = selectedIdp;
}
} }
...@@ -35,7 +35,24 @@ ...@@ -35,7 +35,24 @@
#{user.id} #{user.id}
</p:dataList> </p:dataList>
<h:panelGrid id="samlBaseData" columns="3" style="margin-top: 8px;">
<p:outputLabel value="#{messages.home_org}:" for="idpBox" />
<p:selectOneListbox id="idpBox" value="#{connectAccountBean.selectedIdp}" scrollHeight="360" style="width:auto;"
converter="#{samlIdpMetadataConverter}">
<f:selectItems value="#{connectAccountBean.idpList}"
var="idp" itemLabel="#{idp.displayName == null ? idp.orgName : idp.displayName}" itemValue="#{idp}"/>
<p:ajax event="dblclick" listener="#{connectAccountBean.login}" update=":form" />
</p:selectOneListbox>
<p:message for="idpBox"/>
</h:panelGrid>
<p:commandButton id="samlLogin" action="#{connectAccountBean.startConnectSaml()}" value="#{messages.proceed}"
validateClient="true" update=":form"/>
<h:panelGrid id="oidcBaseData" columns="3" style="margin-top: 8px;"> <h:panelGrid id="oidcBaseData" columns="3" style="margin-top: 8px;">
<p:outputLabel value="#{messages.home_org}:" for="oidcBox" /> <p:outputLabel value="#{messages.home_org}:" for="oidcBox" />
<p:selectOneListbox id="oidcBox" value="#{connectAccountBean.selectedOidcRp}" scrollHeight="120" style="width:300px;" <p:selectOneListbox id="oidcBox" value="#{connectAccountBean.selectedOidcRp}" scrollHeight="120" style="width:300px;"
converter="#{oidcRpConfigurationConverter}"> converter="#{oidcRpConfigurationConverter}">
...@@ -52,7 +69,7 @@ ...@@ -52,7 +69,7 @@
<p:message for="pinBox"/> <p:message for="pinBox"/>
</h:panelGrid> </h:panelGrid>
<p:commandButton id="oidcLogin" action="#{connectAccountBean.startConnect()}" value="#{messages.proceed}" <p:commandButton id="oidcLogin" action="#{connectAccountBean.startConnectOidc()}" value="#{messages.proceed}"
validateClient="true" update=":form"/> validateClient="true" update=":form"/>
</h:form> </h:form>
......
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