Skip to content

Commit 6017a06

Browse files
committed
Merge branch 'develop'
2 parents 7f4f103 + 9254082 commit 6017a06

17 files changed

+149
-26
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
# 1.0.6
2+
1.0.6
3+
4+
* Added "getAuthCode" interface used to obtain a session exchange code with WebSDK.
5+
16
# 1.0.5
27
1.0.5
38

README.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,29 @@ To initiate the SSO request flow, run the following snippet.
259259
});
260260
```
261261

262+
**Note:**
263+
When using mobile SSO (single sign-on using the central login page), logging out using the SDK's logout method will only log the user out of the current API key used.
264+
The user will not be logged out of the other group sites.
265+
266+
## Session Exchange Between Mobile & WebView
267+
268+
Applications (mobile/web) within the same site group are now able to share a session from the mobile application to a web page running the JS SDK.
269+
270+
Follow these steps to allow session exchange:
271+
272+
1. Use the “getAuthCode” interface. This call will provide you with the required code that the web page will require for the exchange.
273+
```dart
274+
final String? result = await widget.sdk.getAuthCode();
275+
```
276+
277+
2. Add these URL parameters to your hosted page/website URL using the provided code:
278+
*** https://page-url?authCode=code&gig_actions=sso.login ***
279+
280+
3. Make sure that the WebView element you are using to open the URL has JavaScript enabled.
281+
282+
4. Once the page is loaded, the JS SDK will exchange the token provided for a valid session.
283+
284+
262285
## FIDO/WebAuthn Authentication
263286
FIDO is a passwordless authentication method that allows password-only logins to be replaced with secure and fast login experiences across websites and apps.
264287

android/src/main/kotlin/com/sap/gigya_flutter_plugin/GigyaFlutterPlugin.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ class GigyaFlutterPlugin : FlutterPlugin, MethodCallHandler, ActivityAware, Scre
100100
"biometricOptOut" -> sdk.biometricOptOut(call.arguments, result)
101101
"biometricLockSession" -> sdk.biometricLockSession(result)
102102
"biometricUnlockSession" -> sdk.biometricUnlockSession (call.arguments, result)
103+
"getAuthCode" -> sdk.getAuthCode(result)
103104
else -> result.notImplemented()
104105
}
105106
}

android/src/main/kotlin/com/sap/gigya_flutter_plugin/GigyaSDKWrapper.kt

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,14 @@ import com.gigya.android.sdk.api.IApiRequestFactory
1414
import com.gigya.android.sdk.auth.GigyaAuth
1515
import com.gigya.android.sdk.auth.GigyaOTPCallback
1616
import com.gigya.android.sdk.auth.resolvers.IGigyaOtpResult
17-
import com.gigya.android.sdk.containers.GigyaContainer
18-
import com.gigya.android.sdk.interruption.IPendingRegistrationResolver
19-
import com.gigya.android.sdk.interruption.link.ILinkAccountsResolver
2017
import com.gigya.android.sdk.biometric.GigyaBiometric
2118
import com.gigya.android.sdk.biometric.GigyaPromptInfo
2219
import com.gigya.android.sdk.biometric.IGigyaBiometricCallback
20+
import com.gigya.android.sdk.interruption.IPendingRegistrationResolver
21+
import com.gigya.android.sdk.interruption.link.ILinkAccountsResolver
2322
import com.gigya.android.sdk.network.GigyaError
2423
import com.gigya.android.sdk.session.SessionInfo
2524
import com.gigya.android.sdk.ui.plugin.GigyaPluginEvent
26-
import com.gigya.android.sdk.ui.plugin.GigyaWebBridge
2725
import com.gigya.android.sdk.ui.plugin.IGigyaWebBridge
2826
import com.gigya.android.sdk.utils.CustomGSONDeserializer
2927
import com.google.gson.GsonBuilder
@@ -667,7 +665,24 @@ class GigyaSDKWrapper<T : GigyaAccount>(application: Application, accountObj: Cl
667665
})
668666
}
669667

668+
fun getAuthCode(channelResult: MethodChannel.Result) {
669+
sdk.getAuthCode(object : GigyaCallback<String>() {
670+
override fun onSuccess(code: String) {
671+
channelResult.success(code)
672+
}
673+
674+
override fun onError(error: GigyaError) {
675+
channelResult.error(
676+
error.errorCode.toString(),
677+
error.localizedMessage,
678+
mapJson(error.data)
679+
)
680+
}
681+
})
682+
}
683+
670684
//endregion
685+
671686
//region SCREENSETS
672687

673688
/**

example/ios/Podfile.lock

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
PODS:
2-
- AppAuth (1.6.2):
3-
- AppAuth/Core (= 1.6.2)
4-
- AppAuth/ExternalUserAgent (= 1.6.2)
5-
- AppAuth/Core (1.6.2)
6-
- AppAuth/ExternalUserAgent (1.6.2):
2+
- AppAuth (1.7.5):
3+
- AppAuth/Core (= 1.7.5)
4+
- AppAuth/ExternalUserAgent (= 1.7.5)
5+
- AppAuth/Core (1.7.5)
6+
- AppAuth/ExternalUserAgent (1.7.5):
77
- AppAuth/Core
88
- Flutter (1.0.0)
9-
- Gigya (1.5.8)
9+
- Gigya (1.6.2)
1010
- gigya_flutter_plugin (1.0.0):
1111
- Flutter
12-
- Gigya (>= 1.5.8)
13-
- GigyaAuth (>= 1.1.1)
14-
- GigyaAuth (1.1.1):
15-
- Gigya (>= 1.2.0)
12+
- Gigya (>= 1.6.2)
13+
- GigyaAuth (>= 1.1.2)
14+
- GigyaAuth (1.1.2):
15+
- Gigya (>= 1.6.0)
1616
- google_sign_in_ios (0.0.1):
1717
- Flutter
1818
- GoogleSignIn (~> 6.2)
@@ -48,11 +48,11 @@ EXTERNAL SOURCES:
4848
:path: ".symlinks/plugins/google_sign_in_ios/ios"
4949

5050
SPEC CHECKSUMS:
51-
AppAuth: 3bb1d1cd9340bd09f5ed189fb00b1cc28e1e8570
51+
AppAuth: 501c04eda8a8d11f179dbe8637b7a91bb7e5d2fa
5252
Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854
53-
Gigya: 8e698005fa73eea2f45755f40967277620764f72
54-
gigya_flutter_plugin: 4c7df0b8bcb69f72ab53bc200d10d17c4fd8f837
55-
GigyaAuth: 0ffdf8aea1f562fc09d34ded9930b57e41308fd7
53+
Gigya: 0e6fa3447def67739461c489305cd1a82278857d
54+
gigya_flutter_plugin: d0b75ee89ad68a01978c349d96e238e6582579d3
55+
GigyaAuth: 32cd49aa9eb380275ad10d85543a90ce326fe4fb
5656
google_sign_in_ios: 1256ff9d941db546373826966720b0c24804bcdd
5757
GoogleSignIn: 5651ce3a61e56ca864160e79b484cd9ed3f49b7a
5858
GTMAppAuth: 0ff230db599948a9ad7470ca667337803b3fc4dd

example/lib/routes/account_information_page.dart

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,10 @@ class _AccountInformationPageState extends State<AccountInformationPage>
102102
padding: const EdgeInsets.all(8.0),
103103
child: _buildRevokePasskeyButton(),
104104
),
105+
Padding(
106+
padding: const EdgeInsets.all(8.0),
107+
child: _buildGetAuthCodeButton(),
108+
),
105109
],
106110
),
107111
);
@@ -200,6 +204,38 @@ class _AccountInformationPageState extends State<AccountInformationPage>
200204
);
201205
}
202206

207+
Widget _buildGetAuthCodeButton() {
208+
return ElevatedButton(
209+
onPressed: () async {
210+
setState(() {
211+
_inProgress = true;
212+
});
213+
214+
try {
215+
final String? result =
216+
await widget.sdk.getAuthCode();
217+
218+
print('GetAuth code $result');
219+
220+
if (mounted) {
221+
setState(() {
222+
_inProgress = false;
223+
});
224+
}
225+
} catch (error) {
226+
print('GetAuth error: $error');
227+
228+
if (mounted) {
229+
setState(() {
230+
_inProgress = false;
231+
});
232+
}
233+
}
234+
},
235+
child: const Text('Get Auth Code'),
236+
);
237+
}
238+
203239
@override
204240
Widget build(BuildContext context) {
205241
return Scaffold(

example/pubspec.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ packages:
7878
path: ".."
7979
relative: true
8080
source: path
81-
version: "1.0.4"
81+
version: "1.0.5"
8282
google_sign_in:
8383
dependency: "direct main"
8484
description:

example/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: gigya_flutter_plugin_example
22
description: Demonstrates how to use the gigya_flutter_plugin plugin.
3-
version: 1.0.5
3+
version: 1.0.6
44
homepage: https://www.sap.com
55
publish_to: none
66

ios/Classes/GigyaSdkMethods.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ public enum GigyaSdkMethods: String {
1515

1616
// Login using a Social Provider / Single-Sign-On.
1717
case socialLogin
18-
case sso
18+
case sso
19+
case getAuthCode
1920

2021
// Web Authentication.
2122
case webAuthnLogin

ios/Classes/GigyaSdkWrapper.swift

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public class GigyaSdkWrapper<T: GigyaAccountProtocol> :GigyaInstanceProtocol {
5050

5151
init(accountSchema: T.Type) {
5252
// Initializing the Gigya SDK instance.
53-
GigyaDefinitions.versionPrefix = "flutter_1.0.5_"
53+
GigyaDefinitions.versionPrefix = "flutter_1.0.6_"
5454
sdk = Gigya.sharedInstance(accountSchema)
5555
GigyaAuth.shared.register(scheme: accountSchema)
5656
}
@@ -335,6 +335,21 @@ public class GigyaSdkWrapper<T: GigyaAccountProtocol> :GigyaInstanceProtocol {
335335
}
336336
}
337337
}
338+
339+
/*
340+
Get Auth Code
341+
*/
342+
func getAuthCode(result: @escaping FlutterResult) {
343+
sdk?.getAuthCode() { res in
344+
switch res {
345+
case .success(let code):
346+
result(code)
347+
case .failure(let error):
348+
result(PluginErrors.wrapNetworkError(error: error))
349+
}
350+
}
351+
}
352+
338353

339354
func addConnection(arguments: [String: Any], result: @escaping FlutterResult) {
340355
guard let viewController = getDisplayedViewController()

0 commit comments

Comments
 (0)