taskManeage - Tasks: task #16246, Database authentication with Wget

 
 

You are not allowed to post comments on this tracker with your current authentication level.

task #16246: Database authentication with Wget

Submitter:  Mohammad Akhlaghi <makhlaghi>
Submitted:  Thu 25 Aug 2022 03:10:00 PM UTC
   
 
Should Start On:  Wed 24 Aug 2022 11:00:00 PM UTC Should be Finished on:  Wed 24 Aug 2022 11:00:00 PM UTC
Category:  Analysis Priority:  5 - Normal
Status:  Done Privacy:  Public
Assigned to:  makhlaghi Percent Complete:  100%
Open/Closed:  Closed Effort:  0.00

Jump to the original submission

Fri 02 Sep 2022 05:56:12 PM UTC, comment #6: 

I am happy to say that the first implementation of this task has been completed and has been merged into the main Maneage branch as Commit 43186705.

If there are any problems or improvements, we should open other bugs or tasks. So I am closing this task.

Mohammad Akhlaghi <makhlaghi>
Group administrator
Sat 27 Aug 2022 06:39:08 AM UTC, comment #5: 

Good point Mohammad: the infrastructure is there now :)

AFAIK APIs do not always use the same variable names with POST requests. For instance, you might see a variety of keywords for authenticating the USER such as: 'user', 'username', 'name', 'email', etc.

So as you pointed out, the user should edit the values to fit their needs!

I tested with a sample REST API application, and using 'wget' had many quirks!


wget --method=POST --body-data='{email:"dev@dev.dev",password:123456}' http://restapi.adequateshop.com/api/authaccount/login --debug --header "Content-Type: application/json"


If I didn't provide the "Content-Type: application/json" in the header, it would assume "Content-Type: application/x-www-form-urlencoded". The server did not accept this and things went south.

So as we can see here, it looks like the request is highly dependent on the way the API was designed. It's not worth the effort :-) Maneagers can contact us if they need further support and do not know how to send requests to their specific API.

Pedram Ashofteh-Ardakani <pedram>
Group Member
Fri 26 Aug 2022 05:38:52 PM UTC, comment #4: 

Thanks for the clarification Pedram.

Unfortunately changing the 'username' to 'user' in the post-data mode didn't help! In time. Have you tried this type of authentication yourself?

If not, some Maneagers will definitely confront the post-data method for some database, and we'll correct it if necessary in a real-world scenario ;-). The important thing is that the infrastructure is now in place, and can be corrected/edited/added-to easily ;-).

Mohammad Akhlaghi <makhlaghi>
Group administrator
Fri 26 Aug 2022 03:46:32 PM UTC, comment #3: 

Great! Just a clarification about the methods:

The '--user' and '--password' options work for both FTP and HTTP file retrieval as stated in the man page. However, the '--postdata' method uses the HTTP POST method which sends the argument string as the data.

I can also see that the example uses '--post-data="user=XXXX&password=YYYY"', maybe it is worth to try checking with 'user' instead of 'username' in the '--post-data' option :)

Pedram Ashofteh-Ardakani <pedram>
Group Member
Fri 26 Aug 2022 02:52:27 PM UTC, comment #2: 

Thanks for the good point Pedram.

I just checked with the database I was using and the '--post-data' option didn't work there!

So in commits 6d1238537 and 7532d5b8, I added a new variable for the users to set called 'DATABASEAUTHTYPE', where they can choose which type of authentication should be used. This will allow us to easily add new authentication schemes in the future also :-)

Mohammad Akhlaghi <makhlaghi>
Group administrator
Fri 26 Aug 2022 05:28:21 AM UTC, comment #1: 

Hi Mohammad, sometimes the basic HTTP authenication (i.e. --user and --password options) can raise errors like "unknown authentication scheme".

Instead, you can pass the authentication credentials with the POST method, like so:


wget --post-data 'username=XXXX&password=yyyyyyyy'


Can you check if it works with your current authentication?


Pedram Ashofteh-Ardakani <pedram>
Group Member
Thu 25 Aug 2022 03:10:00 PM UTC, original submission:  

With Commit f9afbf77c262, I have started a branch to add database authentication options to Maneage (optionally passing the '--user' and '--password' options to 'wget' when downloading inputs).

I will hopefully merge this branch into the Maneage branch in about a week. It would be great if you could have a look at the changes and share your thoughts and ideas: there may be better ways to do this.

Mohammad Akhlaghi <makhlaghi>
Group administrator

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by pedram (Posted a comment)
  • -email is unavailable- added by makhlaghi (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    Follow 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2022-09-02 makhlaghi StatusIn Progress Done
        Percent Complete70% 100%
        Open/ClosedOpen Closed
    2022-08-26 pedram Percent Complete80% 70%
    2022-08-26 makhlaghi Percent Complete70% 80%

    Back to the top

    Powered by Savane 3.13-4b48.
    Corresponding source code