6. Appframe Authentication


Installation


1. Add dependency

Add this to your pubspec.yaml under dependencies:

      appframe_authentication: 
        git: 
           url: 'https://981b027dc46f4c36e26ae91eeeb88e61af1e3321@github.com/Omega365/flutter-appframe-authentication.git'
           ref: 'master'


2. Install it

    You can now install the package from the command line: With Flutter: 
flutter pub get

3. Import it

Now in your Dart code, you can use:

import 'package:appframe_authentication/appframe_authentication.dart';


Usage


Sample

class _MyHomePageState extends State<MyHomePage> {
    @override
    Widget build(BuildContext context) {
        return AuthenticationView(
            solutionUrl: 'https://dev-test.pimsr5.com',
            authenticatedChild: const HomeView(),
            allowRememberMe: true,
            applicationName: widget.title,
            logo: AssetImage('assets/Omega-Logo-Color-whiteTxt.png'),
        );
    }
}


AppServices integration

Authentication package provides the option for developers to specify available appservices (hosts) a specific mobile application can authenticate and work against.

You can enable the functionality by adding an optional parameter enableAppServices: true to your AuthenticationView constructor.

This change will utilize the Mobile.getAppServices code module to fetch app services for your application.

You must insert your AppID and AppServicesJSON to stbl_Mobile_AppService on your solutionUrl host.

AppID - can either be a full package identifier (com.omega.timesheet), or just the last part of (timesheet). This helps in cases where your Android and iOS package identifiers differ due to signing certificates.

AppServicesJSON - a JSON string that contains all the needed information, an example can be found below:

{
"appservice_url": "https://test.pimsdevhosting.com",
"default_service": "Aker BP",
"hide_service_list": false,

"services": [
{
"name": "Pims R4 Dev",
"url": "https://test.pimsdevhosting.com"
},
{
"name": "Aker BP Test",
"url": "https://pims-test.akerbp.com/"
},
{
"name": "Aker BP",
"url": "https://pims.akerbp.com/"
}
]
}

This service JSON indicates that the application should authenticate against 'Aker BP' service entry by default. User has the option to override this setting if 'hide_service_list' is set to false.

Constructor

AuthenticationView AuthenticationView({Key key, String solutionUrl, Widget authenticatedChild, String applicationName, bool allowRememberMe, ImageProvider<dynamic> logo, Map<String, String> loginQueryValues})


Properties 

solutionUrl→  String
The URL for the solution you want to authenticate towards

authenticatedChild→ Widget 
The widget/page you want to display when authenticated

loginQueryValues →  Map<String, String>
Adds a query string to the URL  for all authentication requests.
Example: 
loginQueryValues: {"app_login": "true"}  will add  "?app_login=true" to the end of the URL

allowRememberMe→ bool
Enable remember me function. A dialog box will be displayed asking if you want the device to remember your login info when authentication is successful.

applicationName→ String
Name for the application. Will be displayed in large bold text above the login input. 

logo→ ImageProvider<dynamic>
Logo that will be displayed in the top of the widget.



Related articles

Placeholder "LocalizeWeb2016" failed