Build Status

jaguar_jwt

JWT authentication interceptor for Jaguar

Usage

A simple usage example:

library jaguar_jwt.example;

import 'package:dart_jwt/dart_jwt.dart';
import 'package:jaguar_jwt/jaguar_jwt.dart';

void main() {
  //Issuing a JWT token
  JaguarJwtEncoder encoder = new JaguarJwtEncoder(
      new JwaSymmetricKeySignatureContext('dfsdffasdfdgdfgdfg456456456'),
      'teja',
      audience: <String>['admin', 'students']);

  JaguarJwtClaimSet claimSet = new JaguarJwtClaimSet(
      'kleak', encoder.issuer, encoder.audience, {'k': 'v'});
  String encoded = encoder.encodeToken(claimSet);
  print(encoded);

  //Decoding a token
  JaguarJwtDecoder decoder = new JaguarJwtDecoder(
      new JwaSymmetricKeySignatureContext('dfsdffasdfdgdfgdfg456456456'),
      'teja',
      audience: <String>['students']);
  JsonWebToken decoded = decoder.decodeToken(encoded);
  print(decoded.claimSet.toJson());
}

Libraries

jaguar_jwt

Support for doing something awesome.