diff --git a/app/build.gradle b/app/build.gradle
index 1f6c76a1..59d9da30 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -45,8 +45,8 @@ allprojects {
}
android {
- compileSdkVersion 27
- buildToolsVersion '27.0.3'
+ compileSdkVersion 28
+ buildToolsVersion '28.0.3'
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
@@ -56,9 +56,9 @@ android {
defaultConfig {
applicationId "com.onegini.mobile.exampleapp"
minSdkVersion 16
- targetSdkVersion 27
- versionCode 16
- versionName "5.5.0"
+ targetSdkVersion 28
+ versionCode 17
+ versionName "5.6.0"
multiDexEnabled true
}
buildTypes {
@@ -80,7 +80,7 @@ android {
dependencies {
// Onegini SDK
- api('com.onegini.mobile.sdk.android:onegini-sdk:9.5.0@aar') {
+ api('com.onegini.mobile.sdk.android:onegini-sdk:9.6.0@aar') {
transitive = true
}
@@ -88,11 +88,13 @@ dependencies {
implementation 'com.squareup.retrofit2:adapter-rxjava:2.5.0'
// Google Support
- implementation 'com.android.support:appcompat-v7:27.1.1'
- implementation 'com.android.support:cardview-v7:27.1.1'
- implementation 'com.android.support:design:27.1.1'
- implementation 'com.android.support:recyclerview-v7:27.1.1'
- implementation 'com.android.support:support-core-ui:27.1.1'
+ implementation 'com.android.support:appcompat-v7:28.0.0'
+ implementation 'com.android.support:cardview-v7:28.0.0'
+ implementation 'com.android.support:design:28.0.0'
+ implementation 'com.android.support:recyclerview-v7:28.0.0'
+ implementation 'com.android.support:support-core-ui:28.0.0'
+ implementation 'com.android.support:support-media-compat:28.0.0'
+ implementation 'com.android.support:support-v4:28.0.0'
// QR code reader
implementation 'com.google.android.gms:play-services-vision:17.0.2'
@@ -107,7 +109,7 @@ dependencies {
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
// RxJava
implementation 'io.reactivex.rxjava2:rxandroid:2.1.1'
- implementation 'io.reactivex.rxjava2:rxjava:2.2.6'
+ implementation 'io.reactivex.rxjava2:rxjava:2.2.9'
}
//according to google documentation, this plugin has to be applied at the end of the file
diff --git a/app/src/main/java/com/onegini/mobile/exampleapp/OneginiConfigModel.java b/app/src/main/java/com/onegini/mobile/exampleapp/OneginiConfigModel.java
index b3fcf212..e1f935c9 100755
--- a/app/src/main/java/com/onegini/mobile/exampleapp/OneginiConfigModel.java
+++ b/app/src/main/java/com/onegini/mobile/exampleapp/OneginiConfigModel.java
@@ -25,7 +25,7 @@ public class OneginiConfigModel implements OneginiClientConfigModel {
private final String appIdentifier = "ExampleApp";
private final String appPlatform = "android";
private final String redirectionUri = "oneginiexample://loginsuccess";
- private final String appVersion = "5.5.0";
+ private final String appVersion = "5.6.0";
private final String baseURL = "https://demo-msp.onegini.com";
private final String resourceBaseURL = "https://demo-msp.onegini.com/resources/";
private final String keystoreHash = "910638c3e6c17ec9ab2a74969abab06b34470d29c21d8ad8a65af243a1ccb69f";
diff --git a/app/src/main/java/com/onegini/mobile/exampleapp/view/activity/DashboardActivity.java b/app/src/main/java/com/onegini/mobile/exampleapp/view/activity/DashboardActivity.java
index 891dbef4..25956924 100644
--- a/app/src/main/java/com/onegini/mobile/exampleapp/view/activity/DashboardActivity.java
+++ b/app/src/main/java/com/onegini/mobile/exampleapp/view/activity/DashboardActivity.java
@@ -17,13 +17,13 @@
package com.onegini.mobile.exampleapp.view.activity;
import android.content.Intent;
+import android.net.Uri;
import android.os.Bundle;
import android.support.v7.app.ActionBar;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.widget.TextView;
import android.widget.Toast;
-
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
@@ -33,12 +33,15 @@
import com.onegini.mobile.exampleapp.storage.UserStorage;
import com.onegini.mobile.exampleapp.util.DeregistrationUtil;
import com.onegini.mobile.sdk.android.client.OneginiClient;
+import com.onegini.mobile.sdk.android.handlers.OneginiAppToWebSingleSignOnHandler;
import com.onegini.mobile.sdk.android.handlers.OneginiDeregisterUserProfileHandler;
import com.onegini.mobile.sdk.android.handlers.OneginiLogoutHandler;
import com.onegini.mobile.sdk.android.handlers.OneginiMobileAuthWithOtpHandler;
+import com.onegini.mobile.sdk.android.handlers.error.OneginiAppToWebSingleSignOnError;
import com.onegini.mobile.sdk.android.handlers.error.OneginiDeregistrationError;
import com.onegini.mobile.sdk.android.handlers.error.OneginiLogoutError;
import com.onegini.mobile.sdk.android.handlers.error.OneginiMobileAuthWithOtpError;
+import com.onegini.mobile.sdk.android.model.OneginiAppToWebSingleSignOn;
import com.onegini.mobile.sdk.android.model.entity.UserProfile;
public class DashboardActivity extends AppCompatActivity {
@@ -87,7 +90,6 @@ public void onError(final OneginiMobileAuthWithOtpError oneginiMobileAuthWithOtp
}
}
-
@SuppressWarnings("unused")
@OnClick(R.id.button_auth_with_otp)
public void mobileAuthWithOtp() {
@@ -187,6 +189,34 @@ public void startSettingsActivity() {
startActivity(new Intent(this, SettingsActivity.class));
}
+ @SuppressWarnings("unused")
+ @OnClick(R.id.button_single_sign_on)
+ public void startSingleSignOn() {
+ final Uri targetUri = Uri.parse("https://demo-cim.onegini.com/personal/dashboard");
+
+ final OneginiClient oneginiClient = OneginiSDK.getOneginiClient(this);
+ oneginiClient.getUserClient().getAppToWebSingleSignOn(targetUri, new OneginiAppToWebSingleSignOnHandler() {
+ @Override
+ public void onSuccess(final OneginiAppToWebSingleSignOn oneginiAppToWebSingleSignOn) {
+ final Intent intent = new Intent(Intent.ACTION_VIEW, oneginiAppToWebSingleSignOn.getRedirectUrl());
+ intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+ intent.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
+ startActivity(intent);
+ }
+
+ @Override
+ public void onError(final OneginiAppToWebSingleSignOnError oneginiAppToWebSingleSignOnError) {
+ @OneginiAppToWebSingleSignOnError.AppToWebSingleSignOnErrorType int errorType = oneginiAppToWebSingleSignOnError.getErrorType();
+ if (errorType == OneginiDeregistrationError.DEVICE_DEREGISTERED) {
+ // Deregistration failed due to missing device credentials. Register app once again.
+ new DeregistrationUtil(DashboardActivity.this).onDeviceDeregistered();
+ }
+
+ // other errors don't really require our reaction, but you might consider displaying some message to the user
+ showToast("App To Web Single Sign-On error: " + oneginiAppToWebSingleSignOnError.getMessage());
+ }
+ });
+ }
private void showToast(final String message) {
Toast.makeText(this, message, Toast.LENGTH_SHORT).show();
diff --git a/app/src/main/res/layout/activity_dashboard.xml b/app/src/main/res/layout/activity_dashboard.xml
index cd24684e..31239aa2 100644
--- a/app/src/main/res/layout/activity_dashboard.xml
+++ b/app/src/main/res/layout/activity_dashboard.xml
@@ -75,6 +75,10 @@
android:id="@+id/button_auth_with_otp"
style="@style/ButtonStyle"
android:text="@string/btn_mobile_auth_with_otp_label"/>
+