org.jboss.metadata.web.spec.ListenerMetaData Java Examples

The following examples show how to use org.jboss.metadata.web.spec.ListenerMetaData. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: KeycloakAdapterConfigDeploymentProcessor.java    From keycloak with Apache License 2.0 5 votes vote down vote up
private void addConfigurationListener(DeploymentPhaseContext phaseContext) {
    DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
    WarMetaData warMetaData = deploymentUnit.getAttachment(WarMetaData.ATTACHMENT_KEY);
    if (warMetaData == null) {
        return;
    }

    JBossWebMetaData webMetaData = warMetaData.getMergedJBossWebMetaData();
    if (webMetaData == null) {
        webMetaData = new JBossWebMetaData();
        warMetaData.setMergedJBossWebMetaData(webMetaData);
    }

    LoginConfigMetaData loginConfig = webMetaData.getLoginConfig();
    if (loginConfig == null) {
        return;
    }
    if (!loginConfig.getAuthMethod().equals("KEYCLOAK")) {
        return;
    }

    if (isElytronEnabled(phaseContext)) {
        ListenerMetaData listenerMetaData = new ListenerMetaData();

        listenerMetaData.setListenerClass(KeycloakConfigurationServletListener.class.getName());

        webMetaData.getListeners().add(listenerMetaData);
    }
}
 
Example #2
Source File: KeycloakAdapterConfigDeploymentProcessor.java    From keycloak with Apache License 2.0 5 votes vote down vote up
private void addConfigurationListener(DeploymentPhaseContext phaseContext) {
    DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
    WarMetaData warMetaData = deploymentUnit.getAttachment(WarMetaData.ATTACHMENT_KEY);
    if (warMetaData == null) {
        return;
    }

    JBossWebMetaData webMetaData = warMetaData.getMergedJBossWebMetaData();
    if (webMetaData == null) {
        webMetaData = new JBossWebMetaData();
        warMetaData.setMergedJBossWebMetaData(webMetaData);
    }

    LoginConfigMetaData loginConfig = webMetaData.getLoginConfig();
    if (loginConfig == null) {
        return;
    }
    if (!loginConfig.getAuthMethod().equals("KEYCLOAK-SAML")) {
        return;
    }

    if (isElytronEnabled(phaseContext)) {
        ListenerMetaData listenerMetaData = new ListenerMetaData();

        listenerMetaData.setListenerClass(KeycloakConfigurationServletListener.class.getName());

        webMetaData.getListeners().add(listenerMetaData);
    }
}