flutter_liferay_oauth 0.1.3

Flutter Liferay OAuth 2.0 #

A Flutter OAuth package for performing Liferay login using OAuth2 standard to access Liferay DXP JAX-RS service. Forked from Earlybyte.aad_oauth.

Supported Flows:

More info on Liferay/Oauth2

Usage #

Create a Liferay JAX-RS service and configure OAUTH 2.0 by following these instructions

In the flutter app, initialize:

final Config config = new Config(
  "<LIFERAY SERVER>",
  "<REDIRECT_URL>",
  "<CLIENT_ID>",
  usePkce: true); // Request an authorization code using PKCE code challenge.
final LiferayOAuth oauth = new LiferayOAuth(config);

This allows you to pass in an Liferay Server, Redirect Url, client ID, Client secret and few more optional params.

If your service require to pass an oauth2 scope, the config allows for an optional param 'scope'. For more on OAuth2 Scopes

Then once you have an OAuth instance, you can call login() and afterwards getAccessToken() to retrieve an access token and pass it to the rest client:

await oauth.login();
String accessToken = await oauth.getAccessToken();

You can also call getAccessToken() directly. It will automatically login and retrieve an access token.

Tokens are cached in-memory. To destroy the tokens you can call logout():

Installation #

Add the following to your pubspec.yaml dependencies:

dependencies:
  flutter_liferay_oauth: "^0.1.3"

[0.0.1] - 20190131

  • Initial release

example/README.md

myblogs Secure #

A secure Flutter application powered Liferay DXP.

Getting Started #

This is an example application secured by Liferay login using OAuth2 standard.

It uses flutter_liferay_oauth flutter package created by Xtivia Developers to simplify the login needs.

OAuth 2.0 is an industry-standard authorization protocol. Users can seamlessly share select credentials from another website/Mobile App to log into yours. It works by authorizing password-less access to portions of user-owned resources (such as an email address, a user profile picture, or something else from your account) and other permissioned resources.

A few resources to get you started if this is your first Flutter project:

For help getting started with Flutter, view our online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.

Use this package as a library

1. Depend on it

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


dependencies:
  flutter_liferay_oauth: ^0.1.3

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support 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:flutter_liferay_oauth/flutter_liferay_oauth.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
46
Health:
Code health derived from static analysis. [more]
99
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
73
Learn more about scoring.

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

  • Dart: 2.4.0
  • pana: 0.12.19
  • Flutter: 1.7.8+hotfix.3

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Health issues and suggestions

Document public APIs. (-1 points)

102 out of 102 API elements have no dartdoc comment.Providing good documentation for libraries, classes, functions, and other API elements improves code readability and helps developers find and use your API.

Format lib/flutter_liferay_oauth.dart.

Run flutter format to format lib/flutter_liferay_oauth.dart.

Format lib/model/config.dart.

Run flutter format to format lib/model/config.dart.

Format lib/request/authorization_request.dart.

Run flutter format to format lib/request/authorization_request.dart.

Fix additional 3 files with analysis or formatting issues.

Additional issues in the following files:

  • lib/request/token_refresh_request.dart (Run flutter format to format lib/request/token_refresh_request.dart.)
  • lib/request/token_request.dart (Run flutter format to format lib/request/token_request.dart.)
  • lib/request_token.dart (Run flutter format to format lib/request_token.dart.)

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.68.0 <3.0.0
crypto ^2.0.6 2.0.6
flutter 0.0.0
flutter_webview_plugin ^0.3.0+2 0.3.5
http ^0.12.0 0.12.0+2
Transitive dependencies
async 2.3.0
charcode 1.1.2
collection 1.14.11
convert 2.1.1
http_parser 3.1.3
meta 1.1.6 1.1.7
path 1.6.2
pedantic 1.8.0+1
sky_engine 0.0.99
source_span 1.5.5
string_scanner 1.0.4
term_glyph 1.1.0
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
flutter_test

Admin