From d6dec387c5b6430a97b72b350fd20e7629186915 Mon Sep 17 00:00:00 2001 From: Ryan Ashcraft Date: Mon, 15 Jul 2024 10:39:48 -0400 Subject: [PATCH] refactored extensions-authzforce-attribute extensions-policy-decision-point-service updated velocity templates for generated files. Baton migration scripts for any files that need to be renamed. Baton migrations for any Objects that need to be renamed. --- .../src/main/resources/docker/Dockerfile | 2 +- ...operties => aissemble-security.properties} | 0 ...len.aissemble.authz.attribute.provider.xsd | 4 +- .../extensions-authzforce/README.md | 10 +- .../AbstractAuthorizationRequest.java | 4 +- .../authorization/AissembleKeyStore.java | 15 +- ...mbleKeycloakSecureTokenServiceClient.java} | 12 +- .../AissembleSecureTokenServiceClient.java} | 6 +- ...sembleSimpleSecureTokenServiceClient.java} | 6 +- .../authorization/JsonWebTokenUtil.java | 22 +-- .../authorization/models/AuthRequest.java | 2 +- .../authorization/models/PDPRequest.java | 2 +- .../policy/AissembleAttribute.java} | 4 +- .../policy/AissembleAttributePoint.java} | 8 +- .../policy/AissembleAttributeProvider.java} | 111 +++++++------ .../policy/AissembleAttributeUtils.java} | 27 ++-- .../policy/AttributeRequest.java | 4 +- .../authorization/policy/AttributeValue.java | 4 +- .../authorization/policy/ClaimType.java | 2 +- .../authorization/policy/PolicyDecision.java | 2 +- .../policy/PolicyDecisionPoint.java | 6 +- .../authorization/policy/PolicyRequest.java | 4 +- .../config/SecurityConfiguration.java | 12 +- .../AissembleSecurityException.java} | 14 +- .../exception/UnrecoverableException.java | 4 +- ...g.ow2.authzforce.core.pdp.api.PdpExtension | 2 +- ...operties => aissemble-security.properties} | 4 +- .../authorization/AttributeSteps.java | 26 ++-- .../authorization/AuthorizationSteps.java | 6 +- .../security/authorization/Configurer.java | 4 +- .../security/authorization/CucumberTest.java | 4 +- .../authorization/LocalAttributePoint.java | 20 +-- .../authorization/LocalPolicyRequest.java | 4 +- .../authorization/TokenDataInput.java | 4 +- .../security/authorization/TokenSteps.java | 8 +- .../attributes/test-attributes.json | 28 ++-- .../src/test/resources/authorization/pdp.xml | 2 +- .../authorization/policies/test-policy.xml | 20 +-- ...operties => aissemble-security.properties} | 0 .../specifications/attribute-provider.feature | 4 +- .../specifications/token-creation.feature | 22 +-- .../resources/truststore/aissemble-secure.jks | Bin 2173 -> 2197 bytes .../security/LocalAttributePoint.java | 10 +- .../aissemble/security/PDPHelperResource.java | 18 +-- .../security/DataAccessRolesAugmentor.java | 4 +- .../synchronous.processor.base.java.vm | 8 +- .../client/PolicyDecisionPointClient.java | 10 +- .../client/PolicyDecisionPointProxy.java | 7 +- .../v1_8_0/AiopsReferenceJavaMigration.java | 3 +- .../ExtensionsSecurityProjectsMigration.java | 92 +++++++++++ .../src/main/resources/migrations.json | 75 +++++---- .../AiopsReferenceJavaMigrationSteps.java | 11 ++ ...ensionsSecurityProjectsMigrationSteps.java | 58 +++++++ .../aiops-reference-java-migration.feature | 7 +- ...nsions-security-projects-migration.feature | 6 + .../migration/Ingest.java | 146 ++++++++++++++++++ .../validation/IngestValidated.java | 146 ++++++++++++++++++ .../migration/Ingest.java | 81 ++++++++++ .../validation/IngestValidation.java | 81 ++++++++++ 59 files changed, 920 insertions(+), 288 deletions(-) rename extensions/extensions-docker/aissemble-policy-decision-point/src/main/resources/krausening/base/{aiops-security.properties => aissemble-security.properties} (100%) rename extensions/extensions-security/extensions-authzforce/src/main/java/com/boozallen/{aiops => aissemble}/security/authorization/AbstractAuthorizationRequest.java (81%) rename extensions/extensions-security/extensions-authzforce/src/main/java/com/boozallen/{aiops => aissemble}/security/authorization/AissembleKeyStore.java (83%) rename extensions/extensions-security/extensions-authzforce/src/main/java/com/boozallen/{aiops/security/authorization/AiopsKeycloakSecureTokenServiceClient.java => aissemble/security/authorization/AissembleKeycloakSecureTokenServiceClient.java} (88%) rename extensions/extensions-security/extensions-authzforce/src/main/java/com/boozallen/{aiops/security/authorization/AiopsSecureTokenServiceClient.java => aissemble/security/authorization/AissembleSecureTokenServiceClient.java} (80%) rename extensions/extensions-security/extensions-authzforce/src/main/java/com/boozallen/{aiops/security/authorization/AiopsSimpleSecureTokenServiceClient.java => aissemble/security/authorization/AissembleSimpleSecureTokenServiceClient.java} (76%) rename extensions/extensions-security/extensions-authzforce/src/main/java/com/boozallen/{aiops => aissemble}/security/authorization/JsonWebTokenUtil.java (83%) rename extensions/extensions-security/extensions-authzforce/src/main/java/com/boozallen/{aiops => aissemble}/security/authorization/models/AuthRequest.java (91%) rename extensions/extensions-security/extensions-authzforce/src/main/java/com/boozallen/{aiops => aissemble}/security/authorization/models/PDPRequest.java (93%) rename extensions/extensions-security/extensions-authzforce/src/main/java/com/boozallen/{aiops/security/authorization/policy/AiopsAttribute.java => aissemble/security/authorization/policy/AissembleAttribute.java} (93%) rename extensions/extensions-security/extensions-authzforce/src/main/java/com/boozallen/{aiops/security/authorization/policy/AiopsAttributePoint.java => aissemble/security/authorization/policy/AissembleAttributePoint.java} (80%) rename extensions/extensions-security/extensions-authzforce/src/main/java/com/boozallen/{aiops/security/authorization/policy/AiopsAttributeProvider.java => aissemble/security/authorization/policy/AissembleAttributeProvider.java} (79%) rename extensions/extensions-security/extensions-authzforce/src/main/java/com/boozallen/{aiops/security/authorization/policy/AiopsAttributeUtils.java => aissemble/security/authorization/policy/AissembleAttributeUtils.java} (79%) rename extensions/extensions-security/extensions-authzforce/src/main/java/com/boozallen/{aiops => aissemble}/security/authorization/policy/AttributeRequest.java (84%) rename extensions/extensions-security/extensions-authzforce/src/main/java/com/boozallen/{aiops => aissemble}/security/authorization/policy/AttributeValue.java (95%) rename extensions/extensions-security/extensions-authzforce/src/main/java/com/boozallen/{aiops => aissemble}/security/authorization/policy/ClaimType.java (82%) rename extensions/extensions-security/extensions-authzforce/src/main/java/com/boozallen/{aiops => aissemble}/security/authorization/policy/PolicyDecision.java (88%) rename extensions/extensions-security/extensions-authzforce/src/main/java/com/boozallen/{aiops => aissemble}/security/authorization/policy/PolicyDecisionPoint.java (97%) rename extensions/extensions-security/extensions-authzforce/src/main/java/com/boozallen/{aiops => aissemble}/security/authorization/policy/PolicyRequest.java (93%) rename extensions/extensions-security/extensions-authzforce/src/main/java/com/boozallen/{aiops => aissemble}/security/config/SecurityConfiguration.java (95%) rename extensions/extensions-security/extensions-authzforce/src/main/java/com/boozallen/{aiops/security/exception/AiopsSecurityException.java => aissemble/security/exception/AissembleSecurityException.java} (54%) rename extensions/extensions-security/extensions-authzforce/src/main/java/com/boozallen/{aiops => aissemble}/security/exception/UnrecoverableException.java (87%) rename extensions/extensions-security/extensions-authzforce/src/main/resources/krausening/base/{aiops-security.properties => aissemble-security.properties} (89%) rename extensions/extensions-security/extensions-authzforce/src/test/java/com/boozallen/{aiops => aissemble}/security/authorization/AttributeSteps.java (55%) rename extensions/extensions-security/extensions-authzforce/src/test/java/com/boozallen/{aiops => aissemble}/security/authorization/AuthorizationSteps.java (87%) rename extensions/extensions-security/extensions-authzforce/src/test/java/com/boozallen/{aiops => aissemble}/security/authorization/Configurer.java (91%) rename extensions/extensions-security/extensions-authzforce/src/test/java/com/boozallen/{aiops => aissemble}/security/authorization/CucumberTest.java (82%) rename extensions/extensions-security/extensions-authzforce/src/test/java/com/boozallen/{aiops => aissemble}/security/authorization/LocalAttributePoint.java (90%) rename extensions/extensions-security/extensions-authzforce/src/test/java/com/boozallen/{aiops => aissemble}/security/authorization/LocalPolicyRequest.java (78%) rename extensions/extensions-security/extensions-authzforce/src/test/java/com/boozallen/{aiops => aissemble}/security/authorization/TokenDataInput.java (88%) rename extensions/extensions-security/extensions-authzforce/src/test/java/com/boozallen/{aiops => aissemble}/security/authorization/TokenSteps.java (95%) rename extensions/extensions-security/extensions-authzforce/src/test/resources/krausening/base/{aiops-security.properties => aissemble-security.properties} (100%) rename foundation/foundation-security/foundation-pdp-client-java/src/main/java/com/boozallen/{aiops => aissemble}/security/client/PolicyDecisionPointClient.java (87%) rename foundation/foundation-security/foundation-pdp-client-java/src/main/java/com/boozallen/{aiops => aissemble}/security/client/PolicyDecisionPointProxy.java (77%) create mode 100644 foundation/foundation-upgrade/src/main/java/com/boozallen/aissemble/upgrade/migration/v1_8_0/ExtensionsSecurityProjectsMigration.java create mode 100644 foundation/foundation-upgrade/src/test/java/com/boozallen/aissemble/upgrade/migration/v1_8_0/ExtensionsSecurityProjectsMigrationSteps.java create mode 100644 foundation/foundation-upgrade/src/test/resources/specifications/v1_8_0/extensions-security-projects-migration.feature create mode 100644 foundation/foundation-upgrade/src/test/resources/test-files/v1_8_0/AiopsReferenceJavaMigration/migration/Ingest.java create mode 100644 foundation/foundation-upgrade/src/test/resources/test-files/v1_8_0/AiopsReferenceJavaMigration/validation/IngestValidated.java create mode 100644 foundation/foundation-upgrade/src/test/resources/test-files/v1_8_0/ExtensionsSecurityProjectsMigration/migration/Ingest.java create mode 100644 foundation/foundation-upgrade/src/test/resources/test-files/v1_8_0/ExtensionsSecurityProjectsMigration/validation/IngestValidation.java diff --git a/extensions/extensions-docker/aissemble-policy-decision-point/src/main/resources/docker/Dockerfile b/extensions/extensions-docker/aissemble-policy-decision-point/src/main/resources/docker/Dockerfile index 1dd710b89..32cc1353e 100644 --- a/extensions/extensions-docker/aissemble-policy-decision-point/src/main/resources/docker/Dockerfile +++ b/extensions/extensions-docker/aissemble-policy-decision-point/src/main/resources/docker/Dockerfile @@ -3,7 +3,7 @@ FROM ${docker.baseline.repo.id}/boozallen/aissemble-quarkus:${project.version} LABEL org.opencontainers.image.source="https://github.com/boozallen/aissemble" COPY --chown=default ./src/main/resources/truststore/aissemble-secure.jks $JAVA_APP_DIR/ -COPY --chown=default ./src/main/resources/krausening/base/aiops-security.properties $JAVA_APP_DIR/krausening/base/ +COPY --chown=default ./src/main/resources/krausening/base/aissemble-security.properties $JAVA_APP_DIR/krausening/base/ COPY --chown=default ./src/main/resources/authorization/policies/test-policy.xml $JAVA_APP_DIR/ COPY --chown=default ./src/main/resources/authorization/attributes/test-attributes.json $JAVA_APP_DIR/ COPY --chown=default ./src/main/resources/authorization/pdp.xml $JAVA_APP_DIR/ diff --git a/extensions/extensions-docker/aissemble-policy-decision-point/src/main/resources/krausening/base/aiops-security.properties b/extensions/extensions-docker/aissemble-policy-decision-point/src/main/resources/krausening/base/aissemble-security.properties similarity index 100% rename from extensions/extensions-docker/aissemble-policy-decision-point/src/main/resources/krausening/base/aiops-security.properties rename to extensions/extensions-docker/aissemble-policy-decision-point/src/main/resources/krausening/base/aissemble-security.properties diff --git a/extensions/extensions-security/extensions-authzforce-attribute/src/main/resources/com.github.boozallen.aissemble.authz.attribute.provider.xsd b/extensions/extensions-security/extensions-authzforce-attribute/src/main/resources/com.github.boozallen.aissemble.authz.attribute.provider.xsd index 802ed3b71..20a01b795 100644 --- a/extensions/extensions-security/extensions-authzforce-attribute/src/main/resources/com.github.boozallen.aissemble.authz.attribute.provider.xsd +++ b/extensions/extensions-security/extensions-authzforce-attribute/src/main/resources/com.github.boozallen.aissemble.authz.attribute.provider.xsd @@ -8,10 +8,10 @@ - Data Model for the Aiops Attribute Extension + Data Model for the Aissemble Attribute Extension - + aiSSEMBLE Attribute Extensions. This extension provides easier attribute store configuration for aiSSEMBLE. diff --git a/extensions/extensions-security/extensions-authzforce/README.md b/extensions/extensions-security/extensions-authzforce/README.md index f96510e4a..54339d767 100644 --- a/extensions/extensions-security/extensions-authzforce/README.md +++ b/extensions/extensions-security/extensions-authzforce/README.md @@ -9,14 +9,14 @@ The following tasks will help you add authentication to your module. - ```keytool -import -file cacert.pem -keystore aissemble-secure.jks -storepass password``` 1. Add the jks file to your environment and set the following krausening property to point to your keystore location - ```keystore.file.location=/path/to/my/keystore.jks``` -1. Use one of the authentication methods from com.boozallen.aiops.cookbook.authorization or create your own class that -imlements the AiopsSecureTokenServiceClient interface +1. Use one of the authentication methods from com.boozallen.aissemble.cookbook.authorization or create your own class that +imlements the AissembleSecureTokenServiceClient interface (_currently we have one for Keycloak and one for simple JWT_) - Add the following to your code - ``` - AiopsSecureTokenServiceClient aiopsSecureTokenServiceClient = new AiopsSimpleSecureTokenServiceClient(); - aiopsSecureTokenServiceClient.authenticate("aiops", "password"); - String token = aiopsSecureTokenServiceClient.getJWTToken(); + AissembleSecureTokenServiceClient aissembleSecureTokenServiceClient = new AissembleSimpleSecureTokenServiceClient(); + aissembleSecureTokenServiceClient.authenticate("aissemble", "password"); + String token = aissembleSecureTokenServiceClient.getJWTToken(); ``` - You can then use the information contained in the JWT token to allow/deny access \ No newline at end of file diff --git a/extensions/extensions-security/extensions-authzforce/src/main/java/com/boozallen/aiops/security/authorization/AbstractAuthorizationRequest.java b/extensions/extensions-security/extensions-authzforce/src/main/java/com/boozallen/aissemble/security/authorization/AbstractAuthorizationRequest.java similarity index 81% rename from extensions/extensions-security/extensions-authzforce/src/main/java/com/boozallen/aiops/security/authorization/AbstractAuthorizationRequest.java rename to extensions/extensions-security/extensions-authzforce/src/main/java/com/boozallen/aissemble/security/authorization/AbstractAuthorizationRequest.java index ee6c70ca4..23d4e5603 100644 --- a/extensions/extensions-security/extensions-authzforce/src/main/java/com/boozallen/aiops/security/authorization/AbstractAuthorizationRequest.java +++ b/extensions/extensions-security/extensions-authzforce/src/main/java/com/boozallen/aissemble/security/authorization/AbstractAuthorizationRequest.java @@ -1,4 +1,4 @@ -package com.boozallen.aiops.security.authorization; +package com.boozallen.aissemble.security.authorization; /*- * #%L @@ -10,7 +10,7 @@ * #L% */ -import com.boozallen.aiops.security.authorization.policy.ClaimType; +import com.boozallen.aissemble.security.authorization.policy.ClaimType; /** * Common aspect of a request for authorization information (e.g., a policy decision, attribute). diff --git a/extensions/extensions-security/extensions-authzforce/src/main/java/com/boozallen/aiops/security/authorization/AissembleKeyStore.java b/extensions/extensions-security/extensions-authzforce/src/main/java/com/boozallen/aissemble/security/authorization/AissembleKeyStore.java similarity index 83% rename from extensions/extensions-security/extensions-authzforce/src/main/java/com/boozallen/aiops/security/authorization/AissembleKeyStore.java rename to extensions/extensions-security/extensions-authzforce/src/main/java/com/boozallen/aissemble/security/authorization/AissembleKeyStore.java index 823455ce8..7f13bc94c 100644 --- a/extensions/extensions-security/extensions-authzforce/src/main/java/com/boozallen/aiops/security/authorization/AissembleKeyStore.java +++ b/extensions/extensions-security/extensions-authzforce/src/main/java/com/boozallen/aissemble/security/authorization/AissembleKeyStore.java @@ -1,4 +1,4 @@ -package com.boozallen.aiops.security.authorization; +package com.boozallen.aissemble.security.authorization; /*- * #%L @@ -18,15 +18,14 @@ import java.security.UnrecoverableKeyException; import java.security.cert.X509Certificate; +import com.boozallen.aissemble.security.config.SecurityConfiguration; +import com.boozallen.aissemble.security.exception.AissembleSecurityException; import org.aeonbits.owner.KrauseningConfigFactory; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import com.boozallen.aiops.security.config.SecurityConfiguration; -import com.boozallen.aiops.security.exception.AiopsSecurityException; - /** - * Class to load and hold keystore information for AIOps security. + * Class to load and hold keystore information for aissemble security. */ public class AissembleKeyStore { @@ -63,7 +62,7 @@ private KeyStore loadKeyStore() { keyStore.load(new FileInputStream(KEYSTORE_LOCATION), KEYSTORE_PASSWORD.toCharArray()); } catch (Exception e) { logger.error("Error loading keystore", e); - throw new AiopsSecurityException("Unable to load keystore!", e); + throw new AissembleSecurityException("Unable to load keystore!", e); } return keyStore; @@ -76,7 +75,7 @@ private X509Certificate getCertificateFromKeyStore(KeyStore keyStore) { cert = (X509Certificate) keyStore.getCertificate(KEY_ALIAS); } catch (KeyStoreException e) { logger.error("Error getting certificate from keystore", e); - throw new AiopsSecurityException("Unable to get certificate from keystore!", e); + throw new AissembleSecurityException("Unable to get certificate from keystore!", e); } return cert; @@ -89,7 +88,7 @@ private Key getKeyFromKeyStore(KeyStore keyStore) { key = keyStore.getKey(KEY_ALIAS, KEYSTORE_PASSWORD.toCharArray()); } catch (UnrecoverableKeyException | KeyStoreException | NoSuchAlgorithmException e) { logger.error("Error getting key from keystore", e); - throw new AiopsSecurityException("Unable to get key from keystore!", e); + throw new AissembleSecurityException("Unable to get key from keystore!", e); } return key; diff --git a/extensions/extensions-security/extensions-authzforce/src/main/java/com/boozallen/aiops/security/authorization/AiopsKeycloakSecureTokenServiceClient.java b/extensions/extensions-security/extensions-authzforce/src/main/java/com/boozallen/aissemble/security/authorization/AissembleKeycloakSecureTokenServiceClient.java similarity index 88% rename from extensions/extensions-security/extensions-authzforce/src/main/java/com/boozallen/aiops/security/authorization/AiopsKeycloakSecureTokenServiceClient.java rename to extensions/extensions-security/extensions-authzforce/src/main/java/com/boozallen/aissemble/security/authorization/AissembleKeycloakSecureTokenServiceClient.java index a25c494f4..aaf5a7726 100644 --- a/extensions/extensions-security/extensions-authzforce/src/main/java/com/boozallen/aiops/security/authorization/AiopsKeycloakSecureTokenServiceClient.java +++ b/extensions/extensions-security/extensions-authzforce/src/main/java/com/boozallen/aissemble/security/authorization/AissembleKeycloakSecureTokenServiceClient.java @@ -1,4 +1,4 @@ -package com.boozallen.aiops.security.authorization; +package com.boozallen.aissemble.security.authorization; /*- * #%L @@ -10,8 +10,8 @@ * #L% */ -import com.boozallen.aiops.security.config.SecurityConfiguration; -import com.boozallen.aiops.security.exception.AiopsSecurityException; +import com.boozallen.aissemble.security.config.SecurityConfiguration; +import com.boozallen.aissemble.security.exception.AissembleSecurityException; import io.jsonwebtoken.Claims; import io.jsonwebtoken.Jws; @@ -27,9 +27,9 @@ /** * Client for authenticating via KeyCloak. */ -public class AiopsKeycloakSecureTokenServiceClient implements AiopsSecureTokenServiceClient { +public class AissembleKeycloakSecureTokenServiceClient implements AissembleSecureTokenServiceClient { - private static final Logger logger = LoggerFactory.getLogger(AiopsKeycloakSecureTokenServiceClient.class); + private static final Logger logger = LoggerFactory.getLogger(AissembleKeycloakSecureTokenServiceClient.class); private static final SecurityConfiguration configuration = KrauseningConfigFactory.create(SecurityConfiguration.class); @@ -54,7 +54,7 @@ public String authenticate(String username, String password) { } else { String error = "Authentication is enabled, but user is not authenticated!"; logger.error(error); - throw new AiopsSecurityException(error); + throw new AissembleSecurityException(error); } } else { // TODO: Once authentication and authorization are fully implemented we need to decide what to do if diff --git a/extensions/extensions-security/extensions-authzforce/src/main/java/com/boozallen/aiops/security/authorization/AiopsSecureTokenServiceClient.java b/extensions/extensions-security/extensions-authzforce/src/main/java/com/boozallen/aissemble/security/authorization/AissembleSecureTokenServiceClient.java similarity index 80% rename from extensions/extensions-security/extensions-authzforce/src/main/java/com/boozallen/aiops/security/authorization/AiopsSecureTokenServiceClient.java rename to extensions/extensions-security/extensions-authzforce/src/main/java/com/boozallen/aissemble/security/authorization/AissembleSecureTokenServiceClient.java index b3179f55f..372d4b6c7 100644 --- a/extensions/extensions-security/extensions-authzforce/src/main/java/com/boozallen/aiops/security/authorization/AiopsSecureTokenServiceClient.java +++ b/extensions/extensions-security/extensions-authzforce/src/main/java/com/boozallen/aissemble/security/authorization/AissembleSecureTokenServiceClient.java @@ -1,4 +1,4 @@ -package com.boozallen.aiops.security.authorization; +package com.boozallen.aissemble.security.authorization; /*- * #%L @@ -14,9 +14,9 @@ import io.jsonwebtoken.Jws; /** - * Interface for an AIOps token service client. + * Interface for an aissemble token service client. */ -public interface AiopsSecureTokenServiceClient { +public interface AissembleSecureTokenServiceClient { /** * Authenticates a user. diff --git a/extensions/extensions-security/extensions-authzforce/src/main/java/com/boozallen/aiops/security/authorization/AiopsSimpleSecureTokenServiceClient.java b/extensions/extensions-security/extensions-authzforce/src/main/java/com/boozallen/aissemble/security/authorization/AissembleSimpleSecureTokenServiceClient.java similarity index 76% rename from extensions/extensions-security/extensions-authzforce/src/main/java/com/boozallen/aiops/security/authorization/AiopsSimpleSecureTokenServiceClient.java rename to extensions/extensions-security/extensions-authzforce/src/main/java/com/boozallen/aissemble/security/authorization/AissembleSimpleSecureTokenServiceClient.java index a121630e3..923ce8555 100644 --- a/extensions/extensions-security/extensions-authzforce/src/main/java/com/boozallen/aiops/security/authorization/AiopsSimpleSecureTokenServiceClient.java +++ b/extensions/extensions-security/extensions-authzforce/src/main/java/com/boozallen/aissemble/security/authorization/AissembleSimpleSecureTokenServiceClient.java @@ -1,4 +1,4 @@ -package com.boozallen.aiops.security.authorization; +package com.boozallen.aissemble.security.authorization; /*- * #%L @@ -18,9 +18,9 @@ /** * Client for authenticating via a simple JWT token. */ -public class AiopsSimpleSecureTokenServiceClient implements AiopsSecureTokenServiceClient { +public class AissembleSimpleSecureTokenServiceClient implements AissembleSecureTokenServiceClient { - static final Logger logger = LoggerFactory.getLogger(AiopsSimpleSecureTokenServiceClient.class); + static final Logger logger = LoggerFactory.getLogger(AissembleSimpleSecureTokenServiceClient.class); /** * {@inheritDoc} diff --git a/extensions/extensions-security/extensions-authzforce/src/main/java/com/boozallen/aiops/security/authorization/JsonWebTokenUtil.java b/extensions/extensions-security/extensions-authzforce/src/main/java/com/boozallen/aissemble/security/authorization/JsonWebTokenUtil.java similarity index 83% rename from extensions/extensions-security/extensions-authzforce/src/main/java/com/boozallen/aiops/security/authorization/JsonWebTokenUtil.java rename to extensions/extensions-security/extensions-authzforce/src/main/java/com/boozallen/aissemble/security/authorization/JsonWebTokenUtil.java index bcf535991..71d985c39 100644 --- a/extensions/extensions-security/extensions-authzforce/src/main/java/com/boozallen/aiops/security/authorization/JsonWebTokenUtil.java +++ b/extensions/extensions-security/extensions-authzforce/src/main/java/com/boozallen/aissemble/security/authorization/JsonWebTokenUtil.java @@ -1,4 +1,4 @@ -package com.boozallen.aiops.security.authorization; +package com.boozallen.aissemble.security.authorization; /*- * #%L @@ -10,14 +10,14 @@ * #L% */ -import com.boozallen.aiops.security.authorization.policy.AttributeRequest; -import com.boozallen.aiops.security.authorization.policy.AttributeValue; -import com.boozallen.aiops.security.authorization.policy.ClaimType; -import com.boozallen.aiops.security.authorization.policy.PolicyRequest; -import com.boozallen.aiops.security.config.SecurityConfiguration; -import com.boozallen.aiops.security.authorization.policy.PolicyDecision; -import com.boozallen.aiops.security.authorization.policy.PolicyDecisionPoint; -import com.boozallen.aiops.security.authorization.policy.AiopsAttributeProvider; +import com.boozallen.aissemble.security.authorization.policy.AttributeRequest; +import com.boozallen.aissemble.security.authorization.policy.AttributeValue; +import com.boozallen.aissemble.security.authorization.policy.ClaimType; +import com.boozallen.aissemble.security.authorization.policy.PolicyRequest; +import com.boozallen.aissemble.security.config.SecurityConfiguration; +import com.boozallen.aissemble.security.authorization.policy.PolicyDecision; +import com.boozallen.aissemble.security.authorization.policy.PolicyDecisionPoint; +import com.boozallen.aissemble.security.authorization.policy.AissembleAttributeProvider; import io.jsonwebtoken.Claims; import io.jsonwebtoken.Jws; @@ -43,7 +43,7 @@ public final class JsonWebTokenUtil { private static final SecurityConfiguration config = KrauseningConfigFactory.create(SecurityConfiguration.class); private static final AissembleKeyStore keyStore = new AissembleKeyStore(); private static PolicyDecisionPoint pdp = PolicyDecisionPoint.getInstance(); - private static AiopsAttributeProvider attributeProvider = new AiopsAttributeProvider(); + private static AissembleAttributeProvider attributeProvider = new AissembleAttributeProvider(); private JsonWebTokenUtil() { } @@ -70,7 +70,7 @@ public static String createToken(String subject, String audience, Collection> foundAttributes = attributeProvider - .getAiopsAttributeByIdAndSubject(attributeClaim.getRequestedAttributeId(), subject); + .getAissembleAttributeByIdAndSubject(attributeClaim.getRequestedAttributeId(), subject); String attributeValue = null; if (foundAttributes != null) { attributeValue = foundAttributes.stream().map(AttributeValue::getValueAsString) diff --git a/extensions/extensions-security/extensions-authzforce/src/main/java/com/boozallen/aiops/security/authorization/models/AuthRequest.java b/extensions/extensions-security/extensions-authzforce/src/main/java/com/boozallen/aissemble/security/authorization/models/AuthRequest.java similarity index 91% rename from extensions/extensions-security/extensions-authzforce/src/main/java/com/boozallen/aiops/security/authorization/models/AuthRequest.java rename to extensions/extensions-security/extensions-authzforce/src/main/java/com/boozallen/aissemble/security/authorization/models/AuthRequest.java index 83091b2f0..12cfc2131 100644 --- a/extensions/extensions-security/extensions-authzforce/src/main/java/com/boozallen/aiops/security/authorization/models/AuthRequest.java +++ b/extensions/extensions-security/extensions-authzforce/src/main/java/com/boozallen/aissemble/security/authorization/models/AuthRequest.java @@ -1,4 +1,4 @@ -package com.boozallen.aiops.security.authorization.models; +package com.boozallen.aissemble.security.authorization.models; /*- * #%L diff --git a/extensions/extensions-security/extensions-authzforce/src/main/java/com/boozallen/aiops/security/authorization/models/PDPRequest.java b/extensions/extensions-security/extensions-authzforce/src/main/java/com/boozallen/aissemble/security/authorization/models/PDPRequest.java similarity index 93% rename from extensions/extensions-security/extensions-authzforce/src/main/java/com/boozallen/aiops/security/authorization/models/PDPRequest.java rename to extensions/extensions-security/extensions-authzforce/src/main/java/com/boozallen/aissemble/security/authorization/models/PDPRequest.java index f203a5a3b..2ab188b86 100644 --- a/extensions/extensions-security/extensions-authzforce/src/main/java/com/boozallen/aiops/security/authorization/models/PDPRequest.java +++ b/extensions/extensions-security/extensions-authzforce/src/main/java/com/boozallen/aissemble/security/authorization/models/PDPRequest.java @@ -1,4 +1,4 @@ -package com.boozallen.aiops.security.authorization.models; +package com.boozallen.aissemble.security.authorization.models; /*- * #%L diff --git a/extensions/extensions-security/extensions-authzforce/src/main/java/com/boozallen/aiops/security/authorization/policy/AiopsAttribute.java b/extensions/extensions-security/extensions-authzforce/src/main/java/com/boozallen/aissemble/security/authorization/policy/AissembleAttribute.java similarity index 93% rename from extensions/extensions-security/extensions-authzforce/src/main/java/com/boozallen/aiops/security/authorization/policy/AiopsAttribute.java rename to extensions/extensions-security/extensions-authzforce/src/main/java/com/boozallen/aissemble/security/authorization/policy/AissembleAttribute.java index 03afff5ad..2efb10df3 100644 --- a/extensions/extensions-security/extensions-authzforce/src/main/java/com/boozallen/aiops/security/authorization/policy/AiopsAttribute.java +++ b/extensions/extensions-security/extensions-authzforce/src/main/java/com/boozallen/aissemble/security/authorization/policy/AissembleAttribute.java @@ -1,4 +1,4 @@ -package com.boozallen.aiops.security.authorization.policy; +package com.boozallen.aissemble.security.authorization.policy; /*- * #%L @@ -15,7 +15,7 @@ /** * Represents the structure of an attribute for policy decision. */ -public class AiopsAttribute { +public class AissembleAttribute { private String id; diff --git a/extensions/extensions-security/extensions-authzforce/src/main/java/com/boozallen/aiops/security/authorization/policy/AiopsAttributePoint.java b/extensions/extensions-security/extensions-authzforce/src/main/java/com/boozallen/aissemble/security/authorization/policy/AissembleAttributePoint.java similarity index 80% rename from extensions/extensions-security/extensions-authzforce/src/main/java/com/boozallen/aiops/security/authorization/policy/AiopsAttributePoint.java rename to extensions/extensions-security/extensions-authzforce/src/main/java/com/boozallen/aissemble/security/authorization/policy/AissembleAttributePoint.java index d5af4809e..f939ad1e5 100644 --- a/extensions/extensions-security/extensions-authzforce/src/main/java/com/boozallen/aiops/security/authorization/policy/AiopsAttributePoint.java +++ b/extensions/extensions-security/extensions-authzforce/src/main/java/com/boozallen/aissemble/security/authorization/policy/AissembleAttributePoint.java @@ -1,4 +1,4 @@ -package com.boozallen.aiops.security.authorization.policy; +package com.boozallen.aissemble.security.authorization.policy; /*- * #%L @@ -14,8 +14,8 @@ /** * The interface that defines the contract for looking up attribute values. This can be a local or remote source. It - * should be specified in the aiops attribute definition json file for each attribute so that - * {@link AiopsAttributeProvider} can find the value for a specified attribute. + * should be specified in the aissemble attribute definition json file for each attribute so that + * {@link AissembleAttributeProvider} can find the value for a specified attribute. * * While any number of attributes can be used for lookups, almost all scenarios will revolve around look up * attributes for specific subjects. As such, the interface will focus on that until a demand signal arises for more @@ -23,7 +23,7 @@ * * Implementations MUST have a no-argument constructor. */ -public interface AiopsAttributePoint { +public interface AissembleAttributePoint { /** * Returns the valid for a specific attribute id. For our purposes, we will just use id along to determine the value diff --git a/extensions/extensions-security/extensions-authzforce/src/main/java/com/boozallen/aiops/security/authorization/policy/AiopsAttributeProvider.java b/extensions/extensions-security/extensions-authzforce/src/main/java/com/boozallen/aissemble/security/authorization/policy/AissembleAttributeProvider.java similarity index 79% rename from extensions/extensions-security/extensions-authzforce/src/main/java/com/boozallen/aiops/security/authorization/policy/AiopsAttributeProvider.java rename to extensions/extensions-security/extensions-authzforce/src/main/java/com/boozallen/aissemble/security/authorization/policy/AissembleAttributeProvider.java index fac84da7b..bd97a03ec 100644 --- a/extensions/extensions-security/extensions-authzforce/src/main/java/com/boozallen/aiops/security/authorization/policy/AiopsAttributeProvider.java +++ b/extensions/extensions-security/extensions-authzforce/src/main/java/com/boozallen/aissemble/security/authorization/policy/AissembleAttributeProvider.java @@ -1,4 +1,4 @@ -package com.boozallen.aiops.security.authorization.policy; +package com.boozallen.aissemble.security.authorization.policy; /*- * #%L @@ -10,23 +10,13 @@ * #L% */ -import java.io.File; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Optional; -import java.util.Set; -import java.util.concurrent.TimeUnit; - -import com.boozallen.aiops.security.config.SecurityConfiguration; -import com.github.boozallen.aissemble.authz.attribute._1.AiopsAttributeExtension; +import com.boozallen.aissemble.security.config.SecurityConfiguration; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.github.benmanes.caffeine.cache.Cache; +import com.github.benmanes.caffeine.cache.Caffeine; +import com.github.boozallen.aissemble.authz.attribute._1.AissembleAttributeExtension; +import oasis.names.tc.xacml._3_0.core.schema.wd_17.AttributeDesignatorType; import org.aeonbits.owner.KrauseningConfigFactory; import org.apache.commons.io.FileUtils; import org.apache.commons.lang3.RandomStringUtils; @@ -49,18 +39,26 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import com.fasterxml.jackson.core.type.TypeReference; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.github.benmanes.caffeine.cache.Cache; -import com.github.benmanes.caffeine.cache.Caffeine; - -import oasis.names.tc.xacml._3_0.core.schema.wd_17.AttributeDesignatorType; +import java.io.File; +import java.io.IOException; +import java.util.Collection; +import java.util.Collections; +import java.util.Iterator; +import java.util.Optional; +import java.util.List; +import java.util.Set; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Map.Entry; +import java.util.concurrent.TimeUnit; /** * Provides an Authzforce attribute provider that allows relatively easy configuration of various attributes for use in * the policy decision point. */ -public class AiopsAttributeProvider extends BaseNamedAttributeProvider { +public class AissembleAttributeProvider extends BaseNamedAttributeProvider { private static final String XML_SCHEMA_DATE = "http://www.w3.org/2001/XMLSchema#date"; @@ -74,18 +72,18 @@ public class AiopsAttributeProvider extends BaseNamedAttributeProvider { private static final String XML_SCHEMA_INTEGER = "http://www.w3.org/2001/XMLSchema#integer"; - private static final TypeReference> attributeListTypeReference = new TypeReference>() {}; + private static final TypeReference> attributeListTypeReference = new TypeReference>() {}; - private static final Logger logger = LoggerFactory.getLogger(AiopsAttributeProvider.class); + private static final Logger logger = LoggerFactory.getLogger(AissembleAttributeProvider.class); protected SecurityConfiguration config = KrauseningConfigFactory.create(SecurityConfiguration.class); protected Map supportedDesignatorTypes = new HashMap<>(); - protected Map, AiopsAttributePoint> pointClassToInstanceMap = new HashMap<>(); - protected Map idToAttributePointMap = new HashMap<>(); + protected Map, AissembleAttributePoint> pointClassToInstanceMap = new HashMap<>(); + protected Map idToAttributePointMap = new HashMap<>(); - private Cache>> attributeCache; + private Cache>> attributeCache; - private AiopsAttributeProvider(AiopsAttributeExtension conf) { + private AissembleAttributeProvider(AissembleAttributeExtension conf) { super(conf.getId()); loadAttributeConfiguration(); @@ -94,7 +92,7 @@ private AiopsAttributeProvider(AiopsAttributeExtension conf) { /** * Allows an instance to be created outside the PDP. */ - public AiopsAttributeProvider() { + public AissembleAttributeProvider() { super(RandomStringUtils.randomAlphabetic(10)); loadAttributeConfiguration(); @@ -121,16 +119,17 @@ public Set getProvidedAttributes() { */ @Override public AttributeBag get(AttributeFqn attributeGUID, Datatype attributeDatatype, - EvaluationContext context, Optional optionalEvaluationContext) throws IndeterminateEvaluationException { + EvaluationContext context, Optional optionalEvaluationContext) throws IndeterminateEvaluationException { + String id = attributeGUID.getId(); String subject = findSubjectInEnvironmentContext(context); // lookup the correct attribute point to use: Collection attributeCollection = new ArrayList<>(); - Collection> retrievedValues = getAiopsAttributeByIdAndSubject( + Collection> retrievedValues = getAissembleAttributeByIdAndSubject( id, subject); if (retrievedValues != null) { - for (com.boozallen.aiops.security.authorization.policy.AttributeValue retrievedValue : retrievedValues) { + for (com.boozallen.aissemble.security.authorization.policy.AttributeValue retrievedValue : retrievedValues) { SimpleValue simpleValue = convertRetrievedValueToXacmlFormat(attributeDatatype, id, subject, retrievedValue); @@ -156,7 +155,7 @@ public AttributeBag get(AttributeFqn attributeGU /** - * Returns a request for a simple, AIOps attribute by attribute id and subject. + * Returns a request for a simple, aissemble attribute by attribute id and subject. * * @param id * attribute id @@ -164,14 +163,14 @@ public AttributeBag get(AttributeFqn attributeGU * subject name * @return collection of attributes or null if none found */ - public Collection> getAiopsAttributeByIdAndSubject(String id, - String subject) { + public Collection> getAissembleAttributeByIdAndSubject(String id, + String subject) { final String cacheKey = subject + ':' + id; - Collection> retrievedValues; + Collection> retrievedValues; retrievedValues = attributeCache.getIfPresent(cacheKey); if (retrievedValues == null) { - AiopsAttributePoint attributePoint = idToAttributePointMap.get(id); + AissembleAttributePoint attributePoint = idToAttributePointMap.get(id); retrievedValues = attributePoint.getValueForAttribute(id, subject); attributeCache.put(cacheKey, retrievedValues); } @@ -181,7 +180,7 @@ public Collection SimpleValue convertRetrievedValueToXacmlFormat( Datatype attributeDatatype, String id, String subject, - com.boozallen.aiops.security.authorization.policy.AttributeValue retrievedValue) { + com.boozallen.aissemble.security.authorization.policy.AttributeValue retrievedValue) { SimpleValue simpleValue = null; if (retrievedValue != null) { switch (attributeDatatype.toString()) { @@ -228,18 +227,18 @@ protected String findSubjectInEnvironmentContext(final EvaluationContext context } /** - * {@link AiopsAttributeExtension} factory + * {@link AissembleAttributeExtension} factory * */ - public static class Factory extends CloseableNamedAttributeProvider.FactoryBuilder { + public static class Factory extends CloseableNamedAttributeProvider.FactoryBuilder { @Override - public Class getJaxbClass() { - return AiopsAttributeExtension.class; + public Class getJaxbClass() { + return AissembleAttributeExtension.class; } @Override - public DependencyAwareFactory getInstance(AiopsAttributeExtension conf, EnvironmentProperties envProperties) { + public DependencyAwareFactory getInstance(AissembleAttributeExtension conf, EnvironmentProperties envProperties) { return new DependencyAwareFactory() { @Override public Set getDependencies() { @@ -248,7 +247,7 @@ public Set getDependencies() { @Override public CloseableNamedAttributeProvider getInstance(AttributeValueFactoryRegistry var1, NamedAttributeProvider var2) { - return new AiopsAttributeProvider(conf); + return new AissembleAttributeProvider(conf); } }; } @@ -269,10 +268,10 @@ protected void loadAttributeConfiguration() { } for (File attributeDefintionFile : files) { - List attributes; + List attributes; try { attributes = mapper.readValue(attributeDefintionFile, attributeListTypeReference); - for (AiopsAttribute attribute : attributes) { + for (AissembleAttribute attribute : attributes) { addAttributeDefinition(attribute); } } catch (IOException e) { @@ -298,16 +297,16 @@ protected void loadAttributeConfiguration() { .expireAfterWrite(config.getAttributeCacheExpirationInMinutes(), TimeUnit.MINUTES).build(); } - protected void addAttributeDefinition(AiopsAttribute attribute) { + protected void addAttributeDefinition(AissembleAttribute attribute) { String id = attribute.getId(); - AttributeDesignatorType designatorType = AiopsAttributeUtils.translateAttributeToXacmlFormat(attribute); + AttributeDesignatorType designatorType = AissembleAttributeUtils.translateAttributeToXacmlFormat(attribute); AttributeDesignatorType existingDesignatorType = supportedDesignatorTypes.put(id, designatorType); - AiopsAttributePoint attributePoint = findAttributePointImplementation(attribute); + AissembleAttributePoint attributePoint = findAttributePointImplementation(attribute); idToAttributePointMap.put(id, attributePoint); - logger.info("Translated AIOps attribute definition '{}' into the fully qualified \n\t{}", id, designatorType); + logger.info("Translated aissemble attribute definition '{}' into the fully qualified \n\t{}", id, designatorType); if (existingDesignatorType != null) { logger.warn("Multiple attributes named '{}' exist! The last one in read will be used {}", id, @@ -315,8 +314,8 @@ protected void addAttributeDefinition(AiopsAttribute attribute) { } } - protected AiopsAttributePoint findAttributePointImplementation(AiopsAttribute attribute) { - AiopsAttributePoint attributePoint = null; + protected AissembleAttributePoint findAttributePointImplementation(AissembleAttribute attribute) { + AissembleAttributePoint attributePoint = null; String attributePointClassName = null; try { @@ -325,7 +324,7 @@ protected AiopsAttributePoint findAttributePointImplementation(AiopsAttribute at logger.error("No attribute point specified for attribute '{}'!", attribute.getId()); } else { - Class attributePointClass = (Class) Class + Class attributePointClass = (Class) Class .forName(attributePointClassName, false, Thread.currentThread().getContextClassLoader()); // reuse an existing instance if we have already encountered this class: diff --git a/extensions/extensions-security/extensions-authzforce/src/main/java/com/boozallen/aiops/security/authorization/policy/AiopsAttributeUtils.java b/extensions/extensions-security/extensions-authzforce/src/main/java/com/boozallen/aissemble/security/authorization/policy/AissembleAttributeUtils.java similarity index 79% rename from extensions/extensions-security/extensions-authzforce/src/main/java/com/boozallen/aiops/security/authorization/policy/AiopsAttributeUtils.java rename to extensions/extensions-security/extensions-authzforce/src/main/java/com/boozallen/aissemble/security/authorization/policy/AissembleAttributeUtils.java index c645cc856..825d24ff0 100644 --- a/extensions/extensions-security/extensions-authzforce/src/main/java/com/boozallen/aiops/security/authorization/policy/AiopsAttributeUtils.java +++ b/extensions/extensions-security/extensions-authzforce/src/main/java/com/boozallen/aissemble/security/authorization/policy/AissembleAttributeUtils.java @@ -1,4 +1,4 @@ -package com.boozallen.aiops.security.authorization.policy; +package com.boozallen.aissemble.security.authorization.policy; /*- * #%L @@ -10,7 +10,6 @@ * #L% */ -import com.boozallen.aiops.security.authorization.policy.AiopsAttribute; import org.ow2.authzforce.xacml.identifiers.XacmlAttributeCategory; import org.ow2.authzforce.xacml.identifiers.XacmlDatatypeId; import org.slf4j.Logger; @@ -21,21 +20,21 @@ /** * Utility methods for fetching attributes. */ -public final class AiopsAttributeUtils { - private static final Logger logger = LoggerFactory.getLogger(AiopsAttributeProvider.class); +public final class AissembleAttributeUtils { + private static final Logger logger = LoggerFactory.getLogger(AissembleAttributeUtils.class); - private AiopsAttributeUtils() { + private AissembleAttributeUtils() { // private constructor to prevent instantiation of all static class } /** - * Translates a Aiops attribute into the more complex, but standards-compliance XACML version. + * Translates a Aissemble attribute into the more complex, but standards-compliance XACML version. * * @param attribute - * aiops attribute + * aissemble attribute * @return XACML version of the attribute */ - public static AttributeDesignatorType translateAttributeToXacmlFormat(AiopsAttribute attribute) { + public static AttributeDesignatorType translateAttributeToXacmlFormat(AissembleAttribute attribute) { String category = attribute.getCategory(); String id = attribute.getId(); String type = attribute.getType(); @@ -48,10 +47,10 @@ public static AttributeDesignatorType translateAttributeToXacmlFormat(AiopsAttri } /** - * Transforms the shortened version of categories used to simplify things Aiops into their fulL XACML format. + * Transforms the shortened version of categories used to simplify things Aissemble into their fulL XACML format. * * @param category - * aiops category + * aissemble category * @return XACML category */ public static String getXacmlCategory(String category) { @@ -68,16 +67,16 @@ public static String getXacmlCategory(String category) { break; default: xacmlCategoy = category; - logger.warn("Unknown Aiops XACML category type '{}' - using value as is!", xacmlCategoy); + logger.warn("Unknown aissemble XACML category type '{}' - using value as is!", xacmlCategoy); } return xacmlCategoy; } /** - * Transforms the shortened version of types used to simplify things aiops into their fulL XACML format. + * Transforms the shortened version of types used to simplify things aissemble into their fulL XACML format. * * @param type - * aiops type + * aissemble type * @return XACML type */ public static String getXacmlType(String type) { @@ -105,7 +104,7 @@ public static String getXacmlType(String type) { break; default: xacmlType = type; - logger.warn("Unknown Aiops XAML attribute type '{}' - using value as is!", xacmlType); + logger.warn("Unknown aissemble XAML attribute type '{}' - using value as is!", xacmlType); } return xacmlType; diff --git a/extensions/extensions-security/extensions-authzforce/src/main/java/com/boozallen/aiops/security/authorization/policy/AttributeRequest.java b/extensions/extensions-security/extensions-authzforce/src/main/java/com/boozallen/aissemble/security/authorization/policy/AttributeRequest.java similarity index 84% rename from extensions/extensions-security/extensions-authzforce/src/main/java/com/boozallen/aiops/security/authorization/policy/AttributeRequest.java rename to extensions/extensions-security/extensions-authzforce/src/main/java/com/boozallen/aissemble/security/authorization/policy/AttributeRequest.java index a38a17e34..d74b874f7 100644 --- a/extensions/extensions-security/extensions-authzforce/src/main/java/com/boozallen/aiops/security/authorization/policy/AttributeRequest.java +++ b/extensions/extensions-security/extensions-authzforce/src/main/java/com/boozallen/aissemble/security/authorization/policy/AttributeRequest.java @@ -1,4 +1,4 @@ -package com.boozallen.aiops.security.authorization.policy; +package com.boozallen.aissemble.security.authorization.policy; /*- * #%L @@ -10,7 +10,7 @@ * #L% */ -import com.boozallen.aiops.security.authorization.AbstractAuthorizationRequest; +import com.boozallen.aissemble.security.authorization.AbstractAuthorizationRequest; /** * Represents a request for an attribute value to be returned for a claim. diff --git a/extensions/extensions-security/extensions-authzforce/src/main/java/com/boozallen/aiops/security/authorization/policy/AttributeValue.java b/extensions/extensions-security/extensions-authzforce/src/main/java/com/boozallen/aissemble/security/authorization/policy/AttributeValue.java similarity index 95% rename from extensions/extensions-security/extensions-authzforce/src/main/java/com/boozallen/aiops/security/authorization/policy/AttributeValue.java rename to extensions/extensions-security/extensions-authzforce/src/main/java/com/boozallen/aissemble/security/authorization/policy/AttributeValue.java index 8bf6f7ce6..b4e4ec6ce 100644 --- a/extensions/extensions-security/extensions-authzforce/src/main/java/com/boozallen/aiops/security/authorization/policy/AttributeValue.java +++ b/extensions/extensions-security/extensions-authzforce/src/main/java/com/boozallen/aissemble/security/authorization/policy/AttributeValue.java @@ -1,4 +1,4 @@ -package com.boozallen.aiops.security.authorization.policy; +package com.boozallen.aissemble.security.authorization.policy; /*- * #%L @@ -26,7 +26,7 @@ import org.ow2.authzforce.core.pdp.api.value.StringValue; /** - * Holds an attribute value returned via a {@link AiopsAttributeProvider}. + * Holds an attribute value returned via a {@link AissembleAttributeProvider}. */ public class AttributeValue { private String attributeId; diff --git a/extensions/extensions-security/extensions-authzforce/src/main/java/com/boozallen/aiops/security/authorization/policy/ClaimType.java b/extensions/extensions-security/extensions-authzforce/src/main/java/com/boozallen/aissemble/security/authorization/policy/ClaimType.java similarity index 82% rename from extensions/extensions-security/extensions-authzforce/src/main/java/com/boozallen/aiops/security/authorization/policy/ClaimType.java rename to extensions/extensions-security/extensions-authzforce/src/main/java/com/boozallen/aissemble/security/authorization/policy/ClaimType.java index 1d62a38f0..c12f10cbf 100644 --- a/extensions/extensions-security/extensions-authzforce/src/main/java/com/boozallen/aiops/security/authorization/policy/ClaimType.java +++ b/extensions/extensions-security/extensions-authzforce/src/main/java/com/boozallen/aissemble/security/authorization/policy/ClaimType.java @@ -1,4 +1,4 @@ -package com.boozallen.aiops.security.authorization.policy; +package com.boozallen.aissemble.security.authorization.policy; /*- * #%L diff --git a/extensions/extensions-security/extensions-authzforce/src/main/java/com/boozallen/aiops/security/authorization/policy/PolicyDecision.java b/extensions/extensions-security/extensions-authzforce/src/main/java/com/boozallen/aissemble/security/authorization/policy/PolicyDecision.java similarity index 88% rename from extensions/extensions-security/extensions-authzforce/src/main/java/com/boozallen/aiops/security/authorization/policy/PolicyDecision.java rename to extensions/extensions-security/extensions-authzforce/src/main/java/com/boozallen/aissemble/security/authorization/policy/PolicyDecision.java index 13c7cee0d..8c3f17c86 100644 --- a/extensions/extensions-security/extensions-authzforce/src/main/java/com/boozallen/aiops/security/authorization/policy/PolicyDecision.java +++ b/extensions/extensions-security/extensions-authzforce/src/main/java/com/boozallen/aissemble/security/authorization/policy/PolicyDecision.java @@ -1,4 +1,4 @@ -package com.boozallen.aiops.security.authorization.policy; +package com.boozallen.aissemble.security.authorization.policy; /*- * #%L diff --git a/extensions/extensions-security/extensions-authzforce/src/main/java/com/boozallen/aiops/security/authorization/policy/PolicyDecisionPoint.java b/extensions/extensions-security/extensions-authzforce/src/main/java/com/boozallen/aissemble/security/authorization/policy/PolicyDecisionPoint.java similarity index 97% rename from extensions/extensions-security/extensions-authzforce/src/main/java/com/boozallen/aiops/security/authorization/policy/PolicyDecisionPoint.java rename to extensions/extensions-security/extensions-authzforce/src/main/java/com/boozallen/aissemble/security/authorization/policy/PolicyDecisionPoint.java index 01de7c73f..9bda76514 100644 --- a/extensions/extensions-security/extensions-authzforce/src/main/java/com/boozallen/aiops/security/authorization/policy/PolicyDecisionPoint.java +++ b/extensions/extensions-security/extensions-authzforce/src/main/java/com/boozallen/aissemble/security/authorization/policy/PolicyDecisionPoint.java @@ -1,4 +1,4 @@ -package com.boozallen.aiops.security.authorization.policy; +package com.boozallen.aissemble.security.authorization.policy; /*- * #%L @@ -18,8 +18,8 @@ import java.util.Optional; import java.util.concurrent.TimeUnit; -import com.boozallen.aiops.security.config.SecurityConfiguration; -import com.boozallen.aiops.security.exception.UnrecoverableException; +import com.boozallen.aissemble.security.config.SecurityConfiguration; +import com.boozallen.aissemble.security.exception.UnrecoverableException; import org.aeonbits.owner.KrauseningConfigFactory; import org.ow2.authzforce.core.pdp.api.AttributeFqn; diff --git a/extensions/extensions-security/extensions-authzforce/src/main/java/com/boozallen/aiops/security/authorization/policy/PolicyRequest.java b/extensions/extensions-security/extensions-authzforce/src/main/java/com/boozallen/aissemble/security/authorization/policy/PolicyRequest.java similarity index 93% rename from extensions/extensions-security/extensions-authzforce/src/main/java/com/boozallen/aiops/security/authorization/policy/PolicyRequest.java rename to extensions/extensions-security/extensions-authzforce/src/main/java/com/boozallen/aissemble/security/authorization/policy/PolicyRequest.java index 5d5655960..f51e90aaf 100644 --- a/extensions/extensions-security/extensions-authzforce/src/main/java/com/boozallen/aiops/security/authorization/policy/PolicyRequest.java +++ b/extensions/extensions-security/extensions-authzforce/src/main/java/com/boozallen/aissemble/security/authorization/policy/PolicyRequest.java @@ -1,4 +1,4 @@ -package com.boozallen.aiops.security.authorization.policy; +package com.boozallen.aissemble.security.authorization.policy; /*- * #%L @@ -10,7 +10,7 @@ * #L% */ -import com.boozallen.aiops.security.authorization.AbstractAuthorizationRequest; +import com.boozallen.aissemble.security.authorization.AbstractAuthorizationRequest; import org.apache.commons.lang3.StringUtils; /** diff --git a/extensions/extensions-security/extensions-authzforce/src/main/java/com/boozallen/aiops/security/config/SecurityConfiguration.java b/extensions/extensions-security/extensions-authzforce/src/main/java/com/boozallen/aissemble/security/config/SecurityConfiguration.java similarity index 95% rename from extensions/extensions-security/extensions-authzforce/src/main/java/com/boozallen/aiops/security/config/SecurityConfiguration.java rename to extensions/extensions-security/extensions-authzforce/src/main/java/com/boozallen/aissemble/security/config/SecurityConfiguration.java index 9aae14fa0..b6c10a545 100644 --- a/extensions/extensions-security/extensions-authzforce/src/main/java/com/boozallen/aiops/security/config/SecurityConfiguration.java +++ b/extensions/extensions-security/extensions-authzforce/src/main/java/com/boozallen/aissemble/security/config/SecurityConfiguration.java @@ -1,4 +1,4 @@ -package com.boozallen.aiops.security.config; +package com.boozallen.aissemble.security.config; /*- * #%L @@ -12,7 +12,7 @@ import org.aeonbits.owner.KrauseningConfig; -@KrauseningConfig.KrauseningSources("aiops-security.properties") +@KrauseningConfig.KrauseningSources("aissemble-security.properties") public interface SecurityConfiguration extends KrauseningConfig { /** @@ -44,7 +44,7 @@ public interface SecurityConfiguration extends KrauseningConfig { * @return password */ @Key("authentication.realm") - @DefaultValue("aiops") + @DefaultValue("aissemble") String authenticationRealm(); /** @@ -52,7 +52,7 @@ public interface SecurityConfiguration extends KrauseningConfig { * @return password */ @Key("authentication.username") - @DefaultValue("aiops") + @DefaultValue("aissemble") String authenticationUsername(); /** @@ -60,7 +60,7 @@ public interface SecurityConfiguration extends KrauseningConfig { * @return password */ @Key("authentication.password") - @DefaultValue("aiops") + @DefaultValue("aissemble") String authenticationPassword(); /** @@ -68,7 +68,7 @@ public interface SecurityConfiguration extends KrauseningConfig { * @return password */ @Key("authentication.client.id") - @DefaultValue("aiops-login") + @DefaultValue("aissemble-login") String authenticationClientId(); /** diff --git a/extensions/extensions-security/extensions-authzforce/src/main/java/com/boozallen/aiops/security/exception/AiopsSecurityException.java b/extensions/extensions-security/extensions-authzforce/src/main/java/com/boozallen/aissemble/security/exception/AissembleSecurityException.java similarity index 54% rename from extensions/extensions-security/extensions-authzforce/src/main/java/com/boozallen/aiops/security/exception/AiopsSecurityException.java rename to extensions/extensions-security/extensions-authzforce/src/main/java/com/boozallen/aissemble/security/exception/AissembleSecurityException.java index c6451eec8..1d7334c0e 100644 --- a/extensions/extensions-security/extensions-authzforce/src/main/java/com/boozallen/aiops/security/exception/AiopsSecurityException.java +++ b/extensions/extensions-security/extensions-authzforce/src/main/java/com/boozallen/aissemble/security/exception/AissembleSecurityException.java @@ -1,4 +1,4 @@ -package com.boozallen.aiops.security.exception; +package com.boozallen.aissemble.security.exception; /*- * #%L @@ -11,25 +11,25 @@ */ /** - * Exception for AIOps security. + * Exception for aissemble security. */ -public class AiopsSecurityException extends RuntimeException { +public class AissembleSecurityException extends RuntimeException { private static final long serialVersionUID = -6355403160236679418L; - public AiopsSecurityException() { + public AissembleSecurityException() { super(); } - public AiopsSecurityException(String message, Throwable cause) { + public AissembleSecurityException(String message, Throwable cause) { super(message, cause); } - public AiopsSecurityException(String message) { + public AissembleSecurityException(String message) { super(message); } - public AiopsSecurityException(Throwable cause) { + public AissembleSecurityException(Throwable cause) { super(cause); } diff --git a/extensions/extensions-security/extensions-authzforce/src/main/java/com/boozallen/aiops/security/exception/UnrecoverableException.java b/extensions/extensions-security/extensions-authzforce/src/main/java/com/boozallen/aissemble/security/exception/UnrecoverableException.java similarity index 87% rename from extensions/extensions-security/extensions-authzforce/src/main/java/com/boozallen/aiops/security/exception/UnrecoverableException.java rename to extensions/extensions-security/extensions-authzforce/src/main/java/com/boozallen/aissemble/security/exception/UnrecoverableException.java index 514e94e2e..23ba280b7 100644 --- a/extensions/extensions-security/extensions-authzforce/src/main/java/com/boozallen/aiops/security/exception/UnrecoverableException.java +++ b/extensions/extensions-security/extensions-authzforce/src/main/java/com/boozallen/aissemble/security/exception/UnrecoverableException.java @@ -1,4 +1,4 @@ -package com.boozallen.aiops.security.exception; +package com.boozallen.aissemble.security.exception; /*- * #%L @@ -13,7 +13,7 @@ /** * An exception to denote cases from which there is no ability to recover. */ -public class UnrecoverableException extends AiopsSecurityException { +public class UnrecoverableException extends AissembleSecurityException { private static final long serialVersionUID = -4923273764539689604L; diff --git a/extensions/extensions-security/extensions-authzforce/src/main/resources/META-INF/services/org.ow2.authzforce.core.pdp.api.PdpExtension b/extensions/extensions-security/extensions-authzforce/src/main/resources/META-INF/services/org.ow2.authzforce.core.pdp.api.PdpExtension index 6e7ce457e..6c3f8d848 100644 --- a/extensions/extensions-security/extensions-authzforce/src/main/resources/META-INF/services/org.ow2.authzforce.core.pdp.api.PdpExtension +++ b/extensions/extensions-security/extensions-authzforce/src/main/resources/META-INF/services/org.ow2.authzforce.core.pdp.api.PdpExtension @@ -1 +1 @@ -com.boozallen.aiops.security.authorization.policy.AiopsAttributeProvider$Factory \ No newline at end of file +com.boozallen.aissemble.security.authorization.policy.AissembleAttributeProvider$Factory \ No newline at end of file diff --git a/extensions/extensions-security/extensions-authzforce/src/main/resources/krausening/base/aiops-security.properties b/extensions/extensions-security/extensions-authzforce/src/main/resources/krausening/base/aissemble-security.properties similarity index 89% rename from extensions/extensions-security/extensions-authzforce/src/main/resources/krausening/base/aiops-security.properties rename to extensions/extensions-security/extensions-authzforce/src/main/resources/krausening/base/aissemble-security.properties index eb28a1b7d..f5b39afda 100644 --- a/extensions/extensions-security/extensions-authzforce/src/main/resources/krausening/base/aiops-security.properties +++ b/extensions/extensions-security/extensions-authzforce/src/main/resources/krausening/base/aissemble-security.properties @@ -12,8 +12,8 @@ #authentication.enabled=true #authentication.client.secret=c2eee100-6c83-41d9-92af-edfd6fd05c82 #authentication.host=http://localhost:9980/auth -#authentication.realm=aiops -#authentication.username=aiops +#authentication.realm=aissemble +#authentication.username=aissemble #authentication.password=alice #authentication.client.id=backend-service #token.issuer=keycloak diff --git a/extensions/extensions-security/extensions-authzforce/src/test/java/com/boozallen/aiops/security/authorization/AttributeSteps.java b/extensions/extensions-security/extensions-authzforce/src/test/java/com/boozallen/aissemble/security/authorization/AttributeSteps.java similarity index 55% rename from extensions/extensions-security/extensions-authzforce/src/test/java/com/boozallen/aiops/security/authorization/AttributeSteps.java rename to extensions/extensions-security/extensions-authzforce/src/test/java/com/boozallen/aissemble/security/authorization/AttributeSteps.java index 73de35447..892e294c5 100644 --- a/extensions/extensions-security/extensions-authzforce/src/test/java/com/boozallen/aiops/security/authorization/AttributeSteps.java +++ b/extensions/extensions-security/extensions-authzforce/src/test/java/com/boozallen/aissemble/security/authorization/AttributeSteps.java @@ -1,4 +1,4 @@ -package com.boozallen.aiops.security.authorization; +package com.boozallen.aissemble.security.authorization; /*- * #%L @@ -10,8 +10,8 @@ * #L% */ -import com.boozallen.aiops.security.authorization.policy.AiopsAttribute; -import com.boozallen.aiops.security.authorization.policy.AiopsAttributeUtils; +import com.boozallen.aissemble.security.authorization.policy.AissembleAttribute; +import com.boozallen.aissemble.security.authorization.policy.AissembleAttributeUtils; import io.cucumber.java.Before; import io.cucumber.java.en.Given; import io.cucumber.java.en.Then; @@ -22,28 +22,28 @@ import static org.junit.Assert.assertEquals; public class AttributeSteps { - private AiopsAttribute aiopsAttribute; + private AissembleAttribute aissembleAttribute; private AttributeDesignatorType xacmlAttribute; @Before public void setUp() { - aiopsAttribute = null; + aissembleAttribute = null; xacmlAttribute = null; } - @Given("an attribute with aiops type {string}") - public void an_attribute_with_aiops_type(String aiopsType) { - aiopsAttribute = new AiopsAttribute(); - aiopsAttribute.setType(aiopsType); + @Given("an attribute with aissemble type {string}") + public void an_attribute_with_aissemble_type(String aissembleType) { + aissembleAttribute = new AissembleAttribute(); + aissembleAttribute.setType(aissembleType); - aiopsAttribute.setId(RandomStringUtils.randomAlphanumeric(10)); - aiopsAttribute.setCategory("action"); - aiopsAttribute.setRequired(false); + aissembleAttribute.setId(RandomStringUtils.randomAlphanumeric(10)); + aissembleAttribute.setCategory("action"); + aissembleAttribute.setRequired(false); } @When("the attribute is read") public void the_attribute_is_read() { - xacmlAttribute = AiopsAttributeUtils.translateAttributeToXacmlFormat(aiopsAttribute); + xacmlAttribute = AissembleAttributeUtils.translateAttributeToXacmlFormat(aissembleAttribute); } @Then("the fully qualified type {string} is returned") diff --git a/extensions/extensions-security/extensions-authzforce/src/test/java/com/boozallen/aiops/security/authorization/AuthorizationSteps.java b/extensions/extensions-security/extensions-authzforce/src/test/java/com/boozallen/aissemble/security/authorization/AuthorizationSteps.java similarity index 87% rename from extensions/extensions-security/extensions-authzforce/src/test/java/com/boozallen/aiops/security/authorization/AuthorizationSteps.java rename to extensions/extensions-security/extensions-authzforce/src/test/java/com/boozallen/aissemble/security/authorization/AuthorizationSteps.java index c9f13d0de..2ca9f3264 100644 --- a/extensions/extensions-security/extensions-authzforce/src/test/java/com/boozallen/aiops/security/authorization/AuthorizationSteps.java +++ b/extensions/extensions-security/extensions-authzforce/src/test/java/com/boozallen/aissemble/security/authorization/AuthorizationSteps.java @@ -1,4 +1,4 @@ -package com.boozallen.aiops.security.authorization; +package com.boozallen.aissemble.security.authorization; /*- * #%L @@ -12,8 +12,8 @@ import static org.junit.Assert.assertEquals; -import com.boozallen.aiops.security.authorization.policy.PolicyDecision; -import com.boozallen.aiops.security.authorization.policy.PolicyDecisionPoint; +import com.boozallen.aissemble.security.authorization.policy.PolicyDecision; +import com.boozallen.aissemble.security.authorization.policy.PolicyDecisionPoint; import io.cucumber.java.en.Given; import io.cucumber.java.en.Then; import io.cucumber.java.en.When; diff --git a/extensions/extensions-security/extensions-authzforce/src/test/java/com/boozallen/aiops/security/authorization/Configurer.java b/extensions/extensions-security/extensions-authzforce/src/test/java/com/boozallen/aissemble/security/authorization/Configurer.java similarity index 91% rename from extensions/extensions-security/extensions-authzforce/src/test/java/com/boozallen/aiops/security/authorization/Configurer.java rename to extensions/extensions-security/extensions-authzforce/src/test/java/com/boozallen/aissemble/security/authorization/Configurer.java index 72ff4c1ae..b7e06b071 100644 --- a/extensions/extensions-security/extensions-authzforce/src/test/java/com/boozallen/aiops/security/authorization/Configurer.java +++ b/extensions/extensions-security/extensions-authzforce/src/test/java/com/boozallen/aissemble/security/authorization/Configurer.java @@ -1,4 +1,4 @@ -package com.boozallen.aiops.security.authorization; +package com.boozallen.aissemble.security.authorization; /*- * #%L @@ -10,7 +10,7 @@ * #L% */ -import com.boozallen.aiops.security.authorization.policy.PolicyRequest; +import com.boozallen.aissemble.security.authorization.policy.PolicyRequest; import io.cucumber.core.api.TypeRegistry; import io.cucumber.core.api.TypeRegistryConfigurer; import io.cucumber.datatable.DataTableType; diff --git a/extensions/extensions-security/extensions-authzforce/src/test/java/com/boozallen/aiops/security/authorization/CucumberTest.java b/extensions/extensions-security/extensions-authzforce/src/test/java/com/boozallen/aissemble/security/authorization/CucumberTest.java similarity index 82% rename from extensions/extensions-security/extensions-authzforce/src/test/java/com/boozallen/aiops/security/authorization/CucumberTest.java rename to extensions/extensions-security/extensions-authzforce/src/test/java/com/boozallen/aissemble/security/authorization/CucumberTest.java index 7ad31946a..9b2bb62b7 100644 --- a/extensions/extensions-security/extensions-authzforce/src/test/java/com/boozallen/aiops/security/authorization/CucumberTest.java +++ b/extensions/extensions-security/extensions-authzforce/src/test/java/com/boozallen/aissemble/security/authorization/CucumberTest.java @@ -1,4 +1,4 @@ -package com.boozallen.aiops.security.authorization; +package com.boozallen.aissemble.security.authorization; /*- * #%L @@ -16,7 +16,7 @@ @RunWith(Cucumber.class) @CucumberOptions( - glue = "com.boozallen.aiops.security.authorization", + glue = "com.boozallen.aissemble.security.authorization", features = "src/test/resources/specifications", plugin = {"json:target/cucumber-reports/cucumber.json"}, tags = "not @manual") diff --git a/extensions/extensions-security/extensions-authzforce/src/test/java/com/boozallen/aiops/security/authorization/LocalAttributePoint.java b/extensions/extensions-security/extensions-authzforce/src/test/java/com/boozallen/aissemble/security/authorization/LocalAttributePoint.java similarity index 90% rename from extensions/extensions-security/extensions-authzforce/src/test/java/com/boozallen/aiops/security/authorization/LocalAttributePoint.java rename to extensions/extensions-security/extensions-authzforce/src/test/java/com/boozallen/aissemble/security/authorization/LocalAttributePoint.java index ce30a2084..d4b08e8ad 100644 --- a/extensions/extensions-security/extensions-authzforce/src/test/java/com/boozallen/aiops/security/authorization/LocalAttributePoint.java +++ b/extensions/extensions-security/extensions-authzforce/src/test/java/com/boozallen/aissemble/security/authorization/LocalAttributePoint.java @@ -1,4 +1,4 @@ -package com.boozallen.aiops.security.authorization; +package com.boozallen.aissemble.security.authorization; /*- * #%L @@ -10,8 +10,8 @@ * #L% */ -import com.boozallen.aiops.security.authorization.policy.AiopsAttributePoint; -import com.boozallen.aiops.security.authorization.policy.AttributeValue; +import com.boozallen.aissemble.security.authorization.policy.AissembleAttributePoint; +import com.boozallen.aissemble.security.authorization.policy.AttributeValue; import java.util.ArrayList; import java.util.Collection; @@ -20,22 +20,22 @@ /** * Test attribute point that just does some local logic to support test cases. */ -public class LocalAttributePoint implements AiopsAttributePoint { +public class LocalAttributePoint implements AissembleAttributePoint { @Override public Collection> getValueForAttribute(String attributeId, String subject) { Collection> values = null; - if ("urn:aiops:jerseyNumber".equals(attributeId)) { + if ("urn:aissemble:jerseyNumber".equals(attributeId)) { values = sourceJerseyNumberAttribute(attributeId, subject); - } else if ("urn:aiops:hallOfFameProfile".equals(attributeId)) { + } else if ("urn:aissemble:hallOfFameProfile".equals(attributeId)) { values = sourceHallOfFameProfileAttribute(attributeId, subject); - } else if ("urn:aiops:suspectedPedUser".equals(attributeId)) { + } else if ("urn:aissemble:suspectedPedUser".equals(attributeId)) { values = sourceSuspectedPedUserAttribute(attributeId, subject); - } else if ("urn:aiops:battingAverage".equals(attributeId)) { + } else if ("urn:aissemble:battingAverage".equals(attributeId)) { values = sourceBattingAverageAttribute(attributeId, subject); - } else if ("urn:aiops:serviceEntryDate".equals(attributeId)) { + } else if ("urn:aissemble:serviceEntryDate".equals(attributeId)) { values = sourceServiceEntryDateAttribute(attributeId, subject); - } else if ("urn:aiops:seasonsBattingOver350".equals(attributeId)) { + } else if ("urn:aissemble:seasonsBattingOver350".equals(attributeId)) { values = sourceSeasonsBattingOver350Attribute(attributeId, subject); } diff --git a/extensions/extensions-security/extensions-authzforce/src/test/java/com/boozallen/aiops/security/authorization/LocalPolicyRequest.java b/extensions/extensions-security/extensions-authzforce/src/test/java/com/boozallen/aissemble/security/authorization/LocalPolicyRequest.java similarity index 78% rename from extensions/extensions-security/extensions-authzforce/src/test/java/com/boozallen/aiops/security/authorization/LocalPolicyRequest.java rename to extensions/extensions-security/extensions-authzforce/src/test/java/com/boozallen/aissemble/security/authorization/LocalPolicyRequest.java index fa560b8b8..e57b17430 100644 --- a/extensions/extensions-security/extensions-authzforce/src/test/java/com/boozallen/aiops/security/authorization/LocalPolicyRequest.java +++ b/extensions/extensions-security/extensions-authzforce/src/test/java/com/boozallen/aissemble/security/authorization/LocalPolicyRequest.java @@ -1,4 +1,4 @@ -package com.boozallen.aiops.security.authorization; +package com.boozallen.aissemble.security.authorization; /*- * #%L @@ -10,7 +10,7 @@ * #L% */ -import com.boozallen.aiops.security.authorization.policy.PolicyRequest; +import com.boozallen.aissemble.security.authorization.policy.PolicyRequest; public class LocalPolicyRequest extends PolicyRequest { public LocalPolicyRequest() { diff --git a/extensions/extensions-security/extensions-authzforce/src/test/java/com/boozallen/aiops/security/authorization/TokenDataInput.java b/extensions/extensions-security/extensions-authzforce/src/test/java/com/boozallen/aissemble/security/authorization/TokenDataInput.java similarity index 88% rename from extensions/extensions-security/extensions-authzforce/src/test/java/com/boozallen/aiops/security/authorization/TokenDataInput.java rename to extensions/extensions-security/extensions-authzforce/src/test/java/com/boozallen/aissemble/security/authorization/TokenDataInput.java index 83082407f..80de6f1ee 100644 --- a/extensions/extensions-security/extensions-authzforce/src/test/java/com/boozallen/aiops/security/authorization/TokenDataInput.java +++ b/extensions/extensions-security/extensions-authzforce/src/test/java/com/boozallen/aissemble/security/authorization/TokenDataInput.java @@ -1,4 +1,4 @@ -package com.boozallen.aiops.security.authorization; +package com.boozallen.aissemble.security.authorization; /*- * #%L @@ -10,7 +10,7 @@ * #L% */ -import com.boozallen.aiops.security.authorization.policy.PolicyRequest; +import com.boozallen.aissemble.security.authorization.policy.PolicyRequest; public class TokenDataInput extends PolicyRequest { private String subject; diff --git a/extensions/extensions-security/extensions-authzforce/src/test/java/com/boozallen/aiops/security/authorization/TokenSteps.java b/extensions/extensions-security/extensions-authzforce/src/test/java/com/boozallen/aissemble/security/authorization/TokenSteps.java similarity index 95% rename from extensions/extensions-security/extensions-authzforce/src/test/java/com/boozallen/aiops/security/authorization/TokenSteps.java rename to extensions/extensions-security/extensions-authzforce/src/test/java/com/boozallen/aissemble/security/authorization/TokenSteps.java index 8a5c627be..83defd9c4 100644 --- a/extensions/extensions-security/extensions-authzforce/src/test/java/com/boozallen/aiops/security/authorization/TokenSteps.java +++ b/extensions/extensions-security/extensions-authzforce/src/test/java/com/boozallen/aissemble/security/authorization/TokenSteps.java @@ -1,4 +1,4 @@ -package com.boozallen.aiops.security.authorization; +package com.boozallen.aissemble.security.authorization; /*- * #%L @@ -10,8 +10,8 @@ * #L% */ -import com.boozallen.aiops.security.authorization.policy.AttributeRequest; -import com.boozallen.aiops.security.authorization.policy.PolicyRequest; +import com.boozallen.aissemble.security.authorization.policy.AttributeRequest; +import com.boozallen.aissemble.security.authorization.policy.PolicyRequest; import io.cucumber.java.After; import io.cucumber.java.en.Then; import io.cucumber.java.en.When; @@ -30,7 +30,7 @@ import static org.junit.Assert.assertTrue; public class TokenSteps { - private static final String ATTRIBUTE_ID_SEASONS_BATTING_OVER_350 = "urn:aiops:seasonsBattingOver350"; + private static final String ATTRIBUTE_ID_SEASONS_BATTING_OVER_350 = "urn:aissemble:seasonsBattingOver350"; private String token; private String subject; private String audience; diff --git a/extensions/extensions-security/extensions-authzforce/src/test/resources/authorization/attributes/test-attributes.json b/extensions/extensions-security/extensions-authzforce/src/test/resources/authorization/attributes/test-attributes.json index 5b25cb348..9bd47368f 100644 --- a/extensions/extensions-security/extensions-authzforce/src/test/resources/authorization/attributes/test-attributes.json +++ b/extensions/extensions-security/extensions-authzforce/src/test/resources/authorization/attributes/test-attributes.json @@ -1,51 +1,51 @@ [ { - "id": "urn:aiops:jerseyNumber", + "id": "urn:aissemble:jerseyNumber", "category": "subject", "type": "int", "required": "true", - "attributePointClass": "com.boozallen.aiops.security.authorization.LocalAttributePoint " + "attributePointClass": "com.boozallen.aissemble.security.authorization.LocalAttributePoint " }, { - "id": "urn:aiops:hallOfFameProfile", + "id": "urn:aissemble:hallOfFameProfile", "category": "subject", "type": "uri", "required": "false", - "attributePointClass": "com.boozallen.aiops.security.authorization.LocalAttributePoint" + "attributePointClass": "com.boozallen.aissemble.security.authorization.LocalAttributePoint" }, { - "id": "urn:aiops:suspectedPedUser", + "id": "urn:aissemble:suspectedPedUser", "category": "subject", "type": "boolean", "required": "false", - "attributePointClass": "com.boozallen.aiops.security.authorization.LocalAttributePoint" + "attributePointClass": "com.boozallen.aissemble.security.authorization.LocalAttributePoint" }, { - "id": "urn:aiops:battingAverage", + "id": "urn:aissemble:battingAverage", "category": "subject", "type": "double", "required": "true", - "attributePointClass": "com.boozallen.aiops.security.authorization.LocalAttributePoint" + "attributePointClass": "com.boozallen.aissemble.security.authorization.LocalAttributePoint" }, { - "id": "urn:aiops:serviceEntryDate", + "id": "urn:aissemble:serviceEntryDate", "category": "subject", "type": "date", "required": "true", - "attributePointClass": "com.boozallen.aiops.security.authorization.LocalAttributePoint" + "attributePointClass": "com.boozallen.aissemble.security.authorization.LocalAttributePoint" }, { - "id": " urn:aiops:trimClassNameTest", + "id": " urn:aissemble:trimClassNameTest", "category": "subject ", "type": " date", "required": "true ", - "attributePointClass": " com.boozallen.aiops.security.authorization.LocalAttributePoint " + "attributePointClass": " com.boozallen.aissemble.security.authorization.LocalAttributePoint " }, { - "id": "urn:aiops:seasonsBattingOver350", + "id": "urn:aissemble:seasonsBattingOver350", "category":"subject", "type": "integer", "required": "false", - "attributePointClass": "com.boozallen.aiops.security.authorization.LocalAttributePoint" + "attributePointClass": "com.boozallen.aissemble.security.authorization.LocalAttributePoint" } ] \ No newline at end of file diff --git a/extensions/extensions-security/extensions-authzforce/src/test/resources/authorization/pdp.xml b/extensions/extensions-security/extensions-authzforce/src/test/resources/authorization/pdp.xml index e4bb2bef3..145a78015 100644 --- a/extensions/extensions-security/extensions-authzforce/src/test/resources/authorization/pdp.xml +++ b/extensions/extensions-security/extensions-authzforce/src/test/resources/authorization/pdp.xml @@ -15,7 +15,7 @@ xmlns:ext="http://github.com/boozallen/aissemble/authz/attribute/1" xmlns:xacml="urn:oasis:names:tc:xacml:3.0:core:schema:wd-17" version="8.1"> - + diff --git a/extensions/extensions-security/extensions-authzforce/src/test/resources/authorization/policies/test-policy.xml b/extensions/extensions-security/extensions-authzforce/src/test/resources/authorization/policies/test-policy.xml index 54e998655..a3aebf062 100644 --- a/extensions/extensions-security/extensions-authzforce/src/test/resources/authorization/policies/test-policy.xml +++ b/extensions/extensions-security/extensions-authzforce/src/test/resources/authorization/policies/test-policy.xml @@ -14,7 +14,7 @@ PolicyId="urn:oasis:names:tc:xacml:2.0:unit-test:policy" RuleCombiningAlgId="urn:oasis:names:tc:xacml:3.0:rule-combining-algorithm:deny-overrides" Version="1.0"> - Policies for Aiops authorization testing + Policies for Aissemble authorization testing @@ -183,7 +183,7 @@ @@ -222,7 +222,7 @@ @@ -255,7 +255,7 @@ @@ -290,7 +290,7 @@ @@ -325,7 +325,7 @@ @@ -360,7 +360,7 @@ @@ -395,7 +395,7 @@ @@ -430,7 +430,7 @@ @@ -509,7 +509,7 @@ 1984 diff --git a/extensions/extensions-security/extensions-authzforce/src/test/resources/krausening/base/aiops-security.properties b/extensions/extensions-security/extensions-authzforce/src/test/resources/krausening/base/aissemble-security.properties similarity index 100% rename from extensions/extensions-security/extensions-authzforce/src/test/resources/krausening/base/aiops-security.properties rename to extensions/extensions-security/extensions-authzforce/src/test/resources/krausening/base/aissemble-security.properties diff --git a/extensions/extensions-security/extensions-authzforce/src/test/resources/specifications/attribute-provider.feature b/extensions/extensions-security/extensions-authzforce/src/test/resources/specifications/attribute-provider.feature index b7f93ba72..65a97e29d 100644 --- a/extensions/extensions-security/extensions-authzforce/src/test/resources/specifications/attribute-provider.feature +++ b/extensions/extensions-security/extensions-authzforce/src/test/resources/specifications/attribute-provider.feature @@ -2,12 +2,12 @@ Feature: Specify custom attributes Scenario Outline: specify attributes with shorthand types - Given an attribute with aiops type "" + Given an attribute with aissemble type "" When the attribute is read Then the fully qualified type "" is returned Examples: - | aiopsType | fullyQualifiedType | + | aissembleType | fullyQualifiedType | | string | http://www.w3.org/2001/XMLSchema#string | | boolean | http://www.w3.org/2001/XMLSchema#boolean | | anyUri | http://www.w3.org/2001/XMLSchema#anyURI | diff --git a/extensions/extensions-security/extensions-authzforce/src/test/resources/specifications/token-creation.feature b/extensions/extensions-security/extensions-authzforce/src/test/resources/specifications/token-creation.feature index 825bef92b..beb2e4f8c 100644 --- a/extensions/extensions-security/extensions-authzforce/src/test/resources/specifications/token-creation.feature +++ b/extensions/extensions-security/extensions-authzforce/src/test/resources/specifications/token-creation.feature @@ -5,21 +5,21 @@ Feature: Create JSON Web Tokens based on PDP rules When a token is requested for "" and "" Then the token contains claims for "", "", and "" - Examples: - | subject | audience | issuer | - | tonyGwynn | petco park fans | CN=aiops.bah, OU=bah, O=bah, L=DC, ST=DC, C=US | - | trevorHoffman | fans that stuck it out to the end of the game | CN=aiops.bah, OU=bah, O=bah, L=DC, ST=DC, C=US | + Examples: + | subject | audience | issuer | + | tonyGwynn | petco park fans | CN=aissemble, OU=boozallen, O=boozallen, L=DC, ST=DC, C=US | + | trevorHoffman | fans that stuck it out to the end of the game | CN=aissemble, OU=boozallen, O=boozallen, L=DC, ST=DC, C=US | Scenario: create a token with PDP rule claims When a token is requested for "tonyGwynn" and "unitTest" And the following claims: - | name | resource | action | - | canSingle | hit/single | | - | canStrikeout | | strikeout | + | name | resource | action | + | canSingle | hit/single | | + | canStrikeout | | strikeout | Then a claim is returned with the following rule and decision pairings: - | name | resource | action | result | - | canSingle | hit/single | | PERMIT | - | canStrikeout | | strikeout | DENY | + | name | resource | action | result | + | canSingle | hit/single | | PERMIT | + | canStrikeout | | strikeout | DENY | Scenario Outline: create token with Attribute Store values When a token is requested for "" with an attribute value claim for seasons batting over .350 @@ -29,5 +29,5 @@ Feature: Create JSON Web Tokens based on PDP rules | player | seasonsBattingOver350 | | tonyGwynn | 1984, 1987, 1993, 1994, 1995, 1996, 1997 | | reggieJackson | | - | kirbyPuckett | 1988 | + | kirbyPuckett | 1988 | diff --git a/extensions/extensions-security/extensions-authzforce/src/test/resources/truststore/aissemble-secure.jks b/extensions/extensions-security/extensions-authzforce/src/test/resources/truststore/aissemble-secure.jks index 263cbc79bcea5eeaef6d1d3253778869d66f33c9..c5aa6aadd25b279f41103ded2daa3b9beaf5933d 100644 GIT binary patch delta 2066 zcmbu&dpOez1Hkd$ZfcUuagBzSu!RveF>)zUn)0|!wK6+lbH6pwuO@SQPA(fsb3MgT zuF2xK7GYv?>7uQY+;WLTup=+4;q?5Op0Ssz4U<-3`@VV2;LihGf z+w=rVg-w%ic`|ss_-dM*yB`?sqKa&fk8~cKaT`+UZE-NGvg0?kh30y@=TJt`R+wVw zb&XnOusDCEdqyt)-qdM?d~j@#Z4jn2x3s;>O1(R8M7^W_vi#4syRu$r;Hqp|J8xkA z<=G3Ly?$%?&P_n(d*#69x5b3SS=0}8f0^y~m1aVkW)r!JbFz1xdbOIZ9_F2O)zU)v zwtSgQJ%m-S*K*uyeWRo{o@9*TeM6WTxY@r0F$Xz+;r6Kv5R9YD4qmAW^_A0@7 zQ>BZ#F**>UYDup@;_PgK`*!*S!?2-i0)#x|3GQ4Ahz--#4X#@eK2!9POkO|wOX3Df zMyx{B>x=Shd|iTv+8qMI`81!@#w6zwz~B_MiZj(CRD<1=;I^UR*Opzj7-(Ucsa-32 zUt&P}O~i2w89to%18~i&q!$_u3RxeUR&lilIPXd`hU^esMOK9+xBZM7uSbl1!RdXn zw1`1?uh@h8uwsq{`;34qgOiogro;T7D_mk`P%tJEXxUxx?bJQYa*7s7QGhH53nve zA__|D22=EIzJjmpqD~;ogJ;wzpe`ZS>J(O6O?ogb(C-k_9V}%9>3f16D8`&-xcwJV z_Smq%UopY~5``>P|I)RwPR$_8VW|_4|*M8pH8eJ-; z7L1zCzU5W8dJ=+KlSPLQ?kcHQrucx*D5<_;0oXMOSyivsnd(@J3!~6 ztWt~Sa1cetV5{dFsFa2wP2?l@hAFqzODA#~T`Fx{j`1&oH)H2M4k#!(uVIa=D9s`# zhY3R3!fD0UB6sP2>-X&@kH6DiH5_MHk{*|tB04M|Z;~S~g-?S`bAJqXaQ`?$H5@wa zb$MejA=}tL(OXaHZSJLmRdQ17!#+AuQ8^cMal4TO$H+zItY7WP?s6@mWd`}7Q=UxpQ;c$UKv0|!(;kSf5+dHuQ8&9WzX70{IBs_1$;t3!Y7 zKHe9Y^uMbWx))1ILJafBJ5ZI$dxvR&x#tKiqc%V5ra~vo2&wcjHvqpYWKj?3Ogs;7 z@Y9K@Iy}eNm^rB8pIXzemedmRhK_u6yXOeZoG2^Pw(Nw7h)|R5zLoz})#XBTW#n9) zr$aNlbHDvs)}hK+&-iq!vAWqpIv)T42!QZ3FvXh#0PHxP4YS3wq1Zwg6at09f6uar z!0(nqVmT)`tGgkPT?hbA<5Cg2=jHKoQZP5Tv<%WGI5_4KlSvOU`qy^-4}-}dFZqXu z(*u2&bUa#lx3LMHU}S1!iYFd6qx>fcMtEc5zxm&T#s6{O8cJz_ca5jXJZFUG>~t1S zF_7Ny0@cHN;fCHf*nyVoF}MEa|E@s(Qwg#%gsnYS^OmN~I8&C#s;n*Tj6~{{GmdKU zu?kVElHSsBi-&ME4wBx3zrnt74aui3=vCgTz+{rb^29$Uk_wq9zH6+&V=$7t`Uosq^K3{%KNvWn@yHuGdzH1e$2D!YYS4|KhsrPzBSKcH)wk-{jvHF87I^ zY03m<+~SSgA&E7j{?=%+p8P6?wQDlwML*Z&`}q;T-I{Td$@U%n(%h;)1LuQy>HeCN6Z}G+75mSu zmldSm3DU2ZA~4$b78l9wRx-P)13%MUAK2rNsW&~PeqzWvc69k04%&NVojE@g;ca6m z4cCZcZum@&q)_#lOCyeAoxdK85;52AESoz@k4jy3=i6&6_9y0PQI1*6SMO`gY#@8& zyrPlWF~?GT-&tmB`2@%sI7c-e7m1^-3dpCN(q{=GC0nL?V%V{Varo7oGdl{4o$TE8 I#y(8^11U$irT_o{ delta 2062 zcmb8sYdjN-0tWEiqnRWT<&sO}l1)vBk;^-`j3W1K=9ZUCStQz6#EFqha*tGGYjPV) zcvpz+Wx01!jT}M}UdMGf=l#9!r}OQ6{QsWk_k4LC9Ndw)uTCR+k8A+|P!N(1*+ojj z_Uplb5TGvTAP@)zK*xUksrvk`D1{l#LLuw|PrG`Q5d270TXi*Bh|ZT+d^b-P zy34p){O>L4y&*mkFy+FQegto!mBX7LOHv9NOy(MsB&)5P7@WtKO zKmBW9AA9Xq?Q=7V=D9<)3k-n$+*k|HRL5dq$^2(-(`Oc+a83>PT7;u`U>vqv>Vu9< zahN)I{JO!sL{l%P@n`%uF2#4oQrmoY8NDFX%-m*JH+o;q>5WOo#Mk<%EyWbuEQf(; zWQ){jPAzW*!_otZp3%RnGphZ%XC*sBk8z7k@o8~dIclLwJEkp@vQDliwbEfe%@3sy z|Bw=GtM+eYV6i3!6Fa}~@~Ve(W$Yg8=e?S~w{CCgez>-f-9b5kN>S;1b-|1>1;#^0 z5S$MEpP>Ywcb-w-!Ld~yH;hlTUVlTI^Zr=KN9$T&BSe3|b*$iN2doQNCrnBmuhFqN z-g_5vRvLU~M?3YSY*$GQu`p%Oj#{6}>#H~z%C3Ev`E6`D_8vN0m_8;k5_VSDOtwN#%z>V6S-49r_R^ZSMP59*D&U~Kzh z%-EJKy8`+iFb}hl>eLD&VAM|`FD}%4@&t~|4sIExRcAD0_l^V-Za5OPCALcq`5G3|VMB^(2_n5a=tSDhqp>8H^0|G#LA)?*h?{I_?j_aj2rDl8 z_&E|O44yJ^-XZ9X)rkH@w%|_N_2qK`HXv?x@T_eGvl}H=P*u6_J6*hMMR30&bNhTj zSbxN*o82BpJw+Jz_^f`&am?_%KiqRBk)l-@S(rD(l_Afk(4Ll?SMlU%Orac9Se{9G zI#IJV>~$~23B849@}%M7PfST0Rw7rbxwelSbUS5St@Q>bZgAMF-~B=Rd9JD>zmv*J za0X+w0$XqUes)o6&%QWNoT=&4!tfS#=@7-G!49r#e#zs7JK=TXopsZ`%_zeS&lN+X zEllyYRT9<+Z9Ln46r69f`|X;%&6;jmIx7JH0003{uTyBGDF6UIg`|UZk#vwOND{E& zeBdJJyJj5{0h83dYkzkg0R+OK0HkLw0jlFBh1?GVdqDO}fk^>ZP=5>lmt>JLe`a7Q z$$&6&RP?F;HjpX`2qP5I7-ftyMVg?{J_?A_fAY-V{A<Qw2{KSG)P!mCVrnmFp=P3Sc^5Vx|5A0rxe!vZ>NBZGj zU%C1i+kIu@3H)F2;U^4QQU@R5nl0aNj=+2La1KHEy8cRF60JWP1O@_t|8o<^ zbO-16L81%uHv@PE{&Fki$#3#soE%~%*$<1_j9+V4wZ6a1Y_2Qc43PC?n6In4HB=NR zt^=Q@s6dBi+=!vGmo-b``(s?alCy~|>`Hp&BIikVU}Nq2@shToz(@Ud&N%? zH6aGzwM;60Uls0XA6V}!N^v`S&93-O#B}0&Xs-zgt3Ob7c=%+M^oOX>_sED!e0*EH SU^J(l`U8_T(jjBg@A@BhbG#)0 diff --git a/extensions/extensions-security/extensions-policy-decision-point-service/src/main/java/com/boozallen/aissemble/security/LocalAttributePoint.java b/extensions/extensions-security/extensions-policy-decision-point-service/src/main/java/com/boozallen/aissemble/security/LocalAttributePoint.java index 54ad22071..08b90ec29 100644 --- a/extensions/extensions-security/extensions-policy-decision-point-service/src/main/java/com/boozallen/aissemble/security/LocalAttributePoint.java +++ b/extensions/extensions-security/extensions-policy-decision-point-service/src/main/java/com/boozallen/aissemble/security/LocalAttributePoint.java @@ -10,8 +10,8 @@ * #L% */ -import com.boozallen.aiops.security.authorization.policy.AiopsAttributePoint; -import com.boozallen.aiops.security.authorization.policy.AttributeValue; +import com.boozallen.aissemble.security.authorization.policy.AissembleAttributePoint; +import com.boozallen.aissemble.security.authorization.policy.AttributeValue; import java.util.ArrayList; import java.util.Collection; @@ -20,12 +20,12 @@ * Place holder attribute point that just does some local logic to support authorization demonstration. * This can be replaced with an actual attribute provider. */ -public class LocalAttributePoint implements AiopsAttributePoint { +public class LocalAttributePoint implements AissembleAttributePoint { @Override public Collection> getValueForAttribute(String attributeId, String subject) { Collection> values = null; - if ("urn:aiops:accessData".equals(attributeId)) { + if ("urn:aissemble:accessData".equals(attributeId)) { values = sourceDataAccess(attributeId, subject); } @@ -35,7 +35,7 @@ public Collection> getValueForAttribute(String attributeId, St protected Collection> sourceDataAccess(String attributeId, String subject) { AttributeValue value = null; - if ("aiops".equals(subject)) { + if ("aissemble".equals(subject)) { value = new AttributeValue(attributeId, true); } else { value = new AttributeValue(attributeId, false); diff --git a/extensions/extensions-security/extensions-policy-decision-point-service/src/main/java/com/boozallen/aissemble/security/PDPHelperResource.java b/extensions/extensions-security/extensions-policy-decision-point-service/src/main/java/com/boozallen/aissemble/security/PDPHelperResource.java index 05a903b56..1c4f561f5 100644 --- a/extensions/extensions-security/extensions-policy-decision-point-service/src/main/java/com/boozallen/aissemble/security/PDPHelperResource.java +++ b/extensions/extensions-security/extensions-policy-decision-point-service/src/main/java/com/boozallen/aissemble/security/PDPHelperResource.java @@ -10,15 +10,15 @@ * #L% */ -import com.boozallen.aiops.security.authorization.models.AuthRequest; -import com.boozallen.aiops.security.authorization.models.PDPRequest; -import com.boozallen.aiops.security.authorization.policy.PolicyDecision; +import com.boozallen.aissemble.security.authorization.models.AuthRequest; +import com.boozallen.aissemble.security.authorization.models.PDPRequest; +import com.boozallen.aissemble.security.authorization.policy.PolicyDecision; import io.jsonwebtoken.Claims; import io.jsonwebtoken.Jws; -import com.boozallen.aiops.security.authorization.AiopsSecureTokenServiceClient; -import com.boozallen.aiops.security.authorization.AiopsSimpleSecureTokenServiceClient; -import com.boozallen.aiops.security.authorization.policy.PolicyDecisionPoint; +import com.boozallen.aissemble.security.authorization.AissembleSecureTokenServiceClient; +import com.boozallen.aissemble.security.authorization.AissembleSimpleSecureTokenServiceClient; +import com.boozallen.aissemble.security.authorization.policy.PolicyDecisionPoint; import javax.ws.rs.Consumes; import javax.ws.rs.GET; @@ -29,7 +29,7 @@ @Path("/api") public class PDPHelperResource { - private AiopsSecureTokenServiceClient tokenClient = new AiopsSimpleSecureTokenServiceClient(); + private AissembleSecureTokenServiceClient tokenClient = new AissembleSimpleSecureTokenServiceClient(); private PolicyDecisionPoint pdp = PolicyDecisionPoint.getInstance(); /** @@ -61,8 +61,8 @@ public String getPdpDecision(PDPRequest pdpRequest) { @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.TEXT_PLAIN) public String authenticate(AuthRequest authRequest) { - AiopsSecureTokenServiceClient aiopsSecureTokenServiceClient = new AiopsSimpleSecureTokenServiceClient(); - String jwt = aiopsSecureTokenServiceClient.authenticate(authRequest.getUsername(), authRequest.getPassword()); + AissembleSecureTokenServiceClient aissembleSecureTokenServiceClient = new AissembleSimpleSecureTokenServiceClient(); + String jwt = aissembleSecureTokenServiceClient.authenticate(authRequest.getUsername(), authRequest.getPassword()); return jwt; } diff --git a/foundation/foundation-data-access/src/main/java/com/boozallen/aissemble/data/access/security/DataAccessRolesAugmentor.java b/foundation/foundation-data-access/src/main/java/com/boozallen/aissemble/data/access/security/DataAccessRolesAugmentor.java index ae892a87b..89a07e9f8 100644 --- a/foundation/foundation-data-access/src/main/java/com/boozallen/aissemble/data/access/security/DataAccessRolesAugmentor.java +++ b/foundation/foundation-data-access/src/main/java/com/boozallen/aissemble/data/access/security/DataAccessRolesAugmentor.java @@ -15,8 +15,8 @@ import javax.enterprise.context.ApplicationScoped; -import com.boozallen.aiops.security.authorization.policy.PolicyDecision; -import com.boozallen.aiops.security.authorization.policy.PolicyDecisionPoint; +import com.boozallen.aissemble.security.authorization.policy.PolicyDecision; +import com.boozallen.aissemble.security.authorization.policy.PolicyDecisionPoint; import io.quarkus.security.identity.AuthenticationRequestContext; import io.quarkus.security.identity.SecurityIdentity; diff --git a/foundation/foundation-mda/src/main/resources/templates/data-delivery-spark/synchronous.processor.base.java.vm b/foundation/foundation-mda/src/main/resources/templates/data-delivery-spark/synchronous.processor.base.java.vm index 8b2150b4f..9c607a61f 100644 --- a/foundation/foundation-mda/src/main/resources/templates/data-delivery-spark/synchronous.processor.base.java.vm +++ b/foundation/foundation-mda/src/main/resources/templates/data-delivery-spark/synchronous.processor.base.java.vm @@ -62,12 +62,12 @@ import com.boozallen.aissemble.data.lineage.util.LineageUtil.LineageEventData; import static com.boozallen.aissemble.data.lineage.util.LineageUtil.recordLineage; import io.openlineage.client.OpenLineage.ParentRunFacet; #end -import com.boozallen.aiops.security.client.PolicyDecisionPointClient; -import com.boozallen.aiops.security.authorization.policy.PolicyDecision; +import com.boozallen.aissemble.security.client.PolicyDecisionPointClient; +import com.boozallen.aissemble.security.authorization.policy.PolicyDecision; import com.boozallen.aissemble.data.encryption.policy.EncryptionPolicy; import com.boozallen.aissemble.data.encryption.policy.EncryptionPolicyManager; -import com.boozallen.aiops.security.exception.AiopsSecurityException; -import com.boozallen.aiops.security.authorization.models.PDPRequest; +import com.boozallen.aissemble.security.exception.AissembleSecurityException; +import com.boozallen.aissemble.security.authorization.models.PDPRequest; import com.boozallen.aissemble.data.encryption.AiopsEncrypt; import com.boozallen.aissemble.data.encryption.SimpleAesEncrypt; import com.boozallen.aissemble.data.encryption.VaultEncrypt; diff --git a/foundation/foundation-security/foundation-pdp-client-java/src/main/java/com/boozallen/aiops/security/client/PolicyDecisionPointClient.java b/foundation/foundation-security/foundation-pdp-client-java/src/main/java/com/boozallen/aissemble/security/client/PolicyDecisionPointClient.java similarity index 87% rename from foundation/foundation-security/foundation-pdp-client-java/src/main/java/com/boozallen/aiops/security/client/PolicyDecisionPointClient.java rename to foundation/foundation-security/foundation-pdp-client-java/src/main/java/com/boozallen/aissemble/security/client/PolicyDecisionPointClient.java index d9e0e1948..5aea20c51 100644 --- a/foundation/foundation-security/foundation-pdp-client-java/src/main/java/com/boozallen/aiops/security/client/PolicyDecisionPointClient.java +++ b/foundation/foundation-security/foundation-pdp-client-java/src/main/java/com/boozallen/aissemble/security/client/PolicyDecisionPointClient.java @@ -1,4 +1,4 @@ -package com.boozallen.aiops.security.client; +package com.boozallen.aissemble.security.client; /*- * #%L @@ -10,10 +10,10 @@ * #L% */ -import com.boozallen.aiops.security.authorization.models.AuthRequest; -import com.boozallen.aiops.security.authorization.models.PDPRequest; -import com.boozallen.aiops.security.authorization.policy.PolicyDecision; -import com.boozallen.aiops.security.config.SecurityConfiguration; +import com.boozallen.aissemble.security.authorization.models.AuthRequest; +import com.boozallen.aissemble.security.authorization.models.PDPRequest; +import com.boozallen.aissemble.security.authorization.policy.PolicyDecision; +import com.boozallen.aissemble.security.config.SecurityConfiguration; import org.aeonbits.owner.KrauseningConfigFactory; import org.jboss.resteasy.client.jaxrs.ResteasyClient; import org.jboss.resteasy.client.jaxrs.ResteasyWebTarget; diff --git a/foundation/foundation-security/foundation-pdp-client-java/src/main/java/com/boozallen/aiops/security/client/PolicyDecisionPointProxy.java b/foundation/foundation-security/foundation-pdp-client-java/src/main/java/com/boozallen/aissemble/security/client/PolicyDecisionPointProxy.java similarity index 77% rename from foundation/foundation-security/foundation-pdp-client-java/src/main/java/com/boozallen/aiops/security/client/PolicyDecisionPointProxy.java rename to foundation/foundation-security/foundation-pdp-client-java/src/main/java/com/boozallen/aissemble/security/client/PolicyDecisionPointProxy.java index 660cb16ca..f73467de6 100644 --- a/foundation/foundation-security/foundation-pdp-client-java/src/main/java/com/boozallen/aiops/security/client/PolicyDecisionPointProxy.java +++ b/foundation/foundation-security/foundation-pdp-client-java/src/main/java/com/boozallen/aissemble/security/client/PolicyDecisionPointProxy.java @@ -1,4 +1,4 @@ -package com.boozallen.aiops.security.client; +package com.boozallen.aissemble.security.client; /*- * #%L @@ -10,10 +10,9 @@ * #L% */ -import com.boozallen.aiops.security.authorization.models.AuthRequest; -import com.boozallen.aiops.security.authorization.models.PDPRequest; +import com.boozallen.aissemble.security.authorization.models.AuthRequest; +import com.boozallen.aissemble.security.authorization.models.PDPRequest; -import java.util.List; import javax.ws.rs.Consumes; import javax.ws.rs.POST; import javax.ws.rs.Path; diff --git a/foundation/foundation-upgrade/src/main/java/com/boozallen/aissemble/upgrade/migration/v1_8_0/AiopsReferenceJavaMigration.java b/foundation/foundation-upgrade/src/main/java/com/boozallen/aissemble/upgrade/migration/v1_8_0/AiopsReferenceJavaMigration.java index 76faf9fd9..f541b4009 100644 --- a/foundation/foundation-upgrade/src/main/java/com/boozallen/aissemble/upgrade/migration/v1_8_0/AiopsReferenceJavaMigration.java +++ b/foundation/foundation-upgrade/src/main/java/com/boozallen/aissemble/upgrade/migration/v1_8_0/AiopsReferenceJavaMigration.java @@ -30,7 +30,8 @@ public class AiopsReferenceJavaMigration extends AbstractAissembleMigration { public static final Logger logger = LoggerFactory.getLogger(AiopsReferenceJavaMigration.class); public static final Map AIOPS_REFERENCE_JAVA_PACKAGE_MAP = Map.of( - "com.boozallen.aiops.data.access", "com.boozallen.aissemble.data.access" + "com.boozallen.aiops.data.access", "com.boozallen.aissemble.data.access", + "com.boozallen.aiops.security","com.boozallen.aissemble.security" ); /** diff --git a/foundation/foundation-upgrade/src/main/java/com/boozallen/aissemble/upgrade/migration/v1_8_0/ExtensionsSecurityProjectsMigration.java b/foundation/foundation-upgrade/src/main/java/com/boozallen/aissemble/upgrade/migration/v1_8_0/ExtensionsSecurityProjectsMigration.java new file mode 100644 index 000000000..49f34cfd0 --- /dev/null +++ b/foundation/foundation-upgrade/src/main/java/com/boozallen/aissemble/upgrade/migration/v1_8_0/ExtensionsSecurityProjectsMigration.java @@ -0,0 +1,92 @@ +package com.boozallen.aissemble.upgrade.migration.v1_8_0; + +/*- + * #%L + * aiSSEMBLE::Foundation::Upgrade + * %% + * Copyright (C) 2021 Booz Allen + * %% + * This software package is licensed under the Booz Allen Public License. All Rights Reserved. + * #L% + */ + +import com.boozallen.aissemble.upgrade.migration.AbstractAissembleMigration; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileReader; +import java.util.Map; + +import static org.technologybrewery.baton.util.FileUtils.replaceLiteralInFile; + +/** + Baton migration class to verify whether a migrations are required for any outdated PDP and/or authzforce modules which + are referencing AIOPS instead of aiSSEMBLE. + **/ + +public class ExtensionsSecurityProjectsMigration extends AbstractAissembleMigration { + + public static final Logger logger = LoggerFactory.getLogger(ExtensionsSecurityProjectsMigration.class); + public static final Map EXTENSIONS_SECURITY_REFERENCE_PACKAGE_MAP = Map.of( + // aissemble/security/authorization/ + "AiopsKeycloakSecureTokenServiceClient","AissembleKeycloakSecureTokenServiceClient", + "AiopsKeyStore","AissembleKeyStore", + "AiopsSecureTokenServiceClient","AissembleSecureTokenServiceClient", + "AiopsSimpleSecureTokenServiceClient","AissembleSimpleSecureTokenServiceClient", + + // aissemble/security/authorization/policy/ + "AiopsAttribute","AissembleAttribute", + "AiopsAttributePoint","AissembleAttributePoint", + "AiopsAttributeProvider","AissembleAttributeProvider", + "AiopsAttributeUtils","AissembleAttributeUtils", + + // aissemble/security/authorization/exception + "AiopsSecurityException", "AissembleSecurityException" + + ); + + /** + * Function to check whether the migration is necessary. + * @param file file to check + * @return shouldExecute - whether the migration is necessary. + */ + @Override + protected boolean shouldExecuteOnFile(File file) { + boolean shouldExecute = false; + try (BufferedReader aiopsReferenceJavaConfig = new BufferedReader((new FileReader(file)))) { + String line; + while((line = aiopsReferenceJavaConfig.readLine()) !=null && !shouldExecute) { + for (String key : EXTENSIONS_SECURITY_REFERENCE_PACKAGE_MAP.keySet()) { + if (line.contains(key)) { + shouldExecute = true; + } + } + } + } catch (Exception e) { + logger.error("Error in determining whether an 'AIOPS' renamed java package requires a migration."); + } + return shouldExecute; + } + + /** + * Performs the migration if the shouldExecuteOnFile() returns true. + * @param file file to migrate + * @return isMigrated - Whether the file was migrated successfully. + */ + @Override + protected boolean performMigration(File file) { + boolean isMigrated = false; + + try { + for (Map.Entry entry : EXTENSIONS_SECURITY_REFERENCE_PACKAGE_MAP.entrySet()) { + replaceLiteralInFile(file, entry.getKey(), entry.getValue()); + isMigrated = true; + } + } catch (Exception e) { + logger.error("Error in performing the migration for a refactored java package."); + } + return isMigrated; + } +} \ No newline at end of file diff --git a/foundation/foundation-upgrade/src/main/resources/migrations.json b/foundation/foundation-upgrade/src/main/resources/migrations.json index c770e5ae3..09632eeb9 100644 --- a/foundation/foundation-upgrade/src/main/resources/migrations.json +++ b/foundation/foundation-upgrade/src/main/resources/migrations.json @@ -20,6 +20,48 @@ "includes": ["pom.xml"] } ] + }, + { + "name": "aiops-reference-python-migration", + "implementation": "com.boozallen.aissemble.upgrade.migration.v1_8_0.AiopsReferencePythonMigration", + "fileSets": [ + { + "includes": [ + "*-pipelines/*/src/*/step/*.py" + ] + } + ] + }, + { + "name": "aiops-reference-pdp-python-migration", + "implementation": "com.boozallen.aissemble.upgrade.migration.v1_8_0.AiopsReferencePDPPythonMigration", + "fileSets": [ + { + "includes": [ + "*-docker/*/src/main/resources/krausening/base/aiops-security.properties", + "*-docker/*/src/main/resources/krausening/base/aissemble-security.properties", + "*-docker/*/src/main/resources/docker/Dockerfile" + ] + } + ] + }, + { + "name": "aiops-reference-java-migration", + "implementation": "com.boozallen.aissemble.upgrade.migration.v1_8_0.AiopsReferenceJavaMigration", + "fileSets": [ + { + "includes": ["src/**/*.java"] + } + ] + }, + { + "name": "extensions-security-projects-migration", + "implementation": "com.boozallen.aissemble.upgrade.migration.v1_8_0.ExtensionsSecurityProjectsMigration", + "fileSets": [ + { + "includes": ["src/**/*.java"] + } + ] } ] }, @@ -61,39 +103,6 @@ ] } ] - }, - { - "name": "aiops-reference-python-migration", - "implementation": "com.boozallen.aissemble.upgrade.migration.v1_8_0.AiopsReferencePythonMigration", - "fileSets": [ - { - "includes": [ - "*-pipelines/*/src/*/step/*.py" - ] - } - ] - }, - { - "name": "aiops-reference-pdp-python-migration", - "implementation": "com.boozallen.aissemble.upgrade.migration.v1_8_0.AiopsReferencePDPPythonMigration", - "fileSets": [ - { - "includes": [ - "*-docker/*/src/main/resources/krausening/base/aiops-security.properties", - "*-docker/*/src/main/resources/krausening/base/aissemble-security.properties", - "*-docker/*/src/main/resources/docker/Dockerfile" - ] - } - ] - }, - { - "name": "aiops-reference-java-migration", - "implementation": "com.boozallen.aissemble.upgrade.migration.v1_8_0.AiopsReferenceJavaMigration", - "fileSets": [ - { - "includes": ["src/**/*.java"] - } - ] } ] } diff --git a/foundation/foundation-upgrade/src/test/java/com/boozallen/aissemble/upgrade/migration/v1_8_0/AiopsReferenceJavaMigrationSteps.java b/foundation/foundation-upgrade/src/test/java/com/boozallen/aissemble/upgrade/migration/v1_8_0/AiopsReferenceJavaMigrationSteps.java index 4556f8d46..23723f45a 100644 --- a/foundation/foundation-upgrade/src/test/java/com/boozallen/aissemble/upgrade/migration/v1_8_0/AiopsReferenceJavaMigrationSteps.java +++ b/foundation/foundation-upgrade/src/test/java/com/boozallen/aissemble/upgrade/migration/v1_8_0/AiopsReferenceJavaMigrationSteps.java @@ -53,4 +53,15 @@ public void theReferencesAreUpdatedToComBoozallenAissembleDataAccess() { validatedFile = getTestFile("/v1_8_0/AiopsReferenceJavaMigration/validation/DataAccessRecordValidated.java"); assertTrue("Data Access is still referencing aiops in the java package.", validateMigration(testFile, validatedFile)); } + + @Given("a Java file references the package com.boozallen.aiops.security") + public void aJavaFileReferencesThePackageComBoozallenAiopsSecurity() { + testFile = getTestFile("v1_8_0/AiopsReferenceJavaMigration/migration/Ingest.java"); + } + + @Then("the references are updated to com.boozallen.aissemble.security") + public void theReferencesAreUpdatedToComBoozallenAissembleSecurity() { + validatedFile = getTestFile("/v1_8_0/AiopsReferenceJavaMigration/validation/IngestValidated.java"); + assertTrue("Data Access is still referencing aiops in the java package.", validateMigration(testFile, validatedFile)); + } } diff --git a/foundation/foundation-upgrade/src/test/java/com/boozallen/aissemble/upgrade/migration/v1_8_0/ExtensionsSecurityProjectsMigrationSteps.java b/foundation/foundation-upgrade/src/test/java/com/boozallen/aissemble/upgrade/migration/v1_8_0/ExtensionsSecurityProjectsMigrationSteps.java new file mode 100644 index 000000000..31f8043a4 --- /dev/null +++ b/foundation/foundation-upgrade/src/test/java/com/boozallen/aissemble/upgrade/migration/v1_8_0/ExtensionsSecurityProjectsMigrationSteps.java @@ -0,0 +1,58 @@ +package com.boozallen.aissemble.upgrade.migration.v1_8_0; + +/*- + * #%L + * aiSSEMBLE::Foundation::Upgrade + * %% + * Copyright (C) 2021 Booz Allen + * %% + * This software package is licensed under the Booz Allen Public License. All Rights Reserved. + * #L% + */ + +import com.boozallen.aissemble.upgrade.migration.AbstractAissembleMigration; +import com.boozallen.aissemble.upgrade.migration.AbstractMigrationTest; +import io.cucumber.java.en.Given; +import io.cucumber.java.en.Then; +import io.cucumber.java.en.When; +import org.apache.commons.io.FileUtils; + +import java.io.File; + +import static org.junit.Assert.assertTrue; + +public class ExtensionsSecurityProjectsMigrationSteps extends AbstractMigrationTest { + + private AbstractAissembleMigration migration; + private File validatedFile; + + private static Boolean validateMigration(File original, File migrated) { + Boolean isMigrated = false; + + try { + isMigrated = FileUtils.contentEquals(original, migrated); + } catch (Exception e) { + e.printStackTrace(); + } + return isMigrated; + } + + @Given("a Java file references an object with the old object name with aiops") + public void aJavaFileReferencesAnObjectWithTheOldObjectNameWithAiops() { + testFile = getTestFile("v1_8_0/ExtensionsSecurityProjectsMigration/migration/Ingest.java"); + } + + @When("the 1.8.0 aiops reference extension security migration executes") + public void theAiopsReferenceExtensionSecurityMigrationExecutes() { + migration = new ExtensionsSecurityProjectsMigration(); + performMigration(migration); + } + + @Then("the objects are updated to aissemble replacing aiops") + public void theObjectsAreUpdatedToAissembleReplacingAiops() { + validatedFile = getTestFile("/v1_8_0/ExtensionsSecurityProjectsMigration/validation/IngestValidation.java"); + assertTrue("Extensions Security projects are still referencing aiops in the java Objects.", validateMigration(testFile, validatedFile)); + } +} + + diff --git a/foundation/foundation-upgrade/src/test/resources/specifications/v1_8_0/aiops-reference-java-migration.feature b/foundation/foundation-upgrade/src/test/resources/specifications/v1_8_0/aiops-reference-java-migration.feature index cbd447064..450a01366 100644 --- a/foundation/foundation-upgrade/src/test/resources/specifications/v1_8_0/aiops-reference-java-migration.feature +++ b/foundation/foundation-upgrade/src/test/resources/specifications/v1_8_0/aiops-reference-java-migration.feature @@ -3,4 +3,9 @@ Feature: AIOPS Reference Java package migration Scenario: Update the Data Access package name Given a Java file references the package com.boozallen.aiops.data.access When the 1.8.0 aiops reference java migration executes - Then the references are updated to com.boozallen.aissemble.data.access \ No newline at end of file + Then the references are updated to com.boozallen.aissemble.data.access + + Scenario: Update the Aissemble Security package name + Given a Java file references the package com.boozallen.aiops.security + When the 1.8.0 aiops reference java migration executes + Then the references are updated to com.boozallen.aissemble.security \ No newline at end of file diff --git a/foundation/foundation-upgrade/src/test/resources/specifications/v1_8_0/extensions-security-projects-migration.feature b/foundation/foundation-upgrade/src/test/resources/specifications/v1_8_0/extensions-security-projects-migration.feature new file mode 100644 index 000000000..9c14de809 --- /dev/null +++ b/foundation/foundation-upgrade/src/test/resources/specifications/v1_8_0/extensions-security-projects-migration.feature @@ -0,0 +1,6 @@ +Feature: AIOPS references from the extensions-security projects migrations + + Scenario: Update the extensions-security object names in a downstream project + Given a Java file references an object with the old object name with aiops + When the 1.8.0 aiops reference extension security migration executes + Then the objects are updated to aissemble replacing aiops \ No newline at end of file diff --git a/foundation/foundation-upgrade/src/test/resources/test-files/v1_8_0/AiopsReferenceJavaMigration/migration/Ingest.java b/foundation/foundation-upgrade/src/test/resources/test-files/v1_8_0/AiopsReferenceJavaMigration/migration/Ingest.java new file mode 100644 index 000000000..57804f5d9 --- /dev/null +++ b/foundation/foundation-upgrade/src/test/resources/test-files/v1_8_0/AiopsReferenceJavaMigration/migration/Ingest.java @@ -0,0 +1,146 @@ +package org.boozallen.aissemble; + +/*- + * #%L + * authzforce::Pipelines::Spark Pipeline + * %% + * Copyright (C) 2021 Booz Allen + * %% + * This software package is licensed under the Booz Allen Public License. All Rights Reserved. + * #L% + */ + +import com.boozallen.aissemble.core.filestore.AbstractFileStore; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.apache.spark.sql.api.java.UDF1; +import org.apache.spark.sql.api.java.UDF2; +import com.boozallen.aissemble.data.encryption.policy.config.EncryptAlgorithm; +import org.apache.spark.sql.types.DataTypes; + +import javax.inject.Inject; +import java.util.Map; +import java.util.HashMap; +import org.boozallen.aissemble.pipeline.PipelineBase; +import com.boozallen.aiops.security.client.PolicyDecisionPointClient; +import com.boozallen.aiops.security.authorization.policy.PolicyDecision; +import com.boozallen.aissemble.data.encryption.policy.EncryptionPolicy; +import com.boozallen.aissemble.data.encryption.policy.EncryptionPolicyManager; +import com.boozallen.aiops.security.exception.AissembleSecurityException; +import com.boozallen.aiops.security.authorization.models.PDPRequest; +import com.boozallen.aissemble.data.encryption.AiopsEncrypt; +import com.boozallen.aissemble.data.encryption.SimpleAesEncrypt; +import com.boozallen.aissemble.data.encryption.VaultEncrypt; +import org.apache.spark.sql.Dataset; +import org.apache.spark.sql.Row; +import org.apache.spark.sql.functions; +import org.apache.spark.sql.types.StructType; +import org.apache.commons.lang.NotImplementedException; + +import java.util.stream.Collectors; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.util.Arrays; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.HashMap; +import java.util.HashSet; + +import org.apache.spark.sql.Encoder; +import org.apache.spark.sql.Encoders; + +import static org.apache.spark.sql.functions.col; +import static org.apache.spark.sql.functions.lit; + +import org.aeonbits.owner.KrauseningConfigFactory; + +/** + * Performs scaffolding synchronous processing for Ingest. Business logic is delegated to the subclass. + * + * GENERATED CODE - DO NOT MODIFY (add your customizations in Ingest). + * + * Generated from: templates/data-delivery-spark/synchronous.processor.base.java.vm + */ +public abstract class Ingest extends AbstractPipelineStep { + + private static final Logger logger = LoggerFactory.getLogger(Ingest.class); + + protected static final String stepPhase = "Ingest"; + + protected Ingest(String subject, String action) { + super(subject, action); + + // Register the encryption UDF + sparkSession.sqlContext().udf().register("encryptUDF", encryptUDF(), DataTypes.StringType); + } + + public void executeStep() { + long start = System.currentTimeMillis(); + logger.debug("START: step execution..."); + + // TODO: add authorization check here + try { + + executeStepImpl(); + + long stop = System.currentTimeMillis(); + long ms = stop - start; + + logger.debug("COMPLETE: step execution completed in {}ms", (stop - start)); + + } catch (Exception e) { + logger.error("Step failed to complete", e); + throw e; + } + + } + + /** + * This method performs the business logic of this step. + * + */ + protected abstract void executeStepImpl(); + + /*** + * Calls the Policy Decision Point with the jwt + * + * @param jwt + * the authenticated token + * @return a policy decision + */ + protected String getAuthorization(String jwt) { + PolicyDecisionPointClient policyDecisionPointClient = new PolicyDecisionPointClient(); + + PDPRequest pdpRequest = new PDPRequest(); + pdpRequest.setJwt(jwt); + pdpRequest.setResource(""); + pdpRequest.setAction("data-access"); + + return policyDecisionPointClient.getPolicyDecision(pdpRequest); + } + + /** + * Spark User Defined Function for running encryption on columns. Note: must be registered with the spark session. + * + * @return The cipher text + */ + protected UDF2 encryptUDF () { + return (plainText, encryptAlgorithm) -> { + if (plainText != null) { + // Default algorithm is AES + AiopsEncrypt aiopsEncrypt = new SimpleAesEncrypt(); + + if (encryptAlgorithm.equals("VAULT_ENCRYPT")) { + aiopsEncrypt = new VaultEncrypt(); + } + + return aiopsEncrypt.encryptValue(plainText); + } else { + return ""; + } + }; + } + +} diff --git a/foundation/foundation-upgrade/src/test/resources/test-files/v1_8_0/AiopsReferenceJavaMigration/validation/IngestValidated.java b/foundation/foundation-upgrade/src/test/resources/test-files/v1_8_0/AiopsReferenceJavaMigration/validation/IngestValidated.java new file mode 100644 index 000000000..b5430dace --- /dev/null +++ b/foundation/foundation-upgrade/src/test/resources/test-files/v1_8_0/AiopsReferenceJavaMigration/validation/IngestValidated.java @@ -0,0 +1,146 @@ +package org.boozallen.aissemble; + +/*- + * #%L + * authzforce::Pipelines::Spark Pipeline + * %% + * Copyright (C) 2021 Booz Allen + * %% + * This software package is licensed under the Booz Allen Public License. All Rights Reserved. + * #L% + */ + +import com.boozallen.aissemble.core.filestore.AbstractFileStore; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.apache.spark.sql.api.java.UDF1; +import org.apache.spark.sql.api.java.UDF2; +import com.boozallen.aissemble.data.encryption.policy.config.EncryptAlgorithm; +import org.apache.spark.sql.types.DataTypes; + +import javax.inject.Inject; +import java.util.Map; +import java.util.HashMap; +import org.boozallen.aissemble.pipeline.PipelineBase; +import com.boozallen.aissemble.security.client.PolicyDecisionPointClient; +import com.boozallen.aissemble.security.authorization.policy.PolicyDecision; +import com.boozallen.aissemble.data.encryption.policy.EncryptionPolicy; +import com.boozallen.aissemble.data.encryption.policy.EncryptionPolicyManager; +import com.boozallen.aissemble.security.exception.AissembleSecurityException; +import com.boozallen.aissemble.security.authorization.models.PDPRequest; +import com.boozallen.aissemble.data.encryption.AiopsEncrypt; +import com.boozallen.aissemble.data.encryption.SimpleAesEncrypt; +import com.boozallen.aissemble.data.encryption.VaultEncrypt; +import org.apache.spark.sql.Dataset; +import org.apache.spark.sql.Row; +import org.apache.spark.sql.functions; +import org.apache.spark.sql.types.StructType; +import org.apache.commons.lang.NotImplementedException; + +import java.util.stream.Collectors; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.util.Arrays; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.HashMap; +import java.util.HashSet; + +import org.apache.spark.sql.Encoder; +import org.apache.spark.sql.Encoders; + +import static org.apache.spark.sql.functions.col; +import static org.apache.spark.sql.functions.lit; + +import org.aeonbits.owner.KrauseningConfigFactory; + +/** + * Performs scaffolding synchronous processing for Ingest. Business logic is delegated to the subclass. + * + * GENERATED CODE - DO NOT MODIFY (add your customizations in Ingest). + * + * Generated from: templates/data-delivery-spark/synchronous.processor.base.java.vm + */ +public abstract class Ingest extends AbstractPipelineStep { + + private static final Logger logger = LoggerFactory.getLogger(Ingest.class); + + protected static final String stepPhase = "Ingest"; + + protected Ingest(String subject, String action) { + super(subject, action); + + // Register the encryption UDF + sparkSession.sqlContext().udf().register("encryptUDF", encryptUDF(), DataTypes.StringType); + } + + public void executeStep() { + long start = System.currentTimeMillis(); + logger.debug("START: step execution..."); + + // TODO: add authorization check here + try { + + executeStepImpl(); + + long stop = System.currentTimeMillis(); + long ms = stop - start; + + logger.debug("COMPLETE: step execution completed in {}ms", (stop - start)); + + } catch (Exception e) { + logger.error("Step failed to complete", e); + throw e; + } + + } + + /** + * This method performs the business logic of this step. + * + */ + protected abstract void executeStepImpl(); + + /*** + * Calls the Policy Decision Point with the jwt + * + * @param jwt + * the authenticated token + * @return a policy decision + */ + protected String getAuthorization(String jwt) { + PolicyDecisionPointClient policyDecisionPointClient = new PolicyDecisionPointClient(); + + PDPRequest pdpRequest = new PDPRequest(); + pdpRequest.setJwt(jwt); + pdpRequest.setResource(""); + pdpRequest.setAction("data-access"); + + return policyDecisionPointClient.getPolicyDecision(pdpRequest); + } + + /** + * Spark User Defined Function for running encryption on columns. Note: must be registered with the spark session. + * + * @return The cipher text + */ + protected UDF2 encryptUDF () { + return (plainText, encryptAlgorithm) -> { + if (plainText != null) { + // Default algorithm is AES + AiopsEncrypt aiopsEncrypt = new SimpleAesEncrypt(); + + if (encryptAlgorithm.equals("VAULT_ENCRYPT")) { + aiopsEncrypt = new VaultEncrypt(); + } + + return aiopsEncrypt.encryptValue(plainText); + } else { + return ""; + } + }; + } + +} diff --git a/foundation/foundation-upgrade/src/test/resources/test-files/v1_8_0/ExtensionsSecurityProjectsMigration/migration/Ingest.java b/foundation/foundation-upgrade/src/test/resources/test-files/v1_8_0/ExtensionsSecurityProjectsMigration/migration/Ingest.java new file mode 100644 index 000000000..227fbe282 --- /dev/null +++ b/foundation/foundation-upgrade/src/test/resources/test-files/v1_8_0/ExtensionsSecurityProjectsMigration/migration/Ingest.java @@ -0,0 +1,81 @@ +package org.boozallen.aissemble; + +/*- + * #%L + * authzforce1::Pipelines::Spark Pipeline + * %% + * Copyright (C) 2021 Booz Allen + * %% + * This software package is licensed under the Booz Allen Public License. All Rights Reserved. + * #L% + */ + + +import javax.enterprise.context.ApplicationScoped; + +import com.boozallen.aissemble.security.authorization.AissembleKeyStore; +import com.boozallen.aissemble.security.authorization.AissembleKeycloakSecureTokenServiceClient; +import com.boozallen.aissemble.security.authorization.AissembleSimpleSecureTokenServiceClient; +import com.boozallen.aissemble.security.authorization.policy.AissembleAttribute; +import com.boozallen.aissemble.security.authorization.policy.AissembleAttributeProvider; +import com.boozallen.aissemble.security.exception.AissembleSecurityException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.time.Instant; +import java.util.Map; + + +/** + * Performs the business logic for Ingest. + * + * Because this class is {@link ApplicationScoped}, exactly one managed singleton instance will exist + * in any deployment. + * + * GENERATED STUB CODE - PLEASE ***DO*** MODIFY + * + * Originally generated from: templates/data-delivery-spark/synchronous.processor.impl.java.vm + */ +@ApplicationScoped +public class Ingest extends IngestBase { + + // testing aissemble/security/authorization/ migrations + private static AiopsKeycloakSecureTokenServiceClient keycloakSecureTokenServiceClient = new AiopsKeycloakSecureTokenServiceClient(); + private static AiopsKeyStore keyStore = new AiopsKeyStore(); + private static AiopsSimpleSecureTokenServiceClient simpleSecureTokenServiceClient = new AiopsSimpleSecureTokenServiceClient(); + + // testing aissemble/security/authorization/policy/ migrations + private static AiopsAttribute attribute = new AiopsAttribute(); + private static AiopsAttributeProvider attributeProvider = new AiopsAttributeProvider(); + + // testing aissemble/security/authorization/exception migrations + private static AiopsSecurityException securityException = new AiopsSecurityException(); + + private static final Logger logger = LoggerFactory.getLogger(Ingest.class); + + public Ingest(){ + super("synchronous",getDataActionDescriptiveLabel()); + } + + /** + * Provides a descriptive label for the action that can be used for logging (e.g., provenance details). + * + * @return descriptive label + */ + private static String getDataActionDescriptiveLabel(){ + // TODO: replace with descriptive label + return"Ingest"; + } + + /** + * {@inheritDoc} + */ + @Override + protected void executeStepImpl() { + // TODO: Add your business logic here for this step! + logger.error("Implement executeStepImpl(..) or remove this pipeline step!"); + + } + + +} diff --git a/foundation/foundation-upgrade/src/test/resources/test-files/v1_8_0/ExtensionsSecurityProjectsMigration/validation/IngestValidation.java b/foundation/foundation-upgrade/src/test/resources/test-files/v1_8_0/ExtensionsSecurityProjectsMigration/validation/IngestValidation.java new file mode 100644 index 000000000..2038f25e6 --- /dev/null +++ b/foundation/foundation-upgrade/src/test/resources/test-files/v1_8_0/ExtensionsSecurityProjectsMigration/validation/IngestValidation.java @@ -0,0 +1,81 @@ +package org.boozallen.aissemble; + +/*- + * #%L + * authzforce1::Pipelines::Spark Pipeline + * %% + * Copyright (C) 2021 Booz Allen + * %% + * This software package is licensed under the Booz Allen Public License. All Rights Reserved. + * #L% + */ + + +import javax.enterprise.context.ApplicationScoped; + +import com.boozallen.aissemble.security.authorization.AissembleKeyStore; +import com.boozallen.aissemble.security.authorization.AissembleKeycloakSecureTokenServiceClient; +import com.boozallen.aissemble.security.authorization.AissembleSimpleSecureTokenServiceClient; +import com.boozallen.aissemble.security.authorization.policy.AissembleAttribute; +import com.boozallen.aissemble.security.authorization.policy.AissembleAttributeProvider; +import com.boozallen.aissemble.security.exception.AissembleSecurityException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.time.Instant; +import java.util.Map; + + +/** + * Performs the business logic for Ingest. + * + * Because this class is {@link ApplicationScoped}, exactly one managed singleton instance will exist + * in any deployment. + * + * GENERATED STUB CODE - PLEASE ***DO*** MODIFY + * + * Originally generated from: templates/data-delivery-spark/synchronous.processor.impl.java.vm + */ +@ApplicationScoped +public class Ingest extends IngestBase { + + // testing aissemble/security/authorization/ migrations + private static AissembleKeycloakSecureTokenServiceClient keycloakSecureTokenServiceClient = new AissembleKeycloakSecureTokenServiceClient(); + private static AissembleKeyStore keyStore = new AissembleKeyStore(); + private static AissembleSimpleSecureTokenServiceClient simpleSecureTokenServiceClient = new AissembleSimpleSecureTokenServiceClient(); + + // testing aissemble/security/authorization/policy/ migrations + private static AissembleAttribute attribute = new AissembleAttribute(); + private static AissembleAttributeProvider attributeProvider = new AissembleAttributeProvider(); + + // testing aissemble/security/authorization/exception migrations + private static AissembleSecurityException securityException = new AissembleSecurityException(); + + private static final Logger logger = LoggerFactory.getLogger(Ingest.class); + + public Ingest(){ + super("synchronous",getDataActionDescriptiveLabel()); + } + + /** + * Provides a descriptive label for the action that can be used for logging (e.g., provenance details). + * + * @return descriptive label + */ + private static String getDataActionDescriptiveLabel(){ + // TODO: replace with descriptive label + return"Ingest"; + } + + /** + * {@inheritDoc} + */ + @Override + protected void executeStepImpl() { + // TODO: Add your business logic here for this step! + logger.error("Implement executeStepImpl(..) or remove this pipeline step!"); + + } + + +}