<?xml version="1.0" encoding="UTF-8"?>
<!--

    Licensed to the Apache Software Foundation (ASF) under one or more
    contributor license agreements.  See the NOTICE file distributed with
    this work for additional information regarding copyright ownership.
    The ASF licenses this file to You under the Apache License, Version 2.0
    (the "License"); you may not use this file except in compliance with
    the License.  You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.

-->
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0">

    <bean id="config"
          class="org.apache.karaf.jaas.config.impl.OsgiConfiguration"
          init-method="init"
          destroy-method="close"/>

    <reference-list id="realms"
                    interface="org.apache.karaf.jaas.config.JaasRealm"
                    availability="optional">
        <reference-listener ref="config" bind-method="register" unbind-method="unregister" />
    </reference-list>

    <bean id="proxyLoginModuleInitializer" class="org.apache.karaf.jaas.config.impl.ProxyLoginModuleInitializer" init-method="init">
        <property name="bundleContext" ref="blueprintBundleContext"/>
    </bean>

    <!-- Register the Straight-Through flow -->
    <bean id="keystoreManager" class="org.apache.karaf.jaas.config.impl.OsgiKeystoreManager" />
    <service ref="keystoreManager" interface="org.apache.karaf.jaas.config.KeystoreManager" />

    <reference-list id="keystores"
                    interface="org.apache.karaf.jaas.config.KeystoreInstance"
                    availability="optional">
        <reference-listener ref="keystoreManager" bind-method="register" unbind-method="unregister" />
    </reference-list>

    <service interface="org.apache.aries.blueprint.NamespaceHandler">
        <service-properties>
            <entry key="osgi.service.blueprint.namespace">
                <array>
                    <value>http://karaf.apache.org/xmlns/jaas/v1.0.0</value>
                    <value>http://karaf.apache.org/xmlns/jaas/v1.1.0</value>
                </array>
            </entry>
        </service-properties>
        <bean class="org.apache.karaf.jaas.config.impl.NamespaceHandler"/>
    </service>

</blueprint>
