jaguar_jwt 0.3.4 copy "jaguar_jwt: ^0.3.4" to clipboard
jaguar_jwt: ^0.3.4 copied to clipboard

outdatedDart 1 only

JWT utilities for Jaguar.dart

Build Status

jaguar_jwt #

JWT utilities for Dart and Jaguar.dart

Usage #

Issuing JWT token #

  final key = 'dfsdffasdfdgdfgdfg456456456';
  final claimSet = new JwtClaim(
      subject: 'kleak',
      issuer: 'teja',
      audience: <String>['example.com', 'hello.com'],
      payload: {'k': 'v'});
  String token = issueJwtHS256(claimSet, key);
  print(token);

Decoding JWT token #

  final JwtClaim decClaimSet = verifyJwtHS256Signature(token, key);
  print(decClaimSet.toJson());

Validating JWT token #

  decClaimSet.validate(issuer: 'teja', audience: 'hello.com');

Configuration #

JwtClaimSet #

JwtClaimSet is the model to holds JWT claim set information. To issue a JWT token, it needs:

  1. issuer
    Authority issuing the token. This will be used during authorization to verify that expected issuer has issued the token. Fills the iss field of the JWT token.
  2. Subject
    Subject of the JWT token. Usually stores the user ID of the user to which the token is issued. Fills the sub field of the JWT token.
  3. audience
    List of audience that accept this token. This will be used during authorization to verify that JWT token has expected audience for the service. Fills aud field in JWT token.
  4. expiry
    Time at which the token expires. Fills exp field in JWT token.
  5. jwtId
    Unique identifier across services that identifies the token. Fills jti field in JWT token.
75
likes
0
pub points
96%
popularity

Publisher

unverified uploader

JWT utilities for Jaguar.dart

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

auth_header, crypto

More

Packages that depend on jaguar_jwt