http_auth 0.2.0

  • README.md
  • CHANGELOG.md
  • Example
  • Installing
  • Versions
  • 24

http_auth

An http middleware for HTTP authentication (Basic/Digest).

Usage

HTTP Basic authentication:

    import 'package:http_auth/http_auth.dart';

    main() async {
      var client = http_auth.BasicAuthClient('user', 'passwd');
      var response = client.get('http://httpbin.org/basic-auth/user/passwd');
    }

HTTP Digest authentication:

    import 'package:http_auth/http_auth.dart';

    main() async {
      var client = http_auth.DigestAuthClient('user', 'passwd');
      var response = client.get('http://httpbin.org/digest-auth/auth/user/passwd');
    }

Synchronous usage is also possible (see the example).

0.2.0

  • Upgraded for Dart 2.0 stable

0.1.3

  • Upgraded dependencies

0.1.2

  • Fixed handling of requests with a body.

0.1.1

  • Fixed nonce counter.

0.1.0

  • Initial version.

example/http_auth_example.dart

// Copyright (c) 2018, Marco Esposito (marcoesposito1988@gmail.com).
// Please see the AUTHORS file for details. All rights reserved.
// Use of this source code is governed by a BSD-style license
// that can be found in the LICENSE file.

import 'package:http_auth/http_auth.dart';

main() {
  var client = new DigestAuthClient("user", "passwd");

  final url = 'http://httpbin.org/digest-auth/auth/user/passwd';

  client.get(url).then((r) => print(r.body));
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  http_auth: ^0.2.0

2. Install it

You can install packages from the command line:

with pub:


$ pub get

Alternatively, your editor might support pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:http_auth/http_auth.dart';
  
Version Uploaded Documentation Archive
0.2.0 Sep 11, 2018 Go to the documentation of http_auth 0.2.0 Download http_auth 0.2.0 archive
0.1.3 Jun 14, 2018 Go to the documentation of http_auth 0.1.3 Download http_auth 0.1.3 archive
0.1.2 Jun 11, 2018 Go to the documentation of http_auth 0.1.2 Download http_auth 0.1.2 archive
0.1.1 May 16, 2018 Go to the documentation of http_auth 0.1.1 Download http_auth 0.1.1 archive
0.1.0 May 3, 2018 Go to the documentation of http_auth 0.1.0 Download http_auth 0.1.0 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
47
Health:
Code health derived from static analysis. [more]
0
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
0
Overall:
Weighted score of the above. [more]
24
Learn more about scoring.

The package version is not analyzed, because it does not support Dart 2. Until this is resolved, the package will receive a health and maintenance score of 0.

Analysis issues and suggestions

Fix dependencies in pubspec.yaml.

Running pub upgrade failed with the following output:

ERR: The current Dart SDK version is 2.0.0.
 
 Because http_auth depends on cryptoutils >=0.1.1 which requires SDK version <2.0.0, version solving failed.

Health suggestions

Format lib/http_auth.dart.

Run dartfmt to format lib/http_auth.dart.

Format lib/src/http_auth_basic.dart.

Run dartfmt to format lib/src/http_auth_basic.dart.

Format lib/src/http_auth_digest.dart.

Run dartfmt to format lib/src/http_auth_digest.dart.

Format lib/src/http_auth_utils.dart.

Run dartfmt to format lib/src/http_auth_utils.dart.

Maintenance issues and suggestions

Fix platform conflicts. (-20 points)

Error(s) prevent platform classification:

Fix dependencies in pubspec.yaml.

Running dartdoc failed. (-10 points)

Make sure dartdoc runs without any issues.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0 <3.0.0