use of org.jboss.metadata.web.jboss.ValveMetaData in project keycloak by keycloak.
the class KeycloakAdapterConfigDeploymentProcessor method addValve.
private void addValve(JBossWebMetaData webMetaData) {
List<ValveMetaData> valves = webMetaData.getValves();
if (valves == null) {
valves = new ArrayList<>(1);
webMetaData.setValves(valves);
}
ValveMetaData valve = new ValveMetaData();
valve.setValveClass(KeycloakAuthenticatorValve.class.getName());
valve.setModule("org.keycloak.keycloak-as7-adapter");
// log.info("******* adding Keycloak valve to: " + deploymentName);
valves.add(valve);
}
use of org.jboss.metadata.web.jboss.ValveMetaData in project wildfly by wildfly.
the class JBossWebParsingDeploymentProcessor method deploy.
@Override
public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
if (!DeploymentTypeMarker.isType(DeploymentType.WAR, deploymentUnit)) {
// Skip non web deployments
return;
}
final VirtualFile deploymentRoot = deploymentUnit.getAttachment(Attachments.DEPLOYMENT_ROOT).getRoot();
final VirtualFile jbossWebXml = deploymentRoot.getChild(JBOSS_WEB_XML);
WarMetaData warMetaData = deploymentUnit.getAttachment(WarMetaData.ATTACHMENT_KEY);
assert warMetaData != null;
if (jbossWebXml.exists()) {
InputStream is = null;
try {
is = jbossWebXml.openStream();
final XMLInputFactory inputFactory = XMLInputFactory.newInstance();
inputFactory.setXMLResolver(NoopXMLResolver.create());
XMLStreamReader xmlReader = inputFactory.createXMLStreamReader(is);
final JBossWebMetaData jBossWebMetaData = JBossWebMetaDataParser.parse(xmlReader, JBossDescriptorPropertyReplacement.propertyReplacer(deploymentUnit));
warMetaData.setJBossWebMetaData(jBossWebMetaData);
// deployment unit
if (jBossWebMetaData.getValves() != null) {
for (ValveMetaData valve : jBossWebMetaData.getValves()) {
UndertowLogger.ROOT_LOGGER.unsupportedValveFeature(valve.getValveClass());
}
}
if (jBossWebMetaData.getDistinctName() != null) {
deploymentUnit.putAttachment(org.jboss.as.ee.structure.Attachments.DISTINCT_NAME, jBossWebMetaData.getDistinctName());
}
} catch (XMLStreamException e) {
throw new DeploymentUnitProcessingException(UndertowLogger.ROOT_LOGGER.failToParseXMLDescriptor(jbossWebXml.toString(), e.getLocation().getLineNumber(), e.getLocation().getColumnNumber()), e);
} catch (IOException e) {
throw new DeploymentUnitProcessingException(UndertowLogger.ROOT_LOGGER.failToParseXMLDescriptor(jbossWebXml.toString()), e);
} finally {
try {
if (is != null) {
is.close();
}
} catch (IOException e) {
// Ignore
}
}
} else {
// jboss web embedded inside jboss-all.xml
final JBossWebMetaData jbMeta = deploymentUnit.getAttachment(WebJBossAllParser.ATTACHMENT_KEY);
if (jbMeta != null) {
warMetaData.setJBossWebMetaData(jbMeta);
}
}
}
use of org.jboss.metadata.web.jboss.ValveMetaData in project keycloak by keycloak.
the class KeycloakAdapterConfigDeploymentProcessor method addValve.
private void addValve(JBossWebMetaData webMetaData) {
List<ValveMetaData> valves = webMetaData.getValves();
if (valves == null) {
valves = new ArrayList<ValveMetaData>(1);
webMetaData.setValves(valves);
}
ValveMetaData valve = new ValveMetaData();
valve.setValveClass(SamlAuthenticatorValve.class.getName());
valve.setModule("org.keycloak.keycloak-saml-as7-adapter");
// log.info("******* adding Keycloak valve to: " + deploymentName);
valves.add(valve);
}
Aggregations