Forum Discussion

patrickmamaid_1's avatar
patrickmamaid_1
Icon for Nimbostratus rankNimbostratus
Dec 05, 2008

ldap auth, bigip client app

Hi I am building a bigip-client-management java console app

 

and i am getting the following error when i run it:

 

 

     
   Exception in thread "main" AxisFault   
    faultCode: {http://xml.apache.org/axis/}HTTP   
    faultSubcode:    
    faultString: (401)F5 Authorization Required   
    faultActor:    
    faultNode:    
    faultDetail:    
           {}:return code:  401   
      
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">   
      
      
   Authentication required!   
      
      
      
      
      
      
      
   Authentication required!   
      
      
      
       This server could not verify that you are authorized to access   
       the URL "/iControl/iControlPortal.cgi".   
       You either supplied the wrong credentials (e.g., bad password), or your   
       browser doesn't understand how to supply the credentials required.   
      
        
      
      
      
       In case you are allowed to request the document, please   
       check your user-id and password and try again.   
      
      
      
   Error 401   
      
     10.20.10.10
   
        
     Thu Dec  4 17:45:54 2008
   
        
      
      
      
      
      
           {http://xml.apache.org/axis/}HttpErrorCode:401   
      
   (401)F5 Authorization Required   
           at org.apache.axis.transport.http.HTTPSender.readFromSocket(HTTPSender.java:744)   
           at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:144)   
           at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)   
           at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)   
           at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)   
           at org.apache.axis.client.AxisClient.invoke(AxisClient.java:165)   
           at org.apache.axis.client.Call.invokeEngine(Call.java:2784)   
           at org.apache.axis.client.Call.invoke(Call.java:2767)   
           at org.apache.axis.client.Call.invoke(Call.java:2443)   
           at org.apache.axis.client.Call.invoke(Call.java:2366)   
           at org.apache.axis.client.Call.invoke(Call.java:1812)   
           at iControl.LocalLBPoolBindingStub.get_list(LocalLBPoolBindingStub.java:1533)   
           at icontrolproject.Main.main(Main.java:54)   
   Java Result: 1   
     

 

 

 

This is my code:

 

     
     package icontrolproject;     
     import iControl.LocalLBPoolPortType;     
     import java.rmi.RemoteException;     
     import java.util.logging.Level;     
     import java.util.logging.Logger;     
          
     public class Main {     
         public static void main(String[] args) throws RemoteException {     
             iControl.Interfaces interfaces = new iControl.Interfaces();     
             if (interfaces.initialize("10.20.10.10", (long)443, "login", "pass") {     
                 LocalLBPoolPortType t = null;     
                 try {     
                     t = interfaces.getLocalLBPool();     
                 } catch (Exception ex) {     
                     Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);     
                 }     
                 String x[] = t.get_list();     
                 for (int i = 0; i < x.length; i++) {     
                     System.out.println(x[ i ]);     
                 }     
             }     
          
         }     
     }     
          
     

 

 

I have added myself as an administrator with console rights to bigip however We use LDAP authentication at work would that be the problem here?

 

 

 

 

  • LDAP shouldn't be an issue as long as you can login to the admin gui with the user "login" and password "pass". Did you replace those values in your code sample from your real logins or were you using that to try to login. If so, then try to open a browser to

     

     

    https://10.20.10.10 and see if you can login with the same credentials.

     

     

    iControl uses the same web server and authentication mechanism as the GUI so if you can get in with one, you should be able to get in with the other. The error you are passing implies that you are using invalid credentials.

     

     

    -Joe
  • yes I replaced those values using my own login and pass and I can log in to bigip through https://10.20.10.10 using them.

     

    hmm.. Is it even possible to write a console application that communicates with bigip without a broswer?
  • actually for my password i have a couple of "" characters so i replaced it with a url safe "%23" could this be the problem then?
  • yes I replaced those values using my own login and pass and I can log in to bigip through https://10.20.10.10 using them.

     

    hmm.. Is it even possible to write a console application that communicates with bigip without a broswer?

     

     

     

    It is absolutely possible to write a console app using java as that is what all the samples in the SDK are.

     

     

    actually for my password i have a couple of "" characters so i replaced it with a url safe "%23" could this be the problem then?

     

     

     

    You shouldn't have to do anything to your password as it is not sent in the URI. A WWW-Authenticate header is passed with the digest of the username and password.

     

     

    I'm not sure what's going on on your end but I just copied you code into a Main.java file, changed the hostname, username, and password to my BIG-IP's info, compiled and ran the app and it correctly executed the get_list method and returned the list to the console.

     

     

    The one thing I did find in your code was that there was a compile error on the initialize line

     

     

    if (interfaces.initialize("theboss", (long)443, "admin", "admin") {

     

     

    You are missing a closing parenthesis around the if. Could it be that your compile is failing and you are running an old version of the compiled file?

     

     

    I changed the line to the following:

     

     

    if (interfaces.initialize("mybigip", (long)443, "myusername", "mypassword") ) {

     

     

    To get it to compile and run.

     

     

    -Joe
  • I got it to work!!

     

    I changed my password and removed the character

     

    it seems like it does not like my pound character in my password

     

    but why..?
  • if (interfaces.initialize("mybigip", (long)443, "myusername", "mypassword") ) {

    Sorry about that I corrected this line on my end without updating the thread

  • That's bizarre about the in the password. I wonder if the Java libraries is doing something funky with it. I'll test it out with java and the other toolkits and do some traces to see what's going on.

     

     

    Thanks for the update!

     

     

    -Joe
  • Hey Joe the problem still persists when I use special characters in the password string ie: !@$% in my case I use a

     

    I'm wondering if you are able to replicate it?