mirror of
https://github.com/nsacyber/HIRS.git
synced 2025-03-19 18:45:16 +00:00
Finished merging main into PR branch
Some checks failed
Dotnet Provisioner Unit Tests / Restore and Run Unit Tests (ubuntu-20.04) (push) Has been cancelled
Dotnet Provisioner Unit Tests / Restore and Run Unit Tests (windows-2022) (push) Has been cancelled
HIRS Build and Unit Test / ACA_Provisioner_Unit_Tests (push) Has been cancelled
HIRS System Tests / DockerTests (push) Has been cancelled
Dotnet Provisioner Unit Tests / Evaluate Tests (push) Has been cancelled
Some checks failed
Dotnet Provisioner Unit Tests / Restore and Run Unit Tests (ubuntu-20.04) (push) Has been cancelled
Dotnet Provisioner Unit Tests / Restore and Run Unit Tests (windows-2022) (push) Has been cancelled
HIRS Build and Unit Test / ACA_Provisioner_Unit_Tests (push) Has been cancelled
HIRS System Tests / DockerTests (push) Has been cancelled
Dotnet Provisioner Unit Tests / Evaluate Tests (push) Has been cancelled
This commit is contained in:
commit
051d5ac871
@ -229,7 +229,7 @@ ComponentClass {
|
||||
} else if (componentMask.equals(UNKNOWN)) {
|
||||
this.componentStr = UNKNOWN_STRING;
|
||||
} else {
|
||||
getComponent(componentTypes);
|
||||
setComponentString(componentTypes);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -253,12 +253,11 @@ ComponentClass {
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for the component associated with the component JSON Object mapped
|
||||
* in the JSON file.
|
||||
* Sets the component string value based on the provided JSON object's components.
|
||||
*
|
||||
* @param components JSON Object for the categories components
|
||||
* @param components JSON Object components
|
||||
*/
|
||||
private void getComponent(final JsonObject components) {
|
||||
private void setComponentString(final JsonObject components) {
|
||||
String typeID;
|
||||
|
||||
if (components != null) {
|
||||
@ -270,5 +269,10 @@ ComponentClass {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// if the component string is still null after doing a lookup
|
||||
if (componentStr == null) {
|
||||
componentStr = UNKNOWN_STRING;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -7,7 +7,7 @@ import java.nio.file.Paths;
|
||||
import java.util.Objects;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertNull;
|
||||
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||
|
||||
/**
|
||||
* Tests for the ComponentClassTest class.
|
||||
@ -29,8 +29,8 @@ public class ComponentClassTest {
|
||||
componentIdentifier);
|
||||
final String resultCategory = instance.getCategoryStr();
|
||||
final String resultComponent = instance.getComponentStr();
|
||||
assertEquals(resultComponent, "Unknown");
|
||||
assertEquals(resultCategory, "None");
|
||||
assertEquals("Unknown", resultComponent);
|
||||
assertEquals("None", resultCategory);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -41,12 +41,12 @@ public class ComponentClassTest {
|
||||
@Test
|
||||
public void testGetComponentNoneOther() throws URISyntaxException {
|
||||
final String componentIdentifier = "00000000";
|
||||
ComponentClass instance = new ComponentClass("TCG", Paths.get(Objects.requireNonNull(this.getClass()
|
||||
.getResource(JSON_FILE)).toURI()), componentIdentifier);
|
||||
ComponentClass instance = new ComponentClass("TCG", Paths.get(this.getClass()
|
||||
.getResource(JSON_FILE).toURI()), componentIdentifier);
|
||||
final String resultCategory = instance.getCategoryStr();
|
||||
final String resultComponent = instance.getComponentStr();
|
||||
assertEquals(resultComponent, "Unknown");
|
||||
assertEquals(resultCategory, "None");
|
||||
assertEquals("Unknown", resultComponent);
|
||||
assertEquals("None", resultCategory);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -57,12 +57,12 @@ public class ComponentClassTest {
|
||||
@Test
|
||||
public void testGetComponentBlank() throws URISyntaxException {
|
||||
final String componentIdentifier = "";
|
||||
ComponentClass instance = new ComponentClass(Paths.get(Objects.requireNonNull(this.getClass()
|
||||
.getResource(JSON_FILE)).toURI()), componentIdentifier);
|
||||
ComponentClass instance = new ComponentClass(Paths.get(this.getClass()
|
||||
.getResource(JSON_FILE).toURI()), componentIdentifier);
|
||||
final String resultCategory = instance.getCategoryStr();
|
||||
final String resultComponent = instance.getComponentStr();
|
||||
assertEquals(resultComponent, "Unknown");
|
||||
assertEquals(resultCategory, "None");
|
||||
assertEquals("Unknown", resultComponent);
|
||||
assertEquals("None", resultCategory);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -73,12 +73,12 @@ public class ComponentClassTest {
|
||||
@Test
|
||||
public void testGetComponentNFEx() throws URISyntaxException {
|
||||
final String componentIdentifier = "99999999";
|
||||
ComponentClass instance = new ComponentClass(Paths.get(Objects.requireNonNull(this.getClass()
|
||||
.getResource(JSON_FILE)).toURI()), componentIdentifier);
|
||||
ComponentClass instance = new ComponentClass(Paths.get(this.getClass()
|
||||
.getResource(JSON_FILE).toURI()), componentIdentifier);
|
||||
final String resultCategory = instance.getCategoryStr();
|
||||
final String resultComponent = instance.getComponentStr();
|
||||
assertEquals(resultComponent, "Unknown");
|
||||
assertEquals(resultCategory, "None");
|
||||
assertEquals("Unknown", resultComponent);
|
||||
assertEquals("None", resultCategory);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -89,12 +89,12 @@ public class ComponentClassTest {
|
||||
@Test
|
||||
public void testGetComponentNull() throws URISyntaxException {
|
||||
final String componentIdentifier = null;
|
||||
ComponentClass instance = new ComponentClass(Paths.get(Objects.requireNonNull(this.getClass()
|
||||
.getResource(JSON_FILE)).toURI()), componentIdentifier);
|
||||
ComponentClass instance = new ComponentClass(Paths.get(this.getClass()
|
||||
.getResource(JSON_FILE).toURI()), componentIdentifier);
|
||||
final String resultCategory = instance.getCategoryStr();
|
||||
final String resultComponent = instance.getComponentStr();
|
||||
assertEquals(resultComponent, "Unknown");
|
||||
assertEquals(resultCategory, "None");
|
||||
assertEquals("Unknown", resultComponent);
|
||||
assertEquals("None", resultCategory);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -106,12 +106,12 @@ public class ComponentClassTest {
|
||||
@Test
|
||||
public void testGetComponentStandardQueryTCG() throws URISyntaxException {
|
||||
final String componentIdentifier = "0x00040002";
|
||||
ComponentClass instance = new ComponentClass(Paths.get(Objects.requireNonNull(this.getClass()
|
||||
.getResource(JSON_FILE)).toURI()), componentIdentifier);
|
||||
ComponentClass instance = new ComponentClass(Paths.get(this.getClass()
|
||||
.getResource(JSON_FILE).toURI()), componentIdentifier);
|
||||
final String resultCategory = instance.getCategoryStr();
|
||||
final String resultComponent = instance.getComponentStr();
|
||||
assertEquals(resultComponent, "SAS Bridgeboard");
|
||||
assertEquals(resultCategory, "Modules");
|
||||
assertEquals("SAS Bridgeboard", resultComponent);
|
||||
assertEquals("Modules", resultCategory);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -257,8 +257,8 @@ public class ComponentClassTest {
|
||||
.getResource(JSON_FILE)).toURI()), componentIdentifier);
|
||||
final String resultCategory = instance.getCategoryStr();
|
||||
final String resultComponent = instance.getComponentStr();
|
||||
assertEquals(resultComponent, "SAS Bridgeboard");
|
||||
assertEquals(resultCategory, "Modules");
|
||||
assertEquals("SAS Bridgeboard", resultComponent);
|
||||
assertEquals("Modules", resultCategory);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -274,8 +274,8 @@ public class ComponentClassTest {
|
||||
.getResource(JSON_FILE)).toURI()), componentIdentifier);
|
||||
final String resultCategory = instance.getCategoryStr();
|
||||
final String resultComponent = instance.getComponentStr();
|
||||
assertEquals(resultComponent, "SAS Bridgeboard");
|
||||
assertEquals(resultCategory, "Modules");
|
||||
assertEquals("SAS Bridgeboard", resultComponent);
|
||||
assertEquals("Modules", resultCategory);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -290,8 +290,9 @@ public class ComponentClassTest {
|
||||
.getResource(JSON_FILE)).toURI()), componentIdentifier);
|
||||
final String resultCategory = instance.getCategoryStr();
|
||||
final String resultComponent = instance.getComponentStr();
|
||||
assertNull(resultComponent);
|
||||
assertEquals(resultCategory, "Modules");
|
||||
assertNotNull(resultComponent);
|
||||
assertEquals("Unknown", resultComponent);
|
||||
assertEquals("Modules", resultCategory);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -306,8 +307,9 @@ public class ComponentClassTest {
|
||||
.getResource(JSON_FILE)).toURI()), componentIdentifier);
|
||||
final String resultCategory = instance.getCategoryStr();
|
||||
final String resultComponent = instance.getComponentStr();
|
||||
assertNull(resultComponent);
|
||||
assertEquals(resultCategory, "Modules");
|
||||
assertNotNull(resultComponent);
|
||||
assertEquals("Unknown", resultComponent);
|
||||
assertEquals("Modules", resultCategory);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -322,7 +324,7 @@ public class ComponentClassTest {
|
||||
.getResource(JSON_FILE)).toURI()), componentIdentifier);
|
||||
final String resultCategory = instance.getCategoryStr();
|
||||
final String resultComponent = instance.getComponentStr();
|
||||
assertEquals(resultComponent, "Unknown");
|
||||
assertEquals(resultCategory, "None");
|
||||
assertEquals("Unknown", resultComponent);
|
||||
assertEquals("None", resultCategory);
|
||||
}
|
||||
}
|
||||
|
@ -1,10 +1,12 @@
|
||||
package hirs.attestationca.portal.page;
|
||||
|
||||
import hirs.utils.VersionHelper;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* Contains attributes required to display a portal page and its menu link.
|
||||
*/
|
||||
@Getter
|
||||
public enum Page {
|
||||
|
||||
/**
|
||||
@ -73,14 +75,25 @@ public enum Page {
|
||||
HELP("Help", "ic_live_help");
|
||||
|
||||
private final String title;
|
||||
|
||||
private final String subtitle;
|
||||
|
||||
private final String icon;
|
||||
|
||||
/**
|
||||
* Boolean representation of whether the page should display the navigation menu.
|
||||
*/
|
||||
private final boolean hasMenu;
|
||||
|
||||
private final String menuLinkClass;
|
||||
|
||||
/**
|
||||
* Boolean representation of whether the page should be displayed in the navigation menu.
|
||||
*/
|
||||
private final boolean inMenu;
|
||||
|
||||
private final String prefixPath;
|
||||
|
||||
private final String viewName;
|
||||
|
||||
/**
|
||||
@ -150,80 +163,4 @@ public enum Page {
|
||||
final String icon) {
|
||||
this(title, null, icon, true, true, null, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the title of the page.
|
||||
*
|
||||
* @return the title of the page.
|
||||
*/
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the subtitle of the page.
|
||||
*
|
||||
* @return the subtitle of the page.
|
||||
*/
|
||||
public String getSubtitle() {
|
||||
return subtitle;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the base filename of the icon for page. E.g. "ic_my_icon", which will be appended
|
||||
* with appropriate size string (_24dp/_48dp) and file extension (.png) when used.
|
||||
*
|
||||
* @return the base filename of the icon for page.
|
||||
*/
|
||||
public String getIcon() {
|
||||
return icon;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the page should be displayed in the navigation menu.
|
||||
*
|
||||
* @return true if the page should be displayed in the navigation menu.
|
||||
*/
|
||||
public boolean getInMenu() {
|
||||
return inMenu;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the css class to add to the menu link to display it appropriately. E.g. "first" if
|
||||
* the link is the first in a group to separate it visually from the previous group.
|
||||
*
|
||||
* @return he class to add to the menu link to display it appropriately.
|
||||
*/
|
||||
public String getMenuLinkClass() {
|
||||
return menuLinkClass;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the page should display the navigation menu.
|
||||
*
|
||||
* @return true if the page should display the navigation menu.
|
||||
*/
|
||||
public boolean getHasMenu() {
|
||||
return hasMenu;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the page's view name.
|
||||
*
|
||||
* @return the page's view name
|
||||
*/
|
||||
public String getViewName() {
|
||||
return viewName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the page's view name.
|
||||
*
|
||||
* @return the page's view name
|
||||
*/
|
||||
public String getPrefixPath() {
|
||||
return prefixPath;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -349,7 +349,7 @@ public class CertificatePageController extends PageController<NoPageParams> {
|
||||
|
||||
records.setRecordsFiltered(caCredentialRepository.findByArchiveFlag(false).size());
|
||||
|
||||
log.debug("Returning the size of the list of certificate trust chains: {}", records.size());
|
||||
log.debug("Returning the size of the list of trust chain certificates: {}", records.size());
|
||||
return new DataTableResponse<>(records, input);
|
||||
}
|
||||
case ISSUEDCERTIFICATES -> {
|
||||
@ -1039,8 +1039,11 @@ public class CertificatePageController extends PageController<NoPageParams> {
|
||||
ComponentResult componentResult;
|
||||
|
||||
if (platformCredential.getPlatformConfigurationV1() != null) {
|
||||
for (ComponentIdentifier componentIdentifier : platformCredential
|
||||
.getComponentIdentifiers()) {
|
||||
|
||||
List<ComponentIdentifier> componentIdentifiers =
|
||||
platformCredential.getComponentIdentifiers();
|
||||
|
||||
for (ComponentIdentifier componentIdentifier : componentIdentifiers) {
|
||||
componentResult = new ComponentResult(platformCredential.getPlatformSerial(),
|
||||
platformCredential.getSerialNumber().toString(),
|
||||
platformCredential.getPlatformChainType(),
|
||||
@ -1050,8 +1053,11 @@ public class CertificatePageController extends PageController<NoPageParams> {
|
||||
componentResultRepository.save(componentResult);
|
||||
}
|
||||
} else if (platformCredential.getPlatformConfigurationV2() != null) {
|
||||
for (ComponentIdentifierV2 componentIdentifierV2 : platformCredential
|
||||
.getComponentIdentifiersV2()) {
|
||||
|
||||
List<ComponentIdentifierV2> componentIdentifiersV2 =
|
||||
platformCredential.getComponentIdentifiersV2();
|
||||
|
||||
for (ComponentIdentifierV2 componentIdentifierV2 : componentIdentifiersV2) {
|
||||
componentResult = new ComponentResult(platformCredential.getPlatformSerial(),
|
||||
platformCredential.getSerialNumber().toString(),
|
||||
platformCredential.getPlatformChainType(),
|
||||
|
Loading…
x
Reference in New Issue
Block a user