ntlm 1.3.0
ntlm: ^1.3.0

Dart native js
Flutter Android iOS web

Library for making HTTP requests that require NTLM authentication

NTLM #

A library for NTLM authentication in Dart/Flutter.

Installing #

Add the dependency to your pubspec.yaml file:

dependencies:
  ntlm: ^1.3.0

Example #

import 'package:ntlm/ntlm.dart';

main() {
  NTLMClient client = new NTLMClient(
    domain: "",
    workstation: "LAPTOP",
    username: "User208",
    password: "password",
  );

  client.get("https://example.com/").then((res) {
    print(res.body);
  });
}

You can also pre-hash the password and use those results instead:

String lmPassword = lmHash("password");
String ntPassword = ntHash("password");

NTLMClient client = new NTLMClient(
  domain: "",
  workstation: "LAPTOP",
  username: "User208",
  lmPassword: lmPassword,
  ntPassword: ntPassword,
);

If your server only supports the Negotiate authentication scheme, you can change the header prefix to Negotiate using the headerPrefix parameter:

NTLMClient client = new NTLMClient(
  domain: "",
  workstation: "LAPTOP",
  username: "User208",
  password: "password",
  headerPrefix: kHeaderPrefixNegotiate,
);

Note that this still only uses the NTLM authentication scheme, not Kerberos.

Flutter Web Support #

For cross-origin requests, make sure your server includes the following headers in responses:

Access-Control-Allow-Origin: <your_origin>
Access-Control-Expose-Headers: WWW-Authenticate
Access-Control-Allow-Headers: Authorization
Access-Control-Allow-Credentials: true

This allows the package to both view NTLM messages sent by the server and send requests with NTLM messages.

Acknowledgements #

Created from templates made available by Stagehand under a BSD-style license.

The DES code is a port of Bouncy Castle's DES Engine.

Most of the NTLM response creation code is a port of SamDecrock/node-http-ntlm which itself is a port of mullender/python-ntlm.

Password hashing functions for the type 3 message are ports of the Java code on this page.

2
likes
95
pub points
72%
popularity

Publisher

mrbbot.dev

Library for making HTTP requests that require NTLM authentication

Repository (GitHub)
View/report issues

Documentation

API reference

License

Unlicense (LICENSE)

Dependencies

fixnum, http, pointycastle, utf

More

Packages that depend on ntlm