java – 认证提供程序不会出现在WebLogic Server版本:12.1.3.0.0中的身份验证器列表中

前端之家收集整理的这篇文章主要介绍了java – 认证提供程序不会出现在WebLogic Server版本:12.1.3.0.0中的身份验证器列表中前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我刚刚为WebLogic Server版本创建了一个身份验证提供程序:12.1.3.0.0,将该jar放在域的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's mbean as the factory for your provider's 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's 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/

解决方法

WLS提供商是一场恶梦,我已经开发了两个,现在我正在使用Spring Security :)来简化和移植.

那么,我读了你的build.xml,对我来说很奇怪,但是我看到的最明显的事情是你缺少以下参数:

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

内部WebLogicMBean制作蚂蚁规则.尝试它,但如果它不工作,我会建议你重做.我可以提供一些样品.

编辑

为了回应你的意见,我将在这里列出一个我已经在一个真正的项目中工作的样本.

这是一个要运行的build.xml文件.要运行此示例,需要安装WLS 12c.运行ant buildAndDeploy之前,您必须运行${WLS_HOME} /server/bin/setWLSEnv.sh脚本来准备环境.

您必须在文件开头调整全局属性.

<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>

希望有帮助!

原文链接:https://www.f2er.com/java/124897.html

猜你在找的Java相关文章