Skip to content

Commit

Permalink
Using upper case page names
Browse files Browse the repository at this point in the history
  • Loading branch information
phax committed Jan 9, 2025
1 parent b22409f commit c6f2558
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 42 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,51 +68,51 @@
*/
public final class PageSecureCertificateInformation extends AbstractSMPWebPage
{
private enum EPredefinedCert
private enum EPredefinedCA
{
// PEPPOL PKI v2
PEPPOL_PILOT_V2 ("Peppol pilot v2",
PEPPOL_PILOT_V2 ("Peppol Pilot CA v2",
"CN=PEPPOL SERVICE METADATA PUBLISHER TEST CA,OU=FOR TEST PURPOSES ONLY,O=NATIONAL IT AND TELECOM AGENCY,C=DK",
3,
true),
PEPPOL_PRODUCTION_V2 ("Peppol production v2",
PEPPOL_PRODUCTION_V2 ("Peppol Production CA v2",
"CN=PEPPOL SERVICE METADATA PUBLISHER CA, O=NATIONAL IT AND TELECOM AGENCY, C=DK",
3,
true),
// PEPPOL PKI v3
PEPPOL_PILOT_V3 ("Peppol pilot v3",
PEPPOL_PILOT_V3 ("Peppol Pilot CA v3",
"CN=PEPPOL SERVICE METADATA PUBLISHER TEST CA - G2,OU=FOR TEST ONLY,O=OpenPEPPOL AISBL,C=BE",
3,
false),
PEPPOL_PRODUCTION_V3 ("Peppol production v3",
PEPPOL_PRODUCTION_V3 ("Peppol Production CA v3",
"CN=PEPPOL SERVICE METADATA PUBLISHER CA - G2,O=OpenPEPPOL AISBL,C=BE",
3,
false),
// TOOP Pilot PKI
TOOP_PILOT_SMP ("TOOP pilot", "CN=TOOP PILOTS TEST SMP CA,OU=CCTF,O=TOOP,ST=Belgium,C=EU", 3, true),
TOOP_PILOT_SMP ("TOOP Pilot CA", "CN=TOOP PILOTS TEST SMP CA,OU=CCTF,O=TOOP,ST=Belgium,C=EU", 3, true),

// DE4A PKIs
DE4A_TEST ("DE4A Test",
DE4A_TEST ("DE4A Test CA",
"E=CEF-EDELIVERY-SUPPORT@ec.europa.eu,CN=DE4A_TEST_SMP_CA,OU=CEF,O=DE4A,ST=Brussels-Capital,C=BE",
4,
true),
DE4A_TELSEC1 ("DE4A Telesec [1]",
DE4A_TELSEC1 ("DE4A Telesec CA [1]",
"CN=TeleSec Business CA 1,OU=T-Systems Trust Center,O=T-Systems International GmbH,C=DE",
3,
true),
DE4A_TELSEC2 ("DE4A Telesec [2]", "CN=TeleSec Business CA 21,O=Deutsche Telekom Security GmbH,C=DE", 3, true),
DE4A_TELSEC2 ("DE4A Telesec CA [2]", "CN=TeleSec Business CA 21,O=Deutsche Telekom Security GmbH,C=DE", 3, true),
DE4A_COMMISSIGN_2 ("DE4A CommisSign", "CN=CommisSign - 2,O=European Commission", 3, true),

// DBNA
DBNA_PRODUCTION ("DBNA Production",
DBNA_PRODUCTION ("DBNA Production CA",
"CN=Digital Business Networks Alliance Intermediate CA,O=Digital Business Networks Alliance,C=US",
3,
false),
DBNA_TEST ("DBNA Test",
DBNA_TEST ("DBNA Test CA",
"CN=DBNAlliance Demo Intermediate Test,O=Digital Business Network Alliance,STREET=3 River Way Suite 920,PostalCode=77056,L=Houston,ST=Texas,C=US",
3,
false),
DBNA_PILOT ("DBNA Pilot",
DBNA_PILOT ("DBNA Pilot CA",
"CN=DBNAlliance Demo Intermediate Pilot,O=Digital Business Network Alliance,STREET=3 River Way Suite 920,PostalCode=77056,L=Houston,ST=Texas,C=US",
3,
false),;
Expand All @@ -130,10 +130,10 @@ private enum EPredefinedCert
* @param nCerts
* Required depth of PKI
*/
EPredefinedCert (@Nonnull @Nonempty final String sDisplayName,
@Nonnull @Nonempty final String sIssuer,
@Nonnegative final int nCerts,
final boolean bDeprecated)
EPredefinedCA (@Nonnull @Nonempty final String sDisplayName,
@Nonnull @Nonempty final String sIssuer,
@Nonnegative final int nCerts,
final boolean bDeprecated)
{
m_sDisplayName = sDisplayName;
m_sIssuer = sIssuer;
Expand All @@ -160,10 +160,10 @@ public boolean isDeprecated ()
}

@Nullable
public static EPredefinedCert getFromIssuerOrNull (@Nullable final String sIssuer)
public static EPredefinedCA getFromIssuerOrNull (@Nullable final String sIssuer)
{
if (StringHelper.hasText (sIssuer))
for (final EPredefinedCert e : values ())
for (final EPredefinedCA e : values ())
if (e.m_sIssuer.equals (sIssuer))
return e;
return null;
Expand All @@ -176,7 +176,7 @@ public static EPredefinedCert getFromIssuerOrNull (@Nullable final String sIssue

public PageSecureCertificateInformation (@Nonnull @Nonempty final String sID)
{
super (sID, "Certificate information");
super (sID, "Certificate Information");
}

@Override
Expand Down Expand Up @@ -241,15 +241,13 @@ protected void fillContent (@Nonnull final WebPageExecutionContext aWPEC)

// Inline function to add a visual indicator if a certificate problem was
// found
final Function <IHCNode, IHCNode> addErrorHint = x -> x instanceof HCSpan ? x
: new HCSpan ().addChild (x)
.addChild (" ")
.addChild (badgeDanger ("!!!"));
final Function <IHCNode, IHCNode> addErrorHint = x -> x instanceof HCSpan ? x : new HCSpan ().addChild (x)
.addChild (" ")
.addChild (badgeDanger ("!!!"));

final Function <IHCNode, IHCNode> addSuccessHint = x -> x instanceof HCSpan ? x
: new HCSpan ().addChild (x)
.addChild (" ")
.addChild (badgeSuccess ("OK"));
final Function <IHCNode, IHCNode> addSuccessHint = x -> x instanceof HCSpan ? x : new HCSpan ().addChild (x)
.addChild (" ")
.addChild (badgeSuccess ("OK"));

// SMP Key store
{
Expand Down Expand Up @@ -314,7 +312,7 @@ protected void fillContent (@Nonnull final WebPageExecutionContext aWPEC)
{
final X509Certificate aHead = (X509Certificate) aChain[0];
final String sIssuer = aHead.getIssuerX500Principal ().getName ();
final EPredefinedCert eCert = EPredefinedCert.getFromIssuerOrNull (sIssuer);
final EPredefinedCA eCert = EPredefinedCA.getFromIssuerOrNull (sIssuer);
if (eCert != null)
{
if (eCert.isDeprecated ())
Expand Down Expand Up @@ -457,17 +455,16 @@ protected void fillContent (@Nonnull final WebPageExecutionContext aWPEC)
final Certificate [] aChain = aKeyEntry.getCertificateChain ();

// Key store path and password are fine
aTab.addChild (success (div ("Keystore is located at '" +
sKeyStorePath +
"' and was successfully loaded.")).addChild (div ("The private key with the alias '" +
sAlias +
"' was successfully loaded.")));
aTab.addChild (success (div ("Keystore is located at '" + sKeyStorePath + "' and was successfully loaded."))
.addChild (div ("The private key with the alias '" +
sAlias +
"' was successfully loaded.")));

if (aChain.length > 0 && aChain[0] instanceof X509Certificate)
{
final X509Certificate aHead = (X509Certificate) aChain[0];
final String sIssuer = aHead.getIssuerX500Principal ().getName ();
final EPredefinedCert eCert = EPredefinedCert.getFromIssuerOrNull (sIssuer);
final EPredefinedCA eCert = EPredefinedCA.getFromIssuerOrNull (sIssuer);
if (eCert != null)
{
if (eCert.isDeprecated ())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public final class PageSecureSMPSettings extends AbstractSMPWebPageSimpleForm <I

public PageSecureSMPSettings (@Nonnull @Nonempty final String sID)
{
super (sID, "SMP settings");
super (sID, "SMP Settings");
}

@Override
Expand Down Expand Up @@ -108,8 +108,8 @@ protected void showObject (@Nonnull final WebPageExecutionContext aWPEC, @Nonnul

final ISMLInfo aSMLInfo = aObject.getSMLInfo ();
aTable.addFormGroup (new BootstrapFormGroup ().setLabel ("SML to be used")
.setCtrl (aSMLInfo == null ? em ("none")
: HCSMLSelect.getDisplayNameNode (aSMLInfo)));
.setCtrl (aSMLInfo == null ? em ("none") : HCSMLSelect
.getDisplayNameNode (aSMLInfo)));
}

{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@
import javax.annotation.Nonnull;
import javax.annotation.concurrent.NotThreadSafe;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.helger.commons.ValueEnforcer;
import com.helger.commons.annotation.Nonempty;
import com.helger.commons.collection.CollectionHelper;
Expand Down Expand Up @@ -72,6 +75,7 @@
import com.helger.phoss.smp.ui.SMPCommonUI;
import com.helger.photon.security.CSecurity;
import com.helger.photon.security.mgr.PhotonSecurityManager;
import com.helger.photon.security.user.IUserManager;
import com.helger.photon.uicore.css.CUICoreCSS;
import com.helger.photon.uicore.page.WebPageExecutionContext;
import com.helger.security.certificate.CertificateHelper;
Expand Down Expand Up @@ -132,9 +136,11 @@ Iterable <Map.Entry <String, CertCacheItem>> iterateAll ()
}
}

private static final Logger LOGGER = LoggerFactory.getLogger (PageSecureTasksProblems.class);

public PageSecureTasksProblems (@Nonnull @Nonempty final String sID)
{
super (sID, "Tasks/problems");
super (sID, "Tasks/Problems");
}

@Nonnull
Expand Down Expand Up @@ -467,6 +473,7 @@ protected void fillContent (@Nonnull final WebPageExecutionContext aWPEC)
{
final HCNodeList aNodeList = aWPEC.getNodeList ();
final Locale aDisplayLocale = aWPEC.getDisplayLocale ();
final IUserManager aUserMgr = PhotonSecurityManager.getUserMgr ();
final ISMPServiceGroupManager aServiceGroupMgr = SMPMetaManager.getServiceGroupMgr ();
final ISMPServiceInformationManager aServiceInfoMgr = SMPMetaManager.getServiceInformationMgr ();
final IIdentifierFactory aIdentifierFactory = SMPMetaManager.getIdentifierFactory ();
Expand All @@ -480,9 +487,7 @@ protected void fillContent (@Nonnull final WebPageExecutionContext aWPEC)
final HCOL aOL = new HCOL ();

// Check for default password
if (PhotonSecurityManager.getUserMgr ()
.areUserIDAndPasswordValid (CSecurity.USER_ADMINISTRATOR_ID,
CSecurity.USER_ADMINISTRATOR_PASSWORD))
if (aUserMgr.areUserIDAndPasswordValid (CSecurity.USER_ADMINISTRATOR_ID, CSecurity.USER_ADMINISTRATOR_PASSWORD))
{
aOL.addItem (_createError ("Please change the password of the default user " +
CSecurity.USER_ADMINISTRATOR_EMAIL +
Expand Down Expand Up @@ -519,6 +524,11 @@ protected void fillContent (@Nonnull final WebPageExecutionContext aWPEC)
for (final String sServiceGroupID : aServiceGroupIDs)
{
final IParticipantIdentifier aParticipantID = aIdentifierFactory.parseParticipantIdentifier (sServiceGroupID);
if (aParticipantID == null)
{
LOGGER.error ("Failed to parse '" + sServiceGroupID + "' to a participant identifier");
continue;
}

final HCUL aULPerSG = new HCUL ();
final ICommonsList <ISMPServiceInformation> aServiceInfos = aServiceInfoMgr.getAllSMPServiceInformationOfServiceGroup (aParticipantID);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public class PageSecureTransportProfiles extends AbstractSMPWebPageForm <ISMPTra

public PageSecureTransportProfiles (@Nonnull @Nonempty final String sID)
{
super (sID, "Transport profiles");
super (sID, "Transport Profiles");
setDeleteHandler (new AbstractBootstrapWebPageActionHandlerDelete <ISMPTransportProfile, WebPageExecutionContext> ()
{
@Override
Expand Down

0 comments on commit c6f2558

Please sign in to comment.