Commit 61ddb344 authored by michael.simon's avatar michael.simon
Browse files

entity classes and frontend representation for standby certificate in sp

configuration
parent 3057ef07
...@@ -42,6 +42,16 @@ public abstract class SamlConfigurationEntity extends AbstractBaseEntity { ...@@ -42,6 +42,16 @@ public abstract class SamlConfigurationEntity extends AbstractBaseEntity {
@Type(type = "org.hibernate.type.TextType") @Type(type = "org.hibernate.type.TextType")
private String certificate; private String certificate;
@Column(name = "standby_private_key")
@Lob
@Type(type = "org.hibernate.type.TextType")
private String standbyPrivateKey;
@Column(name = "standby_certificate")
@Lob
@Type(type = "org.hibernate.type.TextType")
private String standbyCertificate;
public String getPrivateKey() { public String getPrivateKey() {
return privateKey; return privateKey;
} }
...@@ -65,4 +75,28 @@ public abstract class SamlConfigurationEntity extends AbstractBaseEntity { ...@@ -65,4 +75,28 @@ public abstract class SamlConfigurationEntity extends AbstractBaseEntity {
public void setEntityId(String entityId) { public void setEntityId(String entityId) {
this.entityId = entityId; this.entityId = entityId;
} }
public SamlMetadataEntityStatus getStatus() {
return status;
}
public void setStatus(SamlMetadataEntityStatus status) {
this.status = status;
}
public String getStandbyPrivateKey() {
return standbyPrivateKey;
}
public void setStandbyPrivateKey(String standbyPrivateKey) {
this.standbyPrivateKey = standbyPrivateKey;
}
public String getStandbyCertificate() {
return standbyCertificate;
}
public void setStandbyCertificate(String standbyCertificate) {
this.standbyCertificate = standbyCertificate;
}
} }
...@@ -53,7 +53,7 @@ public class CryptoHelper implements Serializable { ...@@ -53,7 +53,7 @@ public class CryptoHelper implements Serializable {
pemReader.close(); pemReader.close();
if (certHolder == null) { if (certHolder == null) {
logger.warn("Invalid Certificate. CertHoler is null."); logger.warn("Invalid Certificate. CertHolder is null.");
return null; return null;
} }
......
...@@ -45,6 +45,7 @@ public class ShowSamlSpConfigurationBean implements Serializable { ...@@ -45,6 +45,7 @@ public class ShowSamlSpConfigurationBean implements Serializable {
private Long id; private Long id;
private X509Certificate certificate; private X509Certificate certificate;
private X509Certificate standbyCertificate;
public void preRenderView(ComponentSystemEvent ev) { public void preRenderView(ComponentSystemEvent ev) {
if (entity == null) { if (entity == null) {
...@@ -57,6 +58,15 @@ public class ShowSamlSpConfigurationBean implements Serializable { ...@@ -57,6 +58,15 @@ public class ShowSamlSpConfigurationBean implements Serializable {
certificate = null; certificate = null;
} }
} }
if (entity != null && entity.getStandbyCertificate() != null &&
(! entity.getStandbyCertificate().equals(""))) {
try {
standbyCertificate = cryptoHelper.getCertificate(entity.getStandbyCertificate());
} catch (IOException e) {
logger.info("No valid X509 Cert", e);
certificate = null;
}
}
} }
} }
...@@ -82,5 +92,13 @@ public class ShowSamlSpConfigurationBean implements Serializable { ...@@ -82,5 +92,13 @@ public class ShowSamlSpConfigurationBean implements Serializable {
public void setCertificate(X509Certificate certificate) { public void setCertificate(X509Certificate certificate) {
this.certificate = certificate; this.certificate = certificate;
}
public X509Certificate getStandbyCertificate() {
return standbyCertificate;
}
public void setStandbyCertificate(X509Certificate standbyCertificate) {
this.standbyCertificate = standbyCertificate;
} }
} }
...@@ -72,6 +72,14 @@ ...@@ -72,6 +72,14 @@
<p:inputTextarea id="certificate" rows="12" cols="80" autoResize="false" <p:inputTextarea id="certificate" rows="12" cols="80" autoResize="false"
value="#{editSamlSpConfigurationBean.entity.certificate}"/> value="#{editSamlSpConfigurationBean.entity.certificate}"/>
<h:outputLabel for="sprivate_key" value="#{messages.private_key}:"/>
<p:inputTextarea id="sprivate_key" rows="12" cols="80" autoResize="false"
value="#{editSamlSpConfigurationBean.entity.standbyPrivateKey}"/>
<h:outputLabel for="scertificate" value="#{messages.certificate}:"/>
<p:inputTextarea id="scertificate" rows="12" cols="80" autoResize="false"
value="#{editSamlSpConfigurationBean.entity.standbyCertificate}"/>
</p:panelGrid> </p:panelGrid>
<h:commandButton id="save" action="#{editSamlSpConfigurationBean.save}" value="#{messages.save}"/> <h:commandButton id="save" action="#{editSamlSpConfigurationBean.save}" value="#{messages.save}"/>
</p:panel> </p:panel>
......
...@@ -64,6 +64,26 @@ ...@@ -64,6 +64,26 @@
<h:outputLabel for="private_key" value="#{messages.private_key}:"/> <h:outputLabel for="private_key" value="#{messages.private_key}:"/>
<h:outputText id="private_key" styleClass="pretext" <h:outputText id="private_key" styleClass="pretext"
value="#{showSamlSpConfigurationBean.entity.privateKey}"/> value="#{showSamlSpConfigurationBean.entity.privateKey}"/>
<h:outputLabel for="certinfo5" value="#{messages.cert_dn}:"/>
<h:outputText id="certinfo5" value="#{showSamlSpConfigurationBean.standbyCertificate.subjectDN}"/>
<h:outputLabel for="certinfo6" value="#{messages.cert_issuer}:"/>
<h:outputText id="certinfo6" value="#{showSamlSpConfigurationBean.standbyCertificate.issuerDN}"/>
<h:outputLabel for="certinfo7" value="#{messages.valid_from}:"/>
<h:outputText id="certinfo7" value="#{showSamlSpConfigurationBean.standbyCertificate.notBefore}"/>
<h:outputLabel for="certinfo8" value="#{messages.valid_to}:"/>
<h:outputText id="certinfo8" value="#{showSamlSpConfigurationBean.standbyCertificate.notAfter}"/>
<h:outputLabel for="certificate9" value="#{messages.certificate}:"/>
<h:outputText id="certificate9" styleClass="pretext"
value="#{showSamlSpConfigurationBean.entity.standbyCertificate}"/>
<h:outputLabel for="private_key2" value="#{messages.private_key}:"/>
<h:outputText id="private_key2" styleClass="pretext"
value="#{showSamlSpConfigurationBean.entity.standbyPrivateKey}"/>
</p:panelGrid> </p:panelGrid>
<h:link outcome="edit-sp-config.xhtml" value="#{messages.edit}"> <h:link outcome="edit-sp-config.xhtml" value="#{messages.edit}">
<f:param name="id" value="#{showSamlSpConfigurationBean.entity.id}"/> <f:param name="id" value="#{showSamlSpConfigurationBean.entity.id}"/>
......
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