@Override public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException { DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit(); String deploymentName = deploymentUnit.getName(); KeycloakAdapterConfigService service = KeycloakAdapterConfigService.getInstance(); if (service.isSecureDeployment(deploymentName)) { addKeycloakAuthData(phaseContext, deploymentName, service); } // FYI, Undertow Extension will find deployments that have auth-method set to KEYCLOAK // todo notsure if we need this // addSecurityDomain(deploymentUnit, service); }
protected void addSecurityDomain(DeploymentUnit deploymentUnit, KeycloakAdapterConfigService service) { if (!service.isSecureDeployment(deploymentUnit)) { return; } 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 || !loginConfig.getAuthMethod().equalsIgnoreCase("KEYCLOAK")) { return; } webMetaData.setSecurityDomain("keycloak"); }
protected void addSecurityDomain(DeploymentUnit deploymentUnit, KeycloakAdapterConfigService service) { String deploymentName = deploymentUnit.getName(); if (!service.isSecureDeployment(deploymentName)) { return; } 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 || !loginConfig.getAuthMethod().equalsIgnoreCase("KEYCLOAK")) { return; } webMetaData.setSecurityDomain("keycloak"); }
@Override public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException { DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit(); KeycloakAdapterConfigService service = KeycloakAdapterConfigService.getInstance(); if (service.isSecureDeployment(deploymentUnit) && service.isDeploymentConfigured(deploymentUnit)) { addKeycloakAuthData(phaseContext, service); } addConfigurationListener(phaseContext); // FYI, Undertow Extension will find deployments that have auth-method set to KEYCLOAK // todo notsure if we need this // addSecurityDomain(deploymentUnit, service); }
@Override public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException { final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit(); if (!KeycloakAdapterConfigService.getInstance().isSecureDeployment(deploymentUnit)) { 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")) return; } final ModuleSpecification moduleSpecification = deploymentUnit.getAttachment(Attachments.MODULE_SPECIFICATION); final ModuleLoader moduleLoader = Module.getBootModuleLoader(); addCommonModules(moduleSpecification, moduleLoader); addPlatformSpecificModules(phaseContext, moduleSpecification, moduleLoader); }