jaguar_session_jwt 2.4.2

jaguar_session_jwt #

JWT session managers for Jaguar.

JwtSession #

JWT session manager implements SessionManager that stores session data in JWT format.

Usage #

Declare JwtConfig:

const jwtConfig = const JwtConfig('sdgdflgujsdgndsflkgjsdlnwertwert78676',
    issuer: '');

Set JwtSession as sessionManager in Jaguar's constructor:

main() async {
  final server = Jaguar(sessionManager: JwtSession(jwtConfig));
  // add routes here
  await server.serve();

Configuration #

JwtSession can be configured using config and validationConfig parameters.

config takes the information required to issue, sign and decode JWT tokens. Some of the important parameters are:

issuer: Issuer used in iss field of JWT audience: Audience used in aud field of JWT maxAge: Period for which the token is valid hmacKey: The key used to sign the JWT tokens. Keep this key a secret.

Configuring transport #

Use io to configure how session data is transported. Built-in options are:

  1. SessionIoCookie: Stores token in cookie
  2. SessionIoAuthHeader: Stores token in authorization header
  3. SessionIoHeader: Stores token in header

By default, JwtSession uses SessionIoAuthHeader.

Changelog #

2.4.1 #

  • Upgraded to Jaguar 2.4.x

2.1.6 #

  • sct field in session is now Jaguar compatible.

2.1.4 #

  • JwtMapCoder for other SessionManagers to implement JWT

2.1.2 #

  • Unified JwtSession and JwtCookieSession

2.1.1 #

  • Jaguar 2.1.x

Use this package as a library

1. Depend on it

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

  jaguar_session_jwt: ^2.4.2

2. Install it

You can install packages from the command line:

with pub:

$ pub get

with Flutter:

$ flutter pub get

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

3. Import it

Now in your Dart code, you can use:

import 'package:jaguar_session_jwt/jaguar_session_jwt.dart';
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

We analyzed this package on Feb 13, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.1
  • pana: 0.13.5

Health suggestions

Fix lib/src/common.dart. (-2.48 points)

Analysis of lib/src/common.dart reported 5 hints:

line 19 col 20: Use = to separate a named parameter from its default value.

line 20 col 18: Use = to separate a named parameter from its default value.

line 42 col 29: Use = to separate a named parameter from its default value.

line 43 col 22: Use = to separate a named parameter from its default value.

line 62 col 22: Unnecessary new keyword.

Fix lib/src/session.dart. (-0.50 points)

Analysis of lib/src/session.dart reported 1 hint:

line 31 col 14: Use = to separate a named parameter from its default value.

Maintenance issues and suggestions

Fix analysis_options.yaml.

The analyzer can't parse analysis_options.yaml.

Package is getting outdated. (-12.60 points)

The package was last published 58 weeks ago.

Maintain an example.

None of the files in the package's example/ directory matches known example patterns.

Common filename patterns include main.dart, example.dart, and jaguar_session_jwt.dart. Packages with multiple examples should provide example/

For more information see the pub package layout conventions.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.65 <3.0.0
jaguar ^2.4.0 2.4.36
jaguar_jwt ^2.1.5 2.1.6
Transitive dependencies
auth_header 2.1.4
charcode 1.1.3
collection 1.14.12
convert 2.1.1
crypto 2.1.4
http_server 0.9.8+3
jaguar_serializer 2.2.12
logging 0.11.4
meta 1.1.8
mime 0.9.6+3
path 1.6.4
path_tree 2.2.2
stack_trace 1.9.3
typed_data 1.1.6
Dev dependencies
http ^0.11.3
jaguar_auth ^2.4.1
jaguar_common ^2.1.4 2.1.4
jaguar_reflect ^2.4.1
jaguar_resty ^2.6.2
test ^1.3.0