Commit cd28d586 authored by michael.simon's avatar michael.simon
Browse files

add oidc client configuration pages

parent 6722dbf6
/*******************************************************************************
* Copyright (c) 2014 Michael Simon.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Public License v3.0
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/gpl.html
*
* Contributors:
* Michael Simon - initial
******************************************************************************/
package edu.kit.scc.webreg.bean.admin.oidc;
import java.io.Serializable;
import javax.annotation.PostConstruct;
import javax.enterprise.context.RequestScoped;
import javax.inject.Inject;
import javax.inject.Named;
import edu.kit.scc.webreg.entity.oidc.OidcClientConfigurationEntity;
import edu.kit.scc.webreg.service.oidc.OidcClientConfigurationService;
@Named("addOidcClientConfigurationBean")
@RequestScoped
public class AddOidcClientConfigurationBean implements Serializable {
private static final long serialVersionUID = 1L;
@Inject
private OidcClientConfigurationService service;
private OidcClientConfigurationEntity entity;
@PostConstruct
public void init() {
entity = service.createNew();
}
public String save() {
entity = service.save(entity);
return "show-client-config.xhtml?faces-redirect=true&id=" + entity.getId();
}
public OidcClientConfigurationEntity getEntity() {
return entity;
}
public void setEntity(OidcClientConfigurationEntity entity) {
this.entity = entity;
}
}
/*******************************************************************************
* Copyright (c) 2014 Michael Simon.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Public License v3.0
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/gpl.html
*
* Contributors:
* Michael Simon - initial
******************************************************************************/
package edu.kit.scc.webreg.bean.admin.oidc;
import java.io.Serializable;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;
import javax.faces.event.ComponentSystemEvent;
import javax.inject.Inject;
import edu.kit.scc.webreg.entity.oidc.OidcClientConfigurationEntity;
import edu.kit.scc.webreg.service.oidc.OidcClientConfigurationService;
@ManagedBean
@ViewScoped
public class EditOidcClientConfigurationBean implements Serializable {
private static final long serialVersionUID = 1L;
@Inject
private OidcClientConfigurationService service;
private OidcClientConfigurationEntity entity;
private Long id;
public void preRenderView(ComponentSystemEvent ev) {
if (entity == null) {
entity = service.findById(id);
}
}
public String save() {
service.save(entity);
return "show-client-config.xhtml?faces-redirect=true&id=" + entity.getId();
}
public OidcClientConfigurationEntity getEntity() {
return entity;
}
public void setEntity(OidcClientConfigurationEntity entity) {
this.entity = entity;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
}
/*******************************************************************************
* Copyright (c) 2014 Michael Simon.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Public License v3.0
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/gpl.html
*
* Contributors:
* Michael Simon - initial
******************************************************************************/
package edu.kit.scc.webreg.bean.admin.oidc;
import java.io.Serializable;
import javax.annotation.PostConstruct;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;
import javax.inject.Inject;
import org.primefaces.model.LazyDataModel;
import edu.kit.scc.webreg.entity.oidc.OidcClientConfigurationEntity;
import edu.kit.scc.webreg.model.GenericLazyDataModelImpl;
import edu.kit.scc.webreg.service.oidc.OidcClientConfigurationService;
@ManagedBean
@ViewScoped
public class ListOidcClientConfigurationBean implements Serializable {
private static final long serialVersionUID = 1L;
private LazyDataModel<OidcClientConfigurationEntity> list;
@Inject
private OidcClientConfigurationService service;
@PostConstruct
public void init() {
}
public LazyDataModel<OidcClientConfigurationEntity> getList() {
if (list == null)
list = new GenericLazyDataModelImpl<OidcClientConfigurationEntity, OidcClientConfigurationService, Long>(service);
return list;
}
}
/*******************************************************************************
* Copyright (c) 2014 Michael Simon.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Public License v3.0
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/gpl.html
*
* Contributors:
* Michael Simon - initial
******************************************************************************/
package edu.kit.scc.webreg.bean.admin.oidc;
import java.io.Serializable;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;
import javax.faces.event.ComponentSystemEvent;
import javax.inject.Inject;
import edu.kit.scc.webreg.entity.oidc.OidcClientConfigurationEntity;
import edu.kit.scc.webreg.service.oidc.OidcClientConfigurationService;
@ManagedBean
@ViewScoped
public class ShowOidcClientConfigurationBean implements Serializable {
private static final long serialVersionUID = 1L;
@Inject
private OidcClientConfigurationService service;
private OidcClientConfigurationEntity entity;
private Long id;
private String newKey;
private String newValue;
public void preRenderView(ComponentSystemEvent ev) {
if (entity == null) {
entity = service.findByIdWithAttrs(id, "genericStore");
}
}
public void addGenericStore() {
getEntity().getGenericStore().put(newKey, newValue);
entity = service.save(getEntity());
newKey = "";
newValue = "";
}
public void removeGenericStore(String key) {
newKey = key;
newValue = getEntity().getGenericStore().remove(key);
entity = service.save(getEntity());
}
public OidcClientConfigurationEntity getEntity() {
return entity;
}
public void setEntity(OidcClientConfigurationEntity entity) {
this.entity = entity;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getNewKey() {
return newKey;
}
public void setNewKey(String newKey) {
this.newKey = newKey;
}
public String getNewValue() {
return newValue;
}
public void setNewValue(String newValue) {
this.newValue = newValue;
}
}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:ui="http://java.sun.com/jsf/facelets">
<head>
<title></title>
</head>
<body>
<f:view>
<ui:composition template="/template/default-admin.xhtml">
<ui:param name="title" value="#{messages.title}"/>
<ui:define name="content">
<h:form id="form">
<h2><h:outputText value="#{messages.add_rp_config}"/></h2>
<h:panelGrid id="baseData" columns="2" columnClasses="labelColumn, elementColumn">
<h:outputText value="#{messages.name}:" />
<h:inputText value="#{addOidcRpConfigurationBean.entity.name}" />
</h:panelGrid>
<h:commandButton id="save" action="#{addOidcRpConfigurationBean.save}" value="#{messages.save}"/>
</h:form>
</ui:define>
</ui:composition>
</f:view>
</body>
</html>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:bw="http://www.scc.kit.edu/bwfacelets"
xmlns:p="http://primefaces.org/ui">
<head>
<title></title>
</head>
<body>
<f:view>
<f:metadata>
<f:viewParam name="id" value="#{editOidcClientConfigurationBean.id}"/>
<f:event type="javax.faces.event.PreRenderViewEvent"
listener="#{editOidcClientConfigurationBean.preRenderView}" />
</f:metadata>
<ui:composition template="/template/default-admin.xhtml">
<ui:param name="title" value="#{messages.title}"/>
<ui:define name="content">
<h:form id="form">
<h2><h:outputText value="#{messages.rp_config}: #{editOidcClientConfigurationBean.entity.name}"/></h2>
<div id="panelInline">
<p:panel header="#{messages.rp_config}">
<p:panelGrid id="baseData" columns="2">
<h:outputText value="#{messages.id}:"/>
<h:outputText value="#{editOidcClientConfigurationBean.entity.id}"/>
<bw:inputText id="entityIdField" label="#{messages.name}"
value="#{editOidcClientConfigurationBean.entity.name}" required="true" />
<bw:inputText id="displayNameField" label="#{messages.display_name}"
value="#{editOidcClientConfigurationBean.entity.displayName}" required="true" />
<bw:inputText id="secretField" label="#{messages.secret}"
value="#{editOidcClientConfigurationBean.entity.secret}" required="false" />
</p:panelGrid>
<h:commandButton id="save" action="#{editOidcClientConfigurationBean.save}" value="#{messages.save}"/>
</p:panel>
</div>
</h:form>
</ui:define>
</ui:composition>
</f:view>
</body>
</html>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:bw="http://www.scc.kit.edu/bwfacelets"
xmlns:p="http://primefaces.org/ui">
<head>
<title></title>
</head>
<body>
<ui:composition template="/template/default-admin.xhtml">
<ui:param name="title" value="#{messages.title}"/>
<ui:define name="content">
<h:form id="form">
<p:dataTable id="dataTable" var="entity" value="#{listOidcClientConfigurationBean.list}" paginator="true"
lazy="true" rows="15">
<p:column>
<f:facet name="header">
<h:outputText value="#{messages.id}" />
</f:facet>
<h:outputText value="#{entity.id}" />
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="#{messages.entity_id}" />
</f:facet>
<h:link outcome="show-client-config.xhtml" value="#{entity.name}">
<f:param name="id" value="#{entity.id}"/>
</h:link>
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="#{messages.display_name}" />
</f:facet>
<h:outputText value="#{entity.displayName}" />
</p:column>
</p:dataTable>
<h:link outcome="add-client-config.xhtml" value="#{messages.add_client_config}"/><br/>
</h:form>
</ui:define>
</ui:composition>
</body>
</html>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:bw="http://www.scc.kit.edu/bwfacelets"
xmlns:p="http://primefaces.org/ui">
<head>
<title></title>
</head>
<body>
<f:view>
<f:metadata>
<f:viewParam name="id" value="#{showOidcClientConfigurationBean.id}"/>
<f:event type="javax.faces.event.PreRenderViewEvent"
listener="#{showOidcClientConfigurationBean.preRenderView}" />
</f:metadata>
<ui:composition template="/template/default-admin.xhtml">
<ui:param name="title" value="#{messages.title}"/>
<ui:define name="content">
<h:form id="form">
<h2><h:outputText value="#{messages.rp_config}: #{showOidcClientConfigurationBean.entity.name}"/></h2>
<div id="panelInline">
<p:panel header="#{messages.rp_config}">
<p:panelGrid id="baseData" columns="2">
<h:outputText value="#{messages.id}:"/>
<h:outputText value="#{showOidcClientConfigurationBean.entity.id}"/>
<h:outputText value="#{messages.name}:"/>
<h:outputText value="#{showOidcClientConfigurationBean.entity.name}"/>
<h:outputText value="#{messages.display_name}:"/>
<h:outputText value="#{showOidcClientConfigurationBean.entity.displayName}"/>
<h:outputText value="#{messages.secret}:"/>
<h:outputText value="#{showOidcClientConfigurationBean.entity.secret}"/>
<h:outputText value="#{messages.oidc_op_configuration}:"/>
<h:outputText value="#{showOidcClientConfigurationBean.entity.opConfiguration.name}"/>
<h:outputText value="#{messages.generic_store}:"/>
<h:panelGroup>
<ul>
<ui:repeat var="key" value="#{showOidcClientConfigurationBean.entity.genericStore.keySet().toArray()}">
<li>
<h:panelGrid id="newPropTable" columns="3" columnClasses="labelColumn, elementColumn">
<h:outputText value="#{key}:"/>
<h:outputText value="#{showOidcClientConfigurationBean.entity.genericStore.get(key)}"/>
<h:commandLink value="(#{messages.delete})" action="#{showOidcClientConfigurationBean.removeGenericStore(key)}">
<f:ajax render="@form" />
</h:commandLink>
</h:panelGrid>
</li>
</ui:repeat>
</ul>
<h:panelGrid id="newPropTable" columns="3" columnClasses="labelColumn, elementColumn">
<h:inputText id="key_input" value="#{showOidcClientConfigurationBean.newKey}"/>
<h:inputText id="value_input" value="#{showOidcClientConfigurationBean.newValue}"/>
<h:commandLink value="#{messages.add}" action="#{showOidcClientConfigurationBean.addGenericStore()}">
<f:ajax execute="form" render="form" />
</h:commandLink>
</h:panelGrid>
</h:panelGroup>
</p:panelGrid>
<h:link outcome="edit-client-config.xhtml" value="#{messages.edit}">
<f:param name="id" value="#{showOidcClientConfigurationBean.entity.id}"/>
</h:link>
</p:panel>
</div>
</h:form>
</ui:define>
</ui:composition>
</f:view>
</body>
</html>
......@@ -112,6 +112,9 @@
<li><span class="ui-icon ui-icon-gear" style="display:inline-block; vertical-align: bottom;" />
<h:link outcome="#{request.contextPath}/admin/oidc/list-oidc-configs.xhtml" value="#{messages.list_oidc_configs}" />
</li>
<li><span class="ui-icon ui-icon-gear" style="display:inline-block; vertical-align: bottom;" />
<h:link outcome="#{request.contextPath}/admin/oidc/list-oidc-client-configs.xhtml" value="#{messages.list_oidc_client_configs}" />
</li>
</ul>
</div>
</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