jaguar_session_jwt 2.4.2

  • Readme
  • Changelog
  • Installing
  • 58

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: 'jaguar.com');

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:


dependencies:
  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';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
17
Health:
Code health derived from static analysis. [more]
98
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
58
Learn more about scoring.

We analyzed this package on Oct 16, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.5.1
  • pana: 0.12.21

Platforms

Detected platforms: Flutter, other

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

Health suggestions

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

Analysis of lib/src/common.dart reported 4 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.

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.

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/README.md.

For more information see the pub package layout conventions.

Dependencies

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.2
collection 1.14.12
convert 2.1.1
crypto 2.1.3
http_server 0.9.8+3
jaguar_serializer 2.2.12
logging 0.11.3+2
meta 1.1.7
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_example_session_models
jaguar_reflect ^2.4.1
jaguar_resty ^2.6.2
test ^1.3.0