auth_header 0.0.3

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

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:

$ 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:auth_header/auth_header.dart';

About

Utility library to parse and manipulate HTTP Authorisation header

Author

Email tejainece@gmail.com Ravi Teja Gudapati

Homepage

jaguar-dart.github.io

Documentation

www.dartdocs.org/documentation/auth_header/0.0.3/

Source code (hyperlinked)

www.crossdart.info/p/auth_header/0.0.3/

Uploader

tejainece@gmail.com

Share