Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correct authFormParams parameter loading #730

Merged
merged 1 commit into from Jan 19, 2021

Conversation

mattbucci
Copy link

This is relevant to #434
I couldn't get formAuthentication to pass additional form params correctly

I made a simple script containing

<?php var_dump($_POST); die(); ?>
website: 2021-01-14 18:50:28 INFO - Performing FORM authentication at "https://example.com/test.php" (username=username; password=*****)
website: 2021-01-14 18:50:28 INFO - Authentication status: HTTP/1.1 200 OK
website: 2021-01-14 18:50:28 DEBUG - Authentication response:
array(2) {
["username"]=>
string(8) "username"
["pass"]=>
string(8) "password"
}

I've tried both 2.8.1 and 2.9.1 but the authFormParams field doesn't seem to do anything

my config looks like

 <httpClientFactory class="com.norconex.collector.http.client.impl.GenericHttpClientFactory">
        <cookiesDisabled>false</cookiesDisabled>
        <maxRedirects>5</maxRedirects>
        <connectionTimeout>60000</connectionTimeout>
        <authFormCharset>UTF-8</authFormCharset>
        <authMethod>form</authMethod>
        <authURL>https://example.com/test.php</authURL>
        <authUsername>username</authUsername>
        <authPassword>password</authPassword>
        <authUsernameField>username</authUsernameField>
        <authPasswordField>pass</authPasswordField>
        <authFormParams>
          <param name="test">test</param>
        </authFormParams>
      </httpClientFactory>

After this change my response looks like

website: 2021-01-14 19:32:29 DEBUG - Authentication response:
array(3) {
 ["username"]=>
 string(8) "username"
 ["pass"]=>
 string(8) "password"
 ["test"]=>
 string(4) "test"
}

@essiembre essiembre merged commit d7d1b73 into Norconex:2.x-branch Jan 19, 2021
@essiembre
Copy link
Contributor

I just made a new snapshot release with this fix. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants