How the Consumer IP and Restricted IP works together ?

Last post 10-07-2008 6:01 AM by BarryR. 9 replies.
Page 1 of 1 (10 items)
Sort Posts: Previous Next
  • 10-03-2008 8:47 PM

    How the Consumer IP and Restricted IP works together ?

    Hello,

     This question is for BARRY.

    I am using your sample code ( PHPHostedFileManager ) and I used LOGINPROXY to authenticate and assign a session to the browser's IP address ( Client IP address ) 

    $request = "https://services.nirvanix.com/ws/Authentication/LoginProxy.ashx?appKey=$appkey&username=$username&password=$password&consumerIP=".$_SERVER['REMOTE_ADDR'];

    The consumerIP is the Client's IP address. I got a successful session based on the Client's IP address which is the desired result.

     Now in the second step I wanted to lookup the nearest Nirvanix Node based on the above consumer IP address. So made a second request where I passed the session ( which I retrieved in earlier request ) and the consumer IP as restricted IP which is same as the Browser's IP address , to determine the nearest Nirvanix Node to the Client's IP ( and not my server )

    $request = "https://services.nirvanix.com/ws/IMFS/GetStorageNode.ashx?sessionToken=$session_token&sizeBytes=10000000&restrictedIP=".$_SERVER['REMOTE_ADDR'];

    But I got an error saying  "...Session not found for ip = 85.17.209.36 " where as this IP is nothing but my server's IP where I am running the Nirvanix API which I never passed in either of the request above.

    What I want to do is

    1. The visitor logins to my existing website.

    2. They upload the video to their nearest Nirvanix Node ( In order to do this I need to make above two requst )

    But the second steps fails as it expecting a session based on my Server IP ( even if I provided the restrictedIP address as parameter) and not based on the Consumer IP.

    Please help. 

     

  • 10-06-2008 6:53 PM In reply to

    • BarryR
    • Top 10 Contributor
    • Joined on 07-20-2007
    • San Diego
    • Posts 614

    Re: How the Consumer IP and Restricted IP works together ?

     Keep in mind that the session you generate with LoginProxy is meant to generate a token you can pass to your client.  Meaning once generated, it no longer is useful at the server and should be passed to the client where it can be used as part of the URL to download a file in that session: http://services.nirvanix.com/SESSIONTOKEN/

    Regards,
         Barry R.

    IM Support (Feel free to add me)

    MSN: barryruffner@msn.com
    Gmail: barryruffner@gmail.com
  • 10-06-2008 8:12 PM In reply to

    Re: How the Consumer IP and Restricted IP works together ?

    Thanks barry for your reply. Your answer is mostly suited to the case when somebody wants to download a file and we want to validate him as an authorized client.

    But keeping the scenario what I had mentioned earlier , how PHP Script at the server lookup for a nearest node to the client's IP  ( not server ) ? So that the file will be uploaded to the nearest node of the visitor and not server. Please help.

    Prashant K Sahoo

  • 10-06-2008 8:27 PM In reply to

    • BarryR
    • Top 10 Contributor
    • Joined on 07-20-2007
    • San Diego
    • Posts 614

    Re: How the Consumer IP and Restricted IP works together ?

    Every download that comes in to services.nirvanix.com if it is a valid requestor (the session token, restricted IP token are correct and they are witihin whatever limits if they are set) will recieve a HTTP Redirect to the appropriate node.  So just be sure to honor the redirect (if its a browser it will do this automatically) and you will be sent to the closest node where the file exists.

    Regards,
           Barry R.

    IM Support (Feel free to add me)

    MSN: barryruffner@msn.com
    Gmail: barryruffner@gmail.com
  • 10-06-2008 8:40 PM In reply to

    Re: How the Consumer IP and Restricted IP works together ?

    Barry,

    Your reply is confusing . Here is what I am doing in my PHP code where I am using Nirvanix calls.

     $request = "https://services.nirvanix.com/ws/IMFS/GetStorageNode.ashx?sessionToken=$session_token&sizeBytes=10000000&restrictedIP=".$_SERVER['REMOTE_ADDR'];

    You can see I am looking up for a nearest node to the client's IP address. But as I said earlier it throws me error. Let me put this straight. I want to integrate Nirvanix API into my existing PHP Script. Now how Nirvanix API can let me know about the nearest node based on the Client's IP ( in my case the visitor's IP ) and not the Server IP in which my PHP Script and the integration is running.

    Is there any way ? The above code is always look me up the node based on the PHP Server's IP and not my client's IP .

     

     

  • 10-06-2008 8:56 PM In reply to

    • BarryR
    • Top 10 Contributor
    • Joined on 07-20-2007
    • San Diego
    • Posts 614

    Re: How the Consumer IP and Restricted IP works together ?

     You should just replace LoginProxy with Login, since that is the IP Address that will be requesting the web services.  Once you have that you will need to use GetStorageNodeExtended with consumerIP=".$_SERVER['REMOTE_ADDR'];  this will tell it to generate an upload token based on the remote address.  For security you should also use restrictedIP=".$_SERVER['REMOTE_ADDR'];  so only that remote IP Address can use the generated upload token.

    Regards,
         Barry R.

    IM Support (Feel free to add me)

    MSN: barryruffner@msn.com
    Gmail: barryruffner@gmail.com
  • 10-06-2008 9:44 PM In reply to

    Re: How the Consumer IP and Restricted IP works together ?

    Barry,

    I got to know now why you are replying in an undesired pattern. I wished you had read my original posting. Whatever you have suggested here that is what precisely I did and I had mentioned about it when I started this thread. ... I am copying and pasting it here... I am using LoginProxy , consumerIP and restrictedIP as well. Now will you take little bit pain to resolve this round and round loop with you ?

    Thanks.

     ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

    I am using your sample code ( PHPHostedFileManager ) and I used LOGINPROXY to authenticate and assign a session to the browser's IP address ( Client IP address ) 

    $request = "https://services.nirvanix.com/ws/Authentication/LoginProxy.ashx?appKey=$appkey&username=$username&password=$password&consumerIP=".$_SERVER['REMOTE_ADDR'];

    The consumerIP is the Client's IP address. I got a successful session based on the Client's IP address which is the desired result.

     Now in the second step I wanted to lookup the nearest Nirvanix Node based on the above consumer IP address. So made a second request where I passed the session ( which I retrieved in earlier request ) and the consumer IP as restricted IP which is same as the Browser's IP address , to determine the nearest Nirvanix Node to the Client's IP ( and not my server )

    $request = "https://services.nirvanix.com/ws/IMFS/GetStorageNode.ashx?sessionToken=$session_token&sizeBytes=10000000&restrictedIP=".$_SERVER['REMOTE_ADDR'];

    But I got an error saying  "...Session not found for ip = 85.17.209.36 " where as this IP is nothing but my server's IP where I am running the Nirvanix API which I never passed in either of the request above.

    ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

  • 10-06-2008 9:52 PM In reply to

    • BarryR
    • Top 10 Contributor
    • Joined on 07-20-2007
    • San Diego
    • Posts 614

    Re: How the Consumer IP and Restricted IP works together ?

     I read this, my suggestion to change loginproxy to Login remains, this will allow you to make the second call.  The token returned from the GetStorageNodeExtended is not associated with the session.  The only way the above would work is to have the client do the request to GetStorageNode.  Essentially, your client would have to make the request not the PHP server.

    Regards,
        Barry R.

    IM Support (Feel free to add me)

    MSN: barryruffner@msn.com
    Gmail: barryruffner@gmail.com
  • 10-06-2008 10:07 PM In reply to

    Re: How the Consumer IP and Restricted IP works together ?

    OK now I got the point. Do you mean I have to make calls through Javascript/AJAX ? Or is there any other type of call is possible from the browser  so that ?

  • 10-07-2008 6:01 AM In reply to

    • BarryR
    • Top 10 Contributor
    • Joined on 07-20-2007
    • San Diego
    • Posts 614

    Re: How the Consumer IP and Restricted IP works together ?

     That is one of the things you can do if you want to call from the browser itself.  Make sure if you are passing the session token to the client you call logout when finished so you don't have a loose session token available after you finish.

    Regards,
          Barry R.

    IM Support (Feel free to add me)

    MSN: barryruffner@msn.com
    Gmail: barryruffner@gmail.com
Page 1 of 1 (10 items)