<WebappAuthenticatorConfig>
	<Authenticators>
		<Authenticator>
			<Name>OAuth</Name>
			{% if webapp_auth_conf.authenticator.oauth is defined %}
			<ClassName>{{webapp_auth_conf.authenticator.oauth.class_name}}</ClassName>
            <Parameters>
                {% for property_name,property_value in webapp_auth_conf.authenticator.oauth.parameter_options.items() %}
                <Parameter Name="{{property_name}}">{{property_value}}</Parameter>
                {% endfor %}
            </Parameters>
			{% else %}
			<ClassName>io.entgra.device.mgt.core.webapp.authenticator.framework.authenticator.OAuthAuthenticator</ClassName>
            <Parameters>
                <Parameter Name="IsRemote">false</Parameter>
                <Parameter Name="TokenValidationEndpointUrl">https://${iot.keymanager.host}:${iot.keymanager.https.port}</Parameter>
                <Parameter Name="Username">{{super_admin.username}}</Parameter>
                <Parameter Name="Password">{{super_admin.password}}</Parameter>
                <Parameter Name="MaxTotalConnections">100</Parameter>
                <Parameter Name="MaxConnectionsPerHost">100</Parameter>
            </Parameters>
            {% endif %}
		</Authenticator>
        <Authenticator>
            <Name>BasicAuth</Name>
            {% if webapp_auth_conf.authenticator.basic_auth is defined %}
            <ClassName>{{webapp_auth_conf.authenticator.basic_auth.class_name}}</ClassName>
            <Parameters>
                {% for property_name,property_value in webapp_auth_conf.authenticator.basic_auth.parameter_options.items() %}
                <Parameter Name="{{property_name}}">{{property_value}}</Parameter>
                {% endfor %}
            </Parameters>
            {% else %}
            <ClassName>io.entgra.device.mgt.core.webapp.authenticator.framework.authenticator.BasicAuthAuthenticator</ClassName>
            {% endif %}
        </Authenticator>
        <Authenticator>
            <Name>JWT</Name>
            {% if webapp_auth_conf.authenticator.jwt is defined %}
            <ClassName>{{webapp_auth_conf.authenticator.jwt.class_name}}</ClassName>
            <Parameters>
                {% for property_name,property_value in webapp_auth_conf.authenticator.jwt.parameter_options.items() %}
                <Parameter Name="{{property_name}}">{{property_value}}</Parameter>
                {% endfor %}
            </Parameters>
            {% else %}
            <ClassName>io.entgra.device.mgt.core.webapp.authenticator.framework.authenticator.JWTAuthenticator</ClassName>
            <Parameters>
				<!--Issuers list and corresponding cert alias-->
				<Parameter Name="default">wso2carbon</Parameter>
                <Parameter Name="wso2.org/products/am">wso2carbon</Parameter>
				<Parameter Name="wso2.org/products/iot">wso2carbon</Parameter>
				<Parameter Name="wso2.org/products/analytics">wso2carbon</Parameter>
            </Parameters>
            {% endif %}
        </Authenticator>
        <Authenticator>
            <Name>CertificateAuth</Name>
            {% if webapp_auth_conf.authenticator.certificate_auth is defined %}
            <ClassName>{{webapp_auth_conf.authenticator.certificate_auth.class_name}}</ClassName>
            <Parameters>
                {% for property_name,property_value in webapp_auth_conf.authenticator.certificate_auth.parameter_options.items() %}
                <Parameter Name="{{property_name}}">{{property_value}}</Parameter>
                {% endfor %}
            </Parameters>
            {% else %}
            <ClassName>io.entgra.device.mgt.core.webapp.authenticator.framework.authenticator.CertificateAuthenticator</ClassName>
            {% endif %}
        </Authenticator>
        <Authenticator>
            <Name>OTPAuth</Name>
            {% if webapp_auth_conf.authenticator.otpauth is defined %}
            <ClassName>{{webapp_auth_conf.authenticator.otpauth.class_name}}</ClassName>
            <Parameters>
                {% for property_name,property_value in webapp_auth_conf.authenticator.otpauth.parameter_options.items() %}
                <Parameter Name="{{property_name}}">{{property_value}}</Parameter>
                {% endfor %}
            </Parameters>
            {% else %}
            <ClassName>io.entgra.device.mgt.core.webapp.authenticator.framework.authenticator.OneTimeTokenAuthenticator</ClassName>
            {% endif %}
        </Authenticator>
        <Authenticator>
            <Name>BST</Name>
            {% if webapp_auth_conf.authenticator.bst is defined %}
            <ClassName>{{webapp_auth_conf.authenticator.bst.class_name}}</ClassName>
            <Parameters>
                {% for property_name,property_value in webapp_auth_conf.authenticator.bst.parameter_options.items() %}
                <Parameter Name="{{property_name}}">{{property_value}}</Parameter>
                {% endfor %}
            </Parameters>
            {% else %}
            <ClassName>io.entgra.device.mgt.core.webapp.authenticator.framework.authenticator.BSTAuthenticator</ClassName>
            <Parameters>
                <Parameter Name="IsRemote">false</Parameter>
                <Parameter Name="TokenValidationEndpointUrl">https://${iot.keymanager.host}:${iot.keymanager.https.port}</Parameter>
                <Parameter Name="Username">${admin.username}</Parameter>
                <Parameter Name="Password">${admin.password}</Parameter>
                <Parameter Name="MaxTotalConnections">100</Parameter>
                <Parameter Name="MaxConnectionsPerHost">100</Parameter>
            </Parameters>
            {% endif %}
        </Authenticator>
    {% if webapp_auth_conf.authenticators is defined %}
        {%- for authenticator in webapp_auth_conf.authenticators -%}
        <Authenticator>
            <Name>{{authenticator.name}}</Name>
            <ClassName>{{authenticator.class_name}}</ClassName>
            <Parameters>
                {% for property_name,property_value in authenticator.parameter_options.items() %}
                <Parameter Name="{{property_name}}">{{property_value}}</Parameter>
                {% endfor %}
            </Parameters>
         </Authenticator>
        {% endfor %}
    {% endif %}
	</Authenticators>
</WebappAuthenticatorConfig>
