onegini 4.0.0
onegini: ^4.0.0 copied to clipboard
The Onegini Flutter Plugin is a plugin that allows you to utilize the Onegini Mobile SDKs in your Flutter applications.
Flutter #
Getting started #
in pubspec.yaml add this:
dependencies:
onegini: 4.0.0
flutter clean
flutter pub get
The first time running you have to fetch flutter packages. Onegini class - main class for communication between flutter and Native platforms.
SDK Configuration #
- Get access to https://thalescpliam.jfrog.io/artifactory/onegini-sdk/
- Use https://github.com/ThalesGroup/sdk-configurator on your application (instructions can be found there)
Onegini Documentation #
App Configuration #
Android:
-
Modify
android/app/build.gradle:1.1. Add to
androidsection:lintOptions { abortOnError false }
1.2 Add to
android->defaultConfigsection:minSdkVersion 24 compileSdkVersion 36 multiDexEnabled true -
Add to
android/app/proguard-rules.pro:-keep class com.onegini.mobile.SecurityController { *; }
-
Add to
android/build.gradle[allprojects.repositories]:ext.kotlin_version = '2.1.0' dependencies { classpath 'com.android.tools.build:gradle:8.13.2' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" } mavenCentral() maven { /* Before the release please change the url below to: https://repo.onewelcome.com/artifactory/onegini-sdk Please change it back to https://repo.onewelcome.com/artifactory/public after the release */ url "https://repo.onewelcome.com/artifactory/onegini-sdk" credentials { username "YOUR_USERNAME" password "YOUR_PASSWORD" } } -
Modify
android/app/src/main/AndroidManifest.xml. Add<intent-filter>to your .MainActivity for listening browser redirects. !!! scheme="oneginiexample" should be changed to your(will be provided by onegini-sdk-configurator) schema:
iOS (>= 15.1):
Swift Package Manager (Recommended)
The Flutter plugin uses a native Package.swift manifest to pull in the OneWelcome iOS SDK via the private Swift Package Registry hosted on Thales CPLIAM JFrog Artifactory. The Package.swift declares:
OneWelcome.SDKSPM(13.1.0..<13.2.0) — re-exportsOneginiSDKiOS(binary xcframework) and its transitive native dependencies (Typhoon, libcrypto, libssl, SecureBlackbox).Alamofire5.10.2— networking dependency.
Prerequisites
-
Enable Flutter Swift Package Manager support (required once per machine):
flutter config --enable-swift-package-manager -
Configure the private Swift Package Registry (required once per machine):
swift package-registry set --global https://thalescpliam.jfrog.io/artifactory/api/swift/swift-public swift package-registry loginWhen prompted, enter your Artifactory access token:
Enter access token: {YOUR_TOKEN} Login successful. Credentials have been saved to the operating system's secure credential store. Registry configuration updated.The registry credentials are stored in the OS secure credential store and written to
~/Library/org.swift.swiftpm/configuration/registries.json.
Integration Steps
-
Run
flutter pub getin the project root to generate the plugin's Swift package graph. -
Run CocoaPods to bootstrap Flutter's pod infrastructure (required alongside SPM):
cd example/ios && pod install && cd ../.. -
Resolve all Swift package dependencies:
cd example/ios && xcodebuild -resolvePackageDependencies && cd ../.. -
Build the app:
xcodebuild \ -workspace example/ios/Runner.xcworkspace \ -scheme Runner \ -destination 'generic/platform=iOS' \ -configuration Debug \ CODE_SIGN_IDENTITY="" \ CODE_SIGNING_REQUIRED=NO \ build
Note: Do not add
OneWelcome.SDKSPMmanually via Xcode's Add Package Dependencies dialog. Theios/onegini/Package.swiftmanifest already declares the dependency and Flutter's tooling wires it up automatically when SPM support is enabled.
CocoaPods If you are using CocoaPods, you can continue to use the following instructions:
-
The Onegini SDK is uploaded to the Onegini Artifactory repository. In order to let CocoaPods use an Artifactory repository you need to install a specific plugin.
gem install cocoapods-art -
The Onegini SDK repository is not a public repository. You must provide credentials in order to access the repo. Create a file named .netrc in your Home folder (~/) and add the following contents to it:
machine thalescpliam.jfrog.io login <username> password <password>Replace the
-
The Onegini CocoaPods repository must be added to your local machine using the following command:
pod repo-art add onegini https://thalescpliam.jfrog.io/artifactory/api/pods/cocoapods-public -
In order to update the Repository you must manually perform an update:
pod repo-art update onegini -
In the
podfile has to be added at the beginning this partios/Podfile:source 'https://github.com/artsy/Specs.git' source 'https://github.com/CocoaPods/Specs.git' platform :ios, '15.1' plugin 'cocoapods-art', :sources => [ 'onegini' ]post_install do |installer| installer.pods_project.targets.each do |target| flutter_additional_ios_build_settings(target) target.build_configurations.each do |config| config.build_settings['ENABLE_BITCODE'] = 'NO' config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '15.1' end end end -
Run
pod install -
Add
SecurityController.handSecurityController.mas described HERE to native's part of code.