@Override public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException { final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit(); if (Configuration.INSTANCE.getSecureDeployment(deploymentUnit) == null) { WarMetaData warMetaData = deploymentUnit.getAttachment(WarMetaData.ATTACHMENT_KEY); if (warMetaData == null) { return; } JBossWebMetaData webMetaData = warMetaData.getMergedJBossWebMetaData(); if (webMetaData == null) { return; } LoginConfigMetaData loginConfig = webMetaData.getLoginConfig(); if (loginConfig == null) return; if (loginConfig.getAuthMethod() == null) return; if (!loginConfig.getAuthMethod().equals("KEYCLOAK-SAML")) return; } final ModuleSpecification moduleSpecification = deploymentUnit.getAttachment(Attachments.MODULE_SPECIFICATION); final ModuleLoader moduleLoader = Module.getBootModuleLoader(); addCommonModules(moduleSpecification, moduleLoader); addPlatformSpecificModules(moduleSpecification, moduleLoader); }
@Test public void testConfig() { // tests around Config // set the custom props, then override with defaults System.setProperty("environment", "custom"); final URL defaultPropsUrl = ConfigurationTest.class.getResource("/default.properties"); Configuration.INSTANCE.addDefaultProperties(defaultPropsUrl, "default"); // overridden Assert.assertThat(Configuration.INSTANCE.getString("overridden.key"), is("overridden")); // default Assert.assertThat(Configuration.INSTANCE.getString("default.key"), is("default-key")); // custom Assert.assertThat(Configuration.INSTANCE.getString("custom.key"), is("custom-key")); Assert.assertNull(Configuration.INSTANCE.getString("non-existant")); }