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

add page for viewing and deploying keys, no function yet.

parent 35daa9d1
/*******************************************************************************
* 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;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
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.UserEntity;
import edu.kit.scc.webreg.service.UserService;
import edu.kit.scc.webreg.session.SessionManager;
import edu.kit.scc.webreg.ssh.OpenSshKeyDecoder;
import edu.kit.scc.webreg.ssh.OpenSshPublicKey;
@ManagedBean
@ViewScoped
public class UserSshKeyManagementBean implements Serializable {
private static final long serialVersionUID = 1L;
private UserEntity user;
@Inject
private UserService userService;
@Inject
private SessionManager sessionManager;
@Inject
private OpenSshKeyDecoder keyDecoder;
private List<OpenSshPublicKey> keyList;
private String newKey;
public void preRenderView(ComponentSystemEvent ev) {
if (user == null) {
user = userService.findByIdWithStore(sessionManager.getUserId());
keyList = new ArrayList<>();
}
}
public void deployKey() {
OpenSshPublicKey key = keyDecoder.decode(newKey);
keyList.add(key);
}
public UserEntity getUser() {
return user;
}
public String getNewKey() {
return newKey;
}
public void setNewKey(String newKey) {
this.newKey = newKey;
}
public List<OpenSshPublicKey> getKeyList() {
return keyList;
}
public void setKeyList(List<OpenSshPublicKey> keyList) {
this.keyList = keyList;
}
}
<?xml version='1.0' encoding='UTF-8' ?>
<!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"
xmlns:of="http://omnifaces.org/functions">
<head>
<title></title>
</head>
<body>
<f:view>
<f:metadata>
<f:event type="javax.faces.event.PreRenderViewEvent"
listener="#{userSshKeyManagementBean.preRenderView}" />
</f:metadata>
<ui:composition template="/template/default.xhtml">
<ui:param name="title" value="#{messages.title}"/>
<ui:define name="content">
<h:form>
<div class="panel">
<div class="panel">#{messages.my_data_explanation}</div>
<div class="panel">#{messages.data_from}: <b>#{userPropertiesBean.idpEntity.orgName}</b></div>
<p:panelGrid id="baseData" columns="2">
<bw:outputText label="#{messages.name}" value="#{userPropertiesBean.user.surName}, #{userPropertiesBean.user.givenName}"/>
<bw:outputText label="#{messages.eppn}" value="#{userPropertiesBean.user.eppn}"/>
</p:panelGrid>
</div>
</h:form>
</ui:define>
</ui:composition>
</f:view>
</body>
</html>
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