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

Ability to use NTLM credentials appears to have been removed #148

Open
idlem1nd opened this issue Apr 27, 2018 · 1 comment
Open

Ability to use NTLM credentials appears to have been removed #148

idlem1nd opened this issue Apr 27, 2018 · 1 comment

Comments

@idlem1nd
Copy link

I was looking for the ability to use NTLM credentials and 6e0a414 looked promising, however it seems this code has been removed when the library was migrated to use HttpClient instead of HttpWebRequest.

It looks to be a case of just providing the ability to set UseDefaultCredentials = true in Http.fsL641. (Sorry - I don't have the ability to branch the source or do a PR from here...)

@seanamos
Copy link
Collaborator

seanamos commented Apr 30, 2018

You can do this now by creating a HttpClientHandler with the appropriate settings:

let ntlmHttpClient = new HttpClient(new HttpClientHandler(UseDefaultCredentials = true))

let createRequestWithNtlm (method: HttpMethod) (url: string) =
    Uri (url) |> Request.createWithClient ntlmHttpClient method

let request =
    "http://requiresNtml"
    |> createRequestWithNtlm Get
    |> Request.etc....

It's just important to remember that the HttpClient itself needs to be reused and not created/disposed per-request. You could do that at your application root and pass it around as a func / partially applied, or just have it as I've done above and re-use the createRequestWithNtlm function.

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

No branches or pull requests

3 participants