1 2 Previous Next 15 Replies Latest reply on Jul 3, 2018 10:58 AM by kyatham

    RSA integration with wildlfy 8.2.1

    kyatham

      Hi,

      I am trying to integrate wildlfly with RSA .i.e for single sign on. Earlier this was working with jboss 4.2.3 by adding two files/jars

      • RSACookieAPI.jar
      • librsacookieapi.so

      in a specific folders. The same files we added in wildlfly server but somehow it is not working and it is giving error as

      Could not initialize class com.rsa.cookieapi.RSACookieAPI .

       

      We tried different ways by placing

      • RSACookieAPI.jar  in the class path and different modules but nothing is working. Can someone help with this.
        • 1. Re: RSA integration with wildlfy 8.2.1
          jewellgm

          I don't have any specific knowledge of the RSA libraries that you are using, but I can say that you will need to create a module for it to work.  Native libraries can only be loaded through modules in wildfly.  Also, given that you are coming from JBoss 4.2.3, I'd wager that your .so is compiled for 32-bit Linux.  If that is true, you will need to use a 32-bit JRE to run wildfly.  Check the documentation here for the directory structure that is needed for native libraries.  Each platform (in your case, probably 32-bit Linux) has to put the native libraries in a very specific location within the module.

           

          JBoss Modules: version 1.x

          1 of 1 people found this helpful
          • 2. Re: RSA integration with wildlfy 8.2.1
            kyatham

            Hi Greg,

             

            Thanks for your suggestions.

             

            I tried above mentioned ways but it is giving the same exception and not able to load RSACookieAPI.

             

            Do i need to configure anything.?

            • 3. Re: RSA integration with wildlfy 8.2.1
              jewellgm

              It's difficult to say without more information.  Is there any sort of stack trace in the log that you can provide?  It may contain more information that points to exactly what's happening.

               

              Are you certain that you are using the correct JRE (32 vs 64 bit)?  Is the native library in the correct directory for that JRE?

              • 4. Re: RSA integration with wildlfy 8.2.1
                kyatham

                Hi Greg,

                 

                There is no error log in the log files.

                 

                While debugging it just says : Could not initialize class com.rsa.cookieapi.RSACookieAPI.

                • 5. Re: RSA integration with wildlfy 8.2.1
                  jewellgm

                  Please post the wildfly module you created, showing the entire directory structure, the contents of each directory, and the contents of the module.xml.  Additionally, please show how you added the module dependency to your deployment(s).  Finally, please execute "java -version" to show whether you are executing a 32 or 64-bit JVM.

                  • 6. Re: RSA integration with wildlfy 8.2.1
                    kyatham

                    Hi, Below are the requested details:

                     

                    [root@hostname rsa]# pwd

                    /opt/wildfly/modules/com/xx/iam/rsa

                    [root@hostname rsa]# tree .

                    .

                    └── main

                        ├── lib

                        │   └── linux-x86_64

                        │       └── librsacookieapi.so

                        ├── module.xml

                        └── RSACookieAPI.jar

                     

                     

                    3 directories, 4 files

                    [root@hostname rsa]#

                     

                     

                    moudle.xml

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

                    <module xmlns="urn:jboss:module:1.1" name="com.xx.iam.rsa">

                            <resources>

                                    <resource-root path="RSACookieAPI.jar" />

                            </resources>

                            <dependencies>

                            </dependencies>

                    </module>

                     

                    jboss-deployment-structure.xml

                     

                     

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

                    <jboss-deployment-structure>

                            <deployment>

                                    <dependencies>

                                            <module name="com.xx.iam.rsa"  export="true" />

                                    </dependencies>

                            </deployment>

                            </sub-deployment>

                    </jboss-deployment-structure>

                     

                     

                     

                     

                    [root@hostname rsa]# java -version

                    java version "1.8.0_101"

                    Java(TM) SE Runtime Environment (build 1.8.0_101-b13)

                    Java HotSpot(TM) 64-Bit Server VM (build 25.101-b13, mixed mode)

                    [root@hostname rsa]#

                    • 7. Re: RSA integration with wildlfy 8.2.1
                      jewellgm

                      Thank you for the quick reply.  Are you absolutely certain that your librsacookieapi.so was compiled into a 64-bit library?  As I mentioned in the original post, given the age of the original system, I would guess that it's actually a 32-bit library.  Unfortunately, you cannot load a 32-bit native library using a 64-bit JRE.  You would either need to utilize a 32-bit JRE, or get/compile a 64-bit library.

                      • 8. Re: RSA integration with wildlfy 8.2.1
                        kyatham

                        Yes we are sure that librsacookieapi.so was compiled into a 64-bit library. The same is working fine when we use the Jboss 4.2.3 with the 64 bit JRE but not with the wildfly.

                        • 9. Re: RSA integration with wildlfy 8.2.1
                          jewellgm

                          You don't by any chance have the (Java) source code for RSACookieApi, do you?  It's possible that something in a static initializer is failing.  The class may be dependent on another class that isn't being found.  You may need to add another module as a dependency to your module, or you may need to put another jar directly into your module.

                           

                          With the hierarchical classloader from JBoss AS 4, the RSACookieApi may have seen something that was visible in JBoss 4, but (by default) is not visible in wildfly.

                          • 10. Re: RSA integration with wildlfy 8.2.1
                            kyatham

                            Thanks Greg, Below is the code of RSACookieAPI.jar

                             

                            package com.rsa.cookieapi;

                             

                             

                            import javax.servlet.http.HttpServletRequest;

                             

                             

                            public class RSACookieAPI

                            {

                              public static final int NO_ERROR = 0;

                              public static final int ERROR_CANNOT_ACCESS_SETTINGS = 100;

                              public static final int ERROR_VALID_COOKIE_NOT_FOUND = 101;

                              public static final int ERROR_DATA_TAG_NOT_FOUND = 102;

                              public static final int ERROR_NOT_ENOUGH_MEMORY = 103;

                              public static final int ERROR_INVALID_ARGUMENT = 104;

                              public static final int ERROR_CIPHERSUITE_ERROR = 105;

                              public static final int ERROR_LONGDATALEN_ENCRYPTION = 106;

                              public static final int ERROR_TOOMANY_ENCRYPTED_FIELDS = 107;

                              private String _servername;

                              private String _cookie;

                              private String _user;

                              private String _ip;

                              private String _agent;

                              private String _cookieapidata;

                             

                              static

                              {

                                System.loadLibrary("rsacookieapi");

                              }

                             

                              public RSACookieAPI(HttpServletRequest paramHttpServletRequest)

                              {

                                this._servername = paramHttpServletRequest.getServerName();

                                if (this._servername == null) {

                                  this._servername = "";

                                }

                                this._cookie = paramHttpServletRequest.getHeader("Cookie");

                                if (this._cookie == null) {

                                  this._cookie = "";

                                }

                                this._user = paramHttpServletRequest.getRemoteUser();

                                if (this._user == null) {

                                  this._user = "";

                                }

                                this._ip = paramHttpServletRequest.getRemoteAddr();

                                if (this._ip == null) {

                                  this._ip = "";

                                }

                                this._agent = paramHttpServletRequest.getHeader("User-Agent");

                                if (this._agent == null) {

                                  this._agent = "";

                                }

                                this._cookieapidata = paramHttpServletRequest.getHeader("rsacookieapidata");

                                if (this._cookieapidata == null) {

                                  this._cookieapidata = "";

                                }

                              }

                             

                              public String RSAGetWebIDURL()

                              {

                                return RSAGetWebIDURL(this._servername);

                              }

                             

                              public String RSAGetCSRFToken()

                              {

                                return RSAGetCSRFToken(this._servername, this._cookie, this._user, this._ip, this._agent, this._cookieapidata);

                              }

                             

                              public String RSAGetShellField()

                              {

                                String str = RSAGetShellField(this._servername, this._cookie, this._user, this._ip, this._agent, this._cookieapidata);

                                  return str;

                              }

                             

                              public String RSAGetUserName()

                              {

                                return RSAGetUserName(this._servername, this._cookie, this._user, this._ip, this._agent, this._cookieapidata);

                              }

                             

                              public String RSAGetTagField(String paramString, int paramInt)

                              {

                                return RSAGetTagField(this._servername, this._cookie, this._user, this._ip, this._agent, paramString, paramInt, this._cookieapidata);

                              }

                             

                              public String RSASetTagField(String paramString1, String paramString2, int paramInt)

                              {

                                return RSASetTagField(this._servername, this._cookie, this._user, this._ip, this._agent, paramString1, paramString2, paramInt, this._cookieapidata);

                              }

                             

                              public String RSASetTagField(String paramString1, String paramString2, String paramString3, int paramInt)

                              {

                                return RSASetTagField(this._servername, paramString1, this._user, this._ip, this._agent, paramString2, paramString3, paramInt, this._cookieapidata);

                              }

                             

                              public String RSADeleteTagField(String paramString)

                              {

                                return RSADeleteTagField(this._servername, this._cookie, this._user, this._ip, this._agent, paramString, this._cookieapidata);

                              }

                             

                              public String RSADeleteTagField(String paramString1, String paramString2)

                              {

                                return RSADeleteTagField(this._servername, paramString1, this._user, this._ip, this._agent, paramString2, this._cookieapidata);

                              }

                             

                              public native int RSAGetLastError();

                             

                              private native String RSAGetWebIDURL(String paramString);

                             

                              private native String RSAGetCSRFToken(String paramString1, String paramString2, String paramString3, String paramString4, String paramString5, String paramString6);

                             

                              private native String RSAGetShellField(String paramString1, String paramString2, String paramString3, String paramString4, String paramString5, String paramString6);

                             

                              private native String RSAGetUserName(String paramString1, String paramString2, String paramString3, String paramString4, String paramString5, String paramString6);

                             

                              private native String RSAGetTagField(String paramString1, String paramString2, String paramString3, String paramString4, String paramString5, String paramString6, int paramInt, String paramString7);

                             

                              private native String RSASetTagField(String paramString1, String paramString2, String paramString3, String paramString4, String paramString5, String paramString6, String paramString7, int paramInt, String paramString8);

                             

                              private native String RSADeleteTagField(String paramString1, String paramString2, String paramString3, String paramString4, String paramString5, String paramString6, String paramString7);

                            }

                            • 11. Re: RSA integration with wildlfy 8.2.1
                              kyatham

                              This is not our code.It is of RSA and its just has one class inside the jar.

                              • 12. Re: RSA integration with wildlfy 8.2.1
                                jewellgm

                                Have you tried adding the "javax.servlet.api" module as a dependency to your module?

                                • 13. Re: RSA integration with wildlfy 8.2.1
                                  kyatham

                                  Yes Greg,

                                  Its not working..

                                   

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

                                  <module xmlns="urn:jboss:module:1.1" name="com.xx.abc.rsa">

                                  <resources>

                                  <resource-root path="RSACookieAPI.jar" />

                                  </resources>

                                   

                                   

                                  <dependencies>

                                  <module name="javax.servlet.api" />

                                  </dependencies>

                                  </module>

                                  • 14. Re: RSA integration with wildlfy 8.2.1
                                    jewellgm

                                    This may just be you changing names in your post for intellectual property reasons, but I noticed that your new module.xml has a name of "com.xx.abc.rsa", whereas before you showed "com.xx.iam.rsa" with that same directory structure.  You didn't actually change the name of the module, did you?  I just have to ask to rule out what could be happening.

                                    1 2 Previous Next