auth_header 0.0.3

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

auth_header

Utility library to parse and manipulate HTTP Authorisation header

Usage

A simple usage example:

import 'dart:io';
import 'package:auth_header/auth_header.dart';

main() {
  HttpRequest request;  //TODO get from the real request

  List<String> headers = request.headers[HttpHeaders.AUTHORIZATION];
  if(headers is! List) {
    throw new Exception('No authorization header!');
  }

  String header = headers.first;

  AuthHeaders authHeader = new AuthHeaders.fromHeaderStr(header);
  print(authHeader);

  AuthHeaderItem items = new AuthHeaderItem('some-scheme', 'teja');
  String headerManipulated = AuthHeaders.addItemToHeaderStr(header, items);
  print(headerManipulated);

  headerManipulated = AuthHeaders.removeSchemeFromHeaderStr(header, items.authScheme);
  print(headerManipulated);
}

Changelog

0.0.1

  • Utilities to parse and manipulate Authentication header

0.0.2

  • Added toAuthorizationHeader in AuthHeaders

example/auth_header_example.dart

// Copyright (c) 2016, Ravi Teja Gudapati. All rights reserved. Use of this source code
// is governed by a BSD-style license that can be found in the LICENSE file.

import 'dart:io';
import 'package:auth_header/auth_header.dart';

main() {
  HttpRequest request;  //TODO get from the real request

  List<String> headers = request.headers[HttpHeaders.AUTHORIZATION];
  if(headers is! List) {
    throw new Exception('No authorization header!');
  }

  String header = headers.first;

  AuthHeaders authHeader = new AuthHeaders.fromHeaderStr(header);
  print(authHeader);

  AuthHeaderItem items = new AuthHeaderItem('some-scheme', 'teja');
  String headerManipulated = AuthHeaders.addItemToHeaderStr(header, items);
  print(headerManipulated);

  headerManipulated = AuthHeaders.removeSchemeFromHeaderStr(header, items.authScheme);
  print(headerManipulated);
}

1. Depend on it

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


dependencies:
  auth_header: "^0.0.3"

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter packages get

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

3. Import it

Now in your Dart code, you can use:


import 'package:auth_header/auth_header.dart';
        
Version Uploaded Documentation Archive
0.0.3 Jul 16, 2017 Go to the documentation of auth_header 0.0.3 Download auth_header 0.0.3 archive
0.0.2 Dec 4, 2016 Go to the documentation of auth_header 0.0.2 Download auth_header 0.0.2 archive
0.0.1 Dec 4, 2016 Go to the documentation of auth_header 0.0.1 Download auth_header 0.0.1 archive

Analysis

We analyzed this package on Apr 23, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.0.0-dev.49.0
  • pana: 0.10.6

Scores

Popularity:
Describes how popular the package is relative to other packages. [more]
33 / 100
Health:
Code health derived from static analysis. [more]
100 / 100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100 / 100
Overall score:
Weighted score of the above. [more]
67
Learn more about scoring.

Platforms

Detected platforms: Flutter, other

Primary library: package:auth_header/auth_header.dart with components: io.

Suggestions

  • Fix .analysis_options.

    We were unable to parse .analysis_options.

  • Package is pre-v1 release.

    While there is nothing inherently wrong with versions of 0.*.*, it usually means that the author is still experimenting with the general direction API.

  • Use analysis_options.yaml.

    Rename old .analysis_options file to analysis_options.yaml.

  • Enable strong mode analysis.

    Strong mode helps you to detect bugs and potential issues earlier.Start your analysis_options.yaml file with the following:

    analyzer:
      strong-mode: true
    

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.0.0 <2.0.0
Dev dependencies
test >=0.12.0 <0.13.0