Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Authentication Provider does not appear in the list of Authenticators in WebLogic Server Version: 12.1.3.0.0

I've just created an Authentication Provider for WebLogic Server Version: 12.1.3.0.0, put the jar in the lib of the domain, but does not appear in the List of Providers to select

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

This is my build.xml file

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

opening the generated ear I see that there is some missing folders and files, like

/schemacom_bea_xml/element
/schemacom_bea_xml/namespace
/schemacom_bea_xml/system
/schemacom_bea_xml/type
/weblogic/
like image 322
Nunyet de Can Calçada Avatar asked Nov 06 '15 15:11

Nunyet de Can Calçada


People also ask

What are providers in WebLogic?

WebLogic Server provides three RDBMS Authentication providers: SQL Authenticator, Read-only SQL Authenticator, and Custom RDBMS Authenticator.

Where does WebLogic store passwords?

The WebLogic Administrator username and password are used to start up the WebLogic Server instances. They are stored encrypted in the boot. properties file.

What is security realm in WebLogic?

A security realm comprises mechanisms for protecting WebLogic resources. Each security realm consists of a set of configured security providers, users, groups, security roles, and security policies (see Figure 4-1).


1 Answers

WLS providers is a nightmare, I have already developed two and now I am using Spring Security :) for the shake of simplicity and portability.

Well, I read your build.xml and it result strange for me, but the most obvious thing I see is that you lack the following argument:

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

inside WebLogicMBeanMake ant rule. Try it, but if it does not work I will recommend you to redo. I can provide you some samples.

Edit

In response to your comment, I will include here a sample that I have already working in a real project.

This is a build.xml file to be run with and. To run this sample it is required to have WLS 12c installed. Before run ant buildAndDeploy you have to run ${WLS_HOME}/server/bin/setWLSEnv.sh script to prepare environment.

You have to adapt global properties at the beginning of the file.

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

Hope it helps!

like image 191
malaguna Avatar answered Oct 16 '22 11:10

malaguna