Провайдер аутентификации не отображается в списке Authenticators в WebLogic Server Версия: 12.1.3.0.0

Я только что создал поставщик проверки подлинности для версии WebLogic Server: 12.1.3.0.0, поместил банку в lib домена, но не появился в списке поставщиков, чтобы выбрать

<?xml version="1.0"?>

<!DOCTYPE MBeanType SYSTEM "commo.dtd">

<!-- MBean Definition File (MDF) for the MMR WS Authenticator See documentation at: http://docs.oracle.com/cd/E13212_01/wles/docs42/dvspisec/mdf_ref.html Since it is for an identity asserter, it must extend the weblogic.management.security.authentication.IdentityAsserter mbean. The Name and DisplayName must be the same. They specify the name that will appear on the console for this provider. Set the PeristPolicy to "OnUpdate" so that if an attribute value is changed, the new value is written to disk immediately. See the "Developing Security Services" manual for more info. Note that since this is an xml document, you can't use double quotes directly. Instead you need to use &quot; Note that setting "Writeable" to "false" on an attribute makes the attribute read-only. The default is read-write. -->

-<MBeanType PersistPolicy="OnUpdate" Extends="weblogic.management.security.authentication.Authenticator" Package="fr.telecom.security.authentication.provider.mbean" Name="MMRWSAuthenticator">

<!-- You must set the value of the ProviderClassName attribute (inherited from the weblogic.management.security.Provider mbean) to the name of the java class you wrote that implements the weblogic.security.spi.AuthenticationProvider interface. You can think of the provider mbean as the factory for your provider runtime implementation. -->


<MBeanAttribute Name="ProviderClassName" Default=""fr.telecom.security.authentication.provider.MMRWSAuthenticationProviderImpl"" Preprocessor="weblogic.management.configuration.LegalHelper.checkClassName(value)" Writeable="false" Type="java.lang.String"/>

<!-- You must set the value of the Description attribute (inherited from the weblogic.management.security.Provider mbean) to a brief description of your provider. It is displayed in the console. -->


<MBeanAttribute Name="Description" Default=""MMR WS Authenticator"" Writeable="false" Type="java.lang.String"/>

<!-- You must set the value of the Version attribute (inherited from the weblogic.management.security.Provider mbean) to your provider version. There is no required format. -->


<MBeanAttribute Name="Version" Default=""1.0"" Writeable="false" Type="java.lang.String"/>

</MBeanType>

Это мой файл build.xml

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

<!-- 
    This project is not entirely handled by Maven, so be careful when generating the artifact, and use Ant with its default target.
 -->
<project name="devices-ws-authentication-provider" default="all" basedir=".">
    <echo>
    Remember to execute the command below before doing an Ant:

    %MW_HOME%\wlserver\server\bin\setWLSEnv.cmd
    </echo>

    <property name="src-java" value="src/main/java" />
    <property name="mbean" value="src/mbean" />

    <target name="all" depends="build" />

    <target name="build" depends="clean,build.mdf,build.mjf" />

    <target name="clean">
        <delete includeemptydirs="true" failonerror="false">
            <fileset dir="${mbean}" includes="**/*"/>
        </delete>
        <delete file="target/devices-ws-authentication-provider-1.0.0-SNAPSHOT.jar" failonerror="false" />

        <mkdir dir="target" />

        <echo message="Clean finish" />
    </target>

    <!-- helper to build an MDF (mbean definition file) -->
    <target name="build.mdf">
        <java dir="${basedir}" fork="false" classname="weblogic.management.commo.WebLogicMBeanMaker">
            <arg line="-files ${mbean}" />
            <arg value="-createStubs" />
            <arg line="-MDF src/main/resources/TntWSAuthenticator.xml" />
        </java>
        <echo message="Created Supporting Classes" />

        <move todir="${src-java}/fr/telecom/security/authentication/provider/mbean" file="${mbean}/TntWSAuthenticatorImpl.java" />
        <move todir="${src-java}/fr/telecom/security/authentication/provider/mbean" file="${mbean}//fr/telecom/security/authentication/provider/mbean/TntWSAuthenticatorMBean.java" />
    </target>

    <target name="build.mjf">
        <mkdir dir="${mbean}" />

        <copy todir="${mbean}">
            <fileset dir="src/main/java">
                <include name="**/*" />
            </fileset>
            <fileset dir="src/main/resources">
                <include name="**/*" />
            </fileset>
        </copy>

        <java dir="${basedir}" fork="false" classname="weblogic.management.commo.WebLogicMBeanMaker">
            <arg line="-MJF target/devices-ws-authentication-provider-1.0.0-SNAPSHOT.jar" />
            <arg line="-files ${mbean}" />
        </java>
        <echo message="Mbean JAR created." />

        <!-- Do a small cleanup after building the JAR, in order to not have duplicated sources / classes in source paths -->
        <!--
        <delete includeemptydirs="true" failonerror="false">
            <fileset dir="${mbean}" includes="fr/telecom/security/authentication/provider/*.java" />
            <fileset dir="${mbean}" includes="fr/telecom/domain/**/*.java" />
            <fileset dir="${mbean}" includes="commo.dtd" />
            <fileset dir="${mbean}" includes="rebel.xml" />
            <fileset dir="${mbean}" includes="TntWSAuthenticator.xml" />
        </delete>
        -->

    </target>

    <target name="install" depends="build">
        <copy todir="${user.home}/devices/lib" file="target/devices-ws-authentication-provider-1.0.0-SNAPSHOT.jar" />
    </target>

</project>

открытие сгенерированного уха я вижу, что есть некоторые недостающие папки и файлы, например

/schemacom_bea_xml/element
/schemacom_bea_xml/namespace
/schemacom_bea_xml/system
/schemacom_bea_xml/type
/weblogic/

Ответ 1

Поставщики WLS - это кошмар, у меня уже есть два, и теперь я использую Spring Security:) для простоты и переносимости.

Хорошо, я прочитал ваш build.xml, и это получилось странным для меня, но самое очевидное, что я вижу, это то, что вам не хватает следующего аргумента:

<arg line="-targetNameSpace your.namespace.here" />

внутри правила WebLogicMBeanMake ant. Попробуйте, но если это не сработает, я порекомендую вам повторить. Я могу предоставить вам несколько образцов.

Изменить

В ответ на ваш комментарий я включу здесь образец, который я уже работал в реальном проекте.

Это файл build.xml для запуска с и. Для запуска этого образца необходимо установить WLS 12c. Перед запуском ant buildAndDeploy вам нужно запустить ${WLS_HOME}/server/bin/setWLSEnv.sh script для подготовки среды.

Вам нужно адаптировать глобальные свойства в начале файла.

<project name="ldap-db-provider" default="buildAndDeploy" basedir=".">
    <description>Custom Authentication Provider Build</description>

    <!-- global properties -->
    <property name="base.dir" location="." />
    <property name="bea.home" location="/opt/weblogic/Oracle/Middleware/Oracle_Home" />
    <property name="mbean.maker" location="${bea.home}/wlserver/modules/com.bea.core.mbean.maker_2.1.0.0.jar" />
    <property name="wls.home" value="${bea.home}/wlserver" />
    <property name="wls.lib.dir" value="${wls.home}/server/lib" />
    <property name="mbeantypes.dir" value="${wls.lib.dir}/mbeantypes" />
    <property name="jar.file.name" value="your-name-for-the-provider-package.jar" />
    <property name="src.dir" value="${base.dir}/src" />
    <property name="provider.src.dir" value="${src.dir}/es" />
    <property name="build.dir" value="${base.dir}/build" />
    <property name="targetNamespace" value="your.target.name.space"/>
    <property name="mbean.impl.name" value="YouBeanName" />
    <property name="mbean.package" value="your/mbean/pacakage/name" />

    <target name="updateSources">
        <copy todir="${src.dir}/${mbean.package}" flatten="true">
            <fileset dir="${build.dir}">
                <include name="${mbean.impl.name}Impl.java" />
            </fileset>
        </copy>

        <copy todir="${src.dir}/${mbean.package}" flatten="true">
            <fileset dir="${build.dir}/${mbean.package}">
                <include name="**/*.java" />
            </fileset>
        </copy>
    </target>

    <target name="buildAndDeploy" depends="clean">
        <mkdir dir="${build.dir}" />

        <copy todir="${build.dir}" flatten="true">
            <fileset dir="${wls.lib.dir}">
                <include name="commo.dtd" />
            </fileset>
        </copy>

        <copy todir="${build.dir}" flatten="true">
            <fileset dir="${provider.src.dir}">
                <include name="**/*.xml" />
                <include name="**/*.java" />
            </fileset>
        </copy>

        <java 
            classname="weblogic.management.commo.WebLogicMBeanMaker" 
            fork="true" failonerror="true">
            <!-- <classpath refid="build.path"/> -->
            <arg line="-files ${build.dir}" />
            <arg value="-createStubs" />
            <arg line="-MDF ${build.dir}/${mbean.impl.name}-Mbean.xml" />
        </java>

        <echo message="Created Supporting Classes" />

        <java 
            classname="weblogic.management.commo.WebLogicMBeanMaker" 
            fork="true" failonerror="true">
            <!-- <classpath refid="build.path"/> -->
            <arg line="-MJF ${build.dir}/${jar.file.name}" />
            <arg line="-targetNameSpace ${targetNamespace}" />
            <arg line="-files ${build.dir}" />
        </java>

        <echo message="Created Mbean Jar" />

        <!-- Deploy the sample security providers -->
        <copy todir="${mbeantypes.dir}" flatten="true">
            <fileset dir="${build.dir}">
                <include name="${jar.file.name}" />
            </fileset>
        </copy>
    </target>

    <target name="clean">
        <delete quiet="true" dir="${build.dir}" />
        <delete>
            <fileset dir="${src.dir}/${mbean.package}" includes="**/*.java" />
        </delete>
        <delete quiet="true" file="${mbeantypes.dir}/${jar.file.name}" />
    </target>
</project>

Надеюсь, что это поможет!