12 Replies Latest reply on Jun 16, 2013 9:57 AM by Tamim Khan

    OAM 11g: Error while importing Custom Authentication Plug-in.

    915451
      We are trying to create a sample custom authentication plugin in OAM 11g as per the 11.1.1.5.0 doc.
      But while trying to import the plugin via oamconsole (system configuration->Plugins->Import Plugin) we receive an error "Invalid XML Structure".

      Do we have to embed the XSD (XML Schema Definition) as well ?

      -------------------------SamplePlugin.java-------------------------------------
      import oracle.security.am.plugin.ExecutionStatus;
      import oracle.security.am.plugin.MonitoringData;
      import oracle.security.am.plugin.PluginConfig;
      import oracle.security.am.plugin.authn.AuthenticationContext;
      import oracle.security.am.plugin.authn.AuthenticationException;
      import oracle.security.am.plugin.authn.AbstractAuthenticationPlugIn;
      import java.util.Map;
      import java.util.logging.Level;


      class SamplePlugin extends AbstractAuthenticationPlugIn {
           
           private static final String CLASS_NAME = "FirstTestClass";
           
           public ExecutionStatus initialize (PluginConfig config){
                super.initialize(config);
                if(LOGGER.isLoggable(Level.FINE)){
                     LOGGER.logp(Level.FINE,CLASS_NAME,"initialize","Entering initialize");
           }
                return ExecutionStatus.SUCCESS;
           }


           @Override
           public String getDescription() {
                // TODO Auto-generated method stub
                return null;
           }

           @Override
           public Map<String, MonitoringData> getMonitoringData() {
                // TODO Auto-generated method stub
                return null;
           }

           

           @Override
           public String getPluginName() {
                // TODO Auto-generated method stub
                return null;
           }

           @Override
           public int getRevision() {
                // TODO Auto-generated method stub
                return 0;
           }

           @Override
           public ExecutionStatus process(AuthenticationContext arg0)
                     throws AuthenticationException {
                if(LOGGER.isLoggable(Level.FINE)){
                     LOGGER.logp(Level.FINE,CLASS_NAME,"initialize","Entering process");
           }
                return ExecutionStatus.SUCCESS;
           }

           
           @Override
           public void setMonitoringStatus(boolean arg0) {
                // TODO Auto-generated method stub
                
           }


           @Override
           public boolean getMonitoringStatus() {
                // TODO Auto-generated method stub
                return false;
           }
           

      }
      -------------------------SamplePlugin.java-------------------------------------


      ------------------------SamplePlugin.xml--------------------------------
      <?xml version="1.0" encoding="UTF-8" ?>
      <Plugin name="SamplePlugin" type="Authentication">
      <author>Self</author>
      <email>whois@gmail.com</email>
      <creationDate>09:41:22, 2012-02-05</creationDate>
      <version>1</version>
      <description>SamplePlugin</description>
      <interface>oracle.security.am.plugin.authn.AbstractAuthenticationPlugIn</interface>
      <implementation>SamplePlugin</implementation>
      </Plugin>
      ------------------------SamplePlugin.xml--------------------------------

      ------------------------MANIFEST.MF--------------------------------
      Manifest-Version: 1.0
      Ant-Version: Apache Ant 1.8.2
      Bundle-Version: 1.0.0.qualifier
      Bundle-Name: SamplePlugin
      Bundle-Activator: SamplePlugin
      Bundle-ManifestVersion: 2
      Created-By: 1.6.0_24-b07 (Sun Microsystems Inc.)
      Import-Package: org.osgi.framework;version="1.3.0",oracle.security.am.
      plugin,oracle.security.am.plugin.authn,oracle.security.am.plugin.api,
      oracle.security.am.common.utilities.principal,oracle.security.idm,jav
      ax.naming,javax.sql,java.management,javax.security.auth
      Bundle-SymbolicName: SamplePlugin
      Bundle-RequiredExecutionEnvironment: JavaSE-1.6

      ------------------------MANIFEST.MF--------------------------------

      Contents of SamplePlugin.jar
      1. SamplePlugin.xml
      2. SamplePlugin.class
      3. META-INF/
      MANIFEST.MF
        • 1. Re: OAM 11g: Error while importing Custom Authentication Plug-in.
          Nishith Nayan
          You can verify the attribute tag used in your sampleplugin must exist in XSD If not update it and embad the same

          follow below link for detail steps
          http://docs.oracle.com/cd/E21764_01/doc.1111/e12491/authnapi.htm#BABDAIFB

          --nayan                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       
          • 2. Re: OAM 11g: Error while importing Custom Authentication Plug-in.
            915451
            Do I have to embed the SamplePlugin.xsd within the jar file?
            • 3. Re: OAM 11g: Error while importing Custom Authentication Plug-in.
              user10301737
              We are running into the same issue. Any help out there would be appreciated.
              • 4. Re: OAM 11g: Error while importing Custom Authentication Plug-in.
                user10301737
                <?xml version="1.0" encoding="UTF-8"?>
                <Plugin name="DemoAuthNPlugin" type="Authentication">
                     <author>me</author>
                     <email>me@us.army.mil</email>
                     <creationDate>11:40:20,2012-13-02</creationDate>
                     <version>1</version>
                     <description>Custom User Authentication Plugin</description>
                     <interface>oracle.security.am.plugin.authn.AbstractAuthenticationPlugIn</interface>
                     <implementation>logsa.army.mil.samplePlugin.DemoAuthNPlugin</implementation>
                     <configuration>
                     <AttributeValuePair>
                          <Attribute type="String" length="20">DataSource</Attribute>
                          <mandatory>true</mandatory>
                          <instanceOverride>false</instanceOverride>
                          <globalUIOverride>true</globalUIOverride>
                          <value>jdbc/CISCO</value>
                     </AttributeValuePair>
                </configuration>     
                </Plugin>

                We managed to get it working. I think a configuration attribute is required. Here is my xml. Hope this help.
                • 5. Re: OAM 11g: Error while importing Custom Authentication Plug-in.
                  kaon07
                  Yes. The above xml can work. No need to embed any XSD

                  I encountered this "Invalid XML Structure" because I put "0.1" for the version. After debugging, found out the "version" must be integer.

                  Some tips if you still hit this error:

                  The xml checking is done at oracle.security.am.extensibility.lifecycle.utils.XMLHandler, which is inside extensibility_lifecycle.jar.

                  You can change the OAM logger setting for this package to see the detail exception
                  • 6. Re: OAM 11g: Error while importing Custom Authentication Plug-in.
                    IDMuser19
                    I build the Plugin.jar file similarly as above(followed the same steps)..
                    But when i log into OAM and trying to import the plugin (System Configuration->Plugins- Import Plugin) the browser goes to hung state and i see below error in logs (domain log and in diag log)
                    I see the jar file created in this location (\Middleware\user_projects\domains\IAMdomain\oam\plugins)

                    Please let me know if you have any idea..Thanks!

                    ####<Feb 29, 2012 1:10:03 PM PST> <Warning> <oracle.adf.controller.internal.metadata.MetadataService> <spsolutions> <AdminServer> <[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'> <weblogic> <> <d6305b57ff260991:700b4664:135ca3d69dc:-8000-00000000000003fe> <1330549803273> <BEA-000000> <ADFc: /WEB-INF/adfc-config.xml: >
                    ####<Feb 29, 2012 1:10:03 PM PST> <Warning> <oracle.adf.controller.internal.metadata.MetadataService> <spsolutions> <AdminServer> <[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'> <weblogic> <> <d6305b57ff260991:700b4664:135ca3d69dc:-8000-00000000000003fe> <1330549803274> <ADFC-52024> <ADFc: Duplicate managed bean definition for 'accessCheck' detected.>
                    ####<Feb 29, 2012 1:10:03 PM PST> <Warning> <oracle.adfinternal.view.faces.renderkit.rich.RegionRenderer> <spsolutions> <AdminServer> <[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'> <weblogic> <> <d6305b57ff260991:700b4664:135ca3d69dc:-8000-0000000000000402> <1330549803479> <ADF_FACES-60099> <The region component with id: pt1:_lar has detected a page fragment with multiple root components. Fragments with more than one root component may not display correctly in a region and may have a negative impact on performance. It is recommended that you restructure the page fragment to have a single root component.>
                    ####<Feb 29, 2012 1:10:33 PM PST> <Error> <javax.enterprise.resource.webcontainer.jsf.application> <spsolutions> <AdminServer> <[ACTIVE] ExecuteThread: '3' for queue: 'weblogic.kernel.Default (self-tuning)'> <weblogic> <> <d6305b57ff260991:700b4664:135ca3d69dc:-8000-0000000000000593> <1330549833253> <BEA-000000> <java.lang.NullPointerException
                    javax.faces.el.EvaluationException: java.lang.NullPointerException
                         at org.apache.myfaces.trinidad.component.MethodExpressionMethodBinding.invoke(MethodExpressionMethodBinding.java:51)
                         at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)
                         at org.apache.myfaces.trinidad.component.UIXCommand.broadcast(UIXCommand.java:190
                    ####<Feb 29, 2012 1:10:33 PM PST> <Warning> <oracle.adfinternal.view.faces.lifecycle.LifecycleImpl> <spsolutions> <AdminServer> <[ACTIVE] ExecuteThread: '3' for queue: 'weblogic.kernel.Default (self-tuning)'> <weblogic> <> <d6305b57ff260991:700b4664:135ca3d69dc:-8000-0000000000000593> <1330549833316> <BEA-000000> <ADF_FACES-60098:Faces lifecycle receives unhandled exceptions in phase INVOKE_APPLICATION 5
                    javax.faces.FacesException: #{FileProcessor.doUpload}: java.lang.NullPointerException
                         at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:118)
                         at org.apache.myfaces.trinidad.component.UIXCommand.broadcast(UIXCommand.java:190)
                         at oracle.adf.view.rich.component.rich.RichPopup$BroadcastContextCallback.invokeContextCallback(RichPopup.java:666)
                         at org.apache.myfaces.trinidad.component.UIXComponentBase.invokeOnComponent(UIXComponentBa

                    >
                    ####<Feb 29, 2012 1:10:33 PM PST> <Error> <oracle.oam.admin.console.policy> <spsolutions> <AdminServer> <[ACTIVE] ExecuteThread: '3' for queue: 'weblogic.kernel.Default (self-tuning)'> <weblogic> <> <d6305b57ff260991:700b4664:135ca3d69dc:-8000-0000000000000593> <1330549833361> <OAM-400016> <Failed to authenticate the user
                    javax.servlet.ServletException: java.lang.NullPointerException
                         at javax.faces.webapp.FacesServlet.service(FacesServlet.java:277)
                         
                    ####<Feb 29, 2012 1:10:34 PM PST> <Warning> <oracle.adf.view.rich.component.fragment.UIXRegion> <spsolutions> <AdminServer> <[ACTIVE] ExecuteThread: '3' for queue: 'weblogic.kernel.Default (self-tuning)'> <weblogic> <> <d6305b57ff260991:700b4664:135ca3d69dc:-8000-000000000000059a> <1330549834008> <ADF_FACES-00009> <Error processing viewId: /plugin-taskflow/authplugins URI: /oracle/security/am/taskflows/authplugin.jsff actual-URI: /oracle/security/am/taskflows/authplugin.jsff.
                    javax.el.ELException: java.lang.NullPointerException
                         at javax.el.BeanELResolver.getValue(BeanELResolver.java:266)
                         at com.sun.faces.el.DemuxCompositeELResolver._getValue(DemuxCompositeELResolver.java:173)
                         at oracle.adfinternal.view.faces.renderkit.rich.PanelCollectionRenderer$PanelCollectionHelper._encodeAll(PanelCollectionRenderer.java:728)
                         at oracle.adfinternal.view.faces.renderkit.rich.PanelCollectionRenderer$PanelCollectionHelper.access$500(PanelCollectionRenderer.java:537)
                         at oracle.adfinternal.view.faces.renderkit.rich.PanelCollectionRenderer.encodeAll(PanelCollectionRenderer.java:402)
                         at oracle.adf.view.rich.render.RichRenderer.encodeAll(RichRenderer.java:1396)
                         at org.apache.myfaces.trinidad.render.CoreRenderer.encodeEnd(CoreRenderer.java:335)
                         at org.apache.myfaces.trinidad.component.UIXComponentBase.encodeEnd(UIXComponentBase.java:767)
                         at javax.faces.component.UIComponent.encodeAll(UIComponent.java:937)

                    ####<Feb 29, 2012 1:10:34 PM PST> <Warning> <oracle.adfinternal.view.faces.lifecycle.LifecycleImpl> <spsolutions> <AdminServer> <[ACTIVE] ExecuteThread: '3' for queue: 'weblogic.kernel.Default (self-tuning)'> <weblogic> <> <d6305b57ff260991:700b4664:135ca3d69dc:-8000-000000000000059a> <1330549834020> <BEA-000000> <ADF_FACES-60098:Faces lifecycle receives unhandled exceptions in phase RENDER_RESPONSE 6
                    javax.faces.FacesException: javax.el.ELException: java.lang.NullPointerException
                         at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._renderResponse(LifecycleImpl.java:804)
                         at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._executePhase(LifecycleImpl.java:294)
                         at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:214)
                    • 7. Re: OAM 11g: Error while importing Custom Authentication Plug-in.
                      kaon07
                      I did not encounter such error during 'Import' but did hit a lot of errors during 'distribute', 'activate', 'deactivate' and 'remove'.

                      What I did is to restart the OAM admin server and managed servers, than it works fine.

                      So it is very painful process for me when developing the custom plugin because each update may potentially result in a server start.... The functions are just not working...
                      • 8. Re: OAM 11g: Error while importing Custom Authentication Plug-in.
                        IDMuser19
                        Thanks for the reply..
                        I am able to import the plugin now.. hope i don't get issues later while 'distribute', 'activate' stage :)
                        One more important thing i observed is jar name should be same as class name and in the MANIFEST.MF file Import-Package: list should be what you used in the code

                        Thanks!
                        • 9. Re: OAM 11g: Error while importing Custom Authentication Plug-in.
                          IDMuser19
                          I am able to upload the plugin now..
                          yeah looks like we need to restart the OAM admin server and managed servers every time.
                          and one more thing i observed is the MANIFEST.MF should not have the java.* packages :)

                          Thanks!
                          • 10. Re: OAM 11g: Error while importing Custom Authentication Plug-in.
                            Filip Huysmans
                            Hi IDMUser19,

                            How did you resolve the "Failed to authenticate the user"-error?

                            Thank you in advance.

                            Filip Huysmans.
                            • 12. Re: OAM 11g: Error while importing Custom Authentication Plug-in.
                              Tamim Khan

                              Hi,

                              I have write same Java code and activate it successfully. My problem is I am unable to login in the application.

                              I am return ExecutionStatus.SUCCESS from my Java code and I have only one step where I have attached Plugin and my Steps Orchestration is

                              On Success -> Success

                              On Failure -> Failure

                              On Error -> Failure

                               

                              What are the thing I need to configure, can anyone help me.

                               

                              Thanks

                               

                              Tamim Khan