<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ Copyright The WildFly Authors
  ~ SPDX-License-Identifier: Apache-2.0
  -->

<feature-group-spec name="elytron-app" xmlns="urn:jboss:galleon:feature-group:1.0">
    <!-- application.cli -->
    <feature spec="subsystem.elytron.properties-realm">
        <param name="properties-realm" value="ApplicationRealm"/>
        <param name="users-properties" value="{path=application-users.properties,relative-to=jboss.server.config.dir,digest-realm-name=ApplicationRealm}"/>
        <feature spec="subsystem.elytron.properties-realm.groups-properties">
            <param name="path" value="application-roles.properties"/>
            <param name="relative-to" value="jboss.server.config.dir"/>
        </feature>
    </feature>
    <feature spec="subsystem.elytron.security-domain">
        <param name="security-domain" value="ApplicationDomain"/>
        <param name="default-realm" value="ApplicationRealm"/>
        <unset param="outflow-security-domains"/>
        <param name="permission-mapper" value="default-permission-mapper"/>
        <param name="realms" value="[{realm=ApplicationRealm,role-decoder=groups-to-roles}]"/>
    </feature>
    <feature spec="subsystem.elytron.sasl-authentication-factory">
        <param name="sasl-authentication-factory" value="application-sasl-authentication"/>
        <param name="sasl-server-factory" value="configured"/>
        <param name="security-domain" value="ApplicationDomain"/>
        <param name="mechanism-configurations" value="[{mechanism-name=JBOSS-LOCAL-USER,realm-mapper=local},{mechanism-name=DIGEST-MD5,mechanism-realm-configurations=[{realm-name=ApplicationRealm}]}]"/>
    </feature>
    <feature spec="subsystem.elytron.key-store">
        <param name="key-store" value="applicationKS" />
        <param name="path" value="application.keystore" />
        <param name="relative-to" value="jboss.server.config.dir" />
        <param name="type" value="JKS" />
        <param name="credential-reference" value="{clear-text=password}" />
    </feature>
    <feature spec="subsystem.elytron.key-manager">
        <param name="key-manager" value="applicationKM" />
        <param name="key-store" value="applicationKS" />
        <param name="generate-self-signed-certificate-host" value="localhost" />
        <param name="credential-reference" value="{clear-text=password}" />
    </feature>
    <feature spec="subsystem.elytron.server-ssl-context">
        <param name="server-ssl-context" value="applicationSSC" />
        <param name="key-manager" value="applicationKM" />
    </feature>
</feature-group-spec>
