Skip to content

Commit

Permalink
Merge pull request #46 from Onegini/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
Robert Szuba authored Dec 2, 2016
2 parents 24b2f34 + 846b8c3 commit bd040f4
Show file tree
Hide file tree
Showing 78 changed files with 1,375 additions and 695 deletions.
15 changes: 12 additions & 3 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ android {
applicationId "com.onegini.mobile.exampleapp"
minSdkVersion 16
targetSdkVersion 23
versionCode 4
versionName "2.1.0"
versionCode 5
versionName "2.2.0"
multiDexEnabled true
}
buildTypes {
Expand All @@ -67,8 +67,10 @@ android {

dependencies {
// Onegini SDK
compile('com.onegini.mobile.sdk.android:onegini-sdk:6.01.00@aar') {
compile('com.onegini.mobile.sdk.android:onegini-sdk:6.02.00@aar') {
transitive = true
exclude module: 'fido-client'
exclude module: 'samsungsds-ccom'
}

// Google Support
Expand All @@ -85,4 +87,11 @@ dependencies {
compile 'com.jakewharton:butterknife:7.0.1'
// RxJava
compile 'io.reactivex:rxandroid:1.1.0'

// Samsung's FIDO client
compile 'com.samsung.sds.fido.uaf.sdk:fido-client:1.4.1@aar'
compile 'org.fidoalliance.uaf.client.common:samsungsds-ccom:1.4.1@aar'
compile 'com.samsung.sds.fido.uaf.message:samsungsds-um:1.4.1'
// Google Guava
compile 'com.google.guava:guava:19.0'
}
37 changes: 24 additions & 13 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (c) 2016 Onegini B.V.
Copyright (c) 2016 Onegini B.V.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools"
package="com.onegini.mobile.exampleapp">

<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE"/>
Expand All @@ -28,7 +28,8 @@
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
android:theme="@style/AppTheme"
tools:replace="android:allowBackup">

<activity
android:name=".view.activity.SplashScreenActivity"
Expand Down Expand Up @@ -62,10 +63,16 @@
android:screenOrientation="portrait"/>
<activity
android:name=".view.activity.FingerprintActivity"
android:launchMode="singleTask"
android:screenOrientation="portrait"/>
<activity
android:name=".view.activity.MobileAuthenticationFingerprintActivity"
android:launchMode="singleTask"
android:screenOrientation="portrait"/>
<activity
android:name=".view.activity.FidoActivity"
android:screenOrientation="portrait"
android:launchMode="singleTask"/>
<activity
android:name=".view.activity.DashboardActivity"
android:screenOrientation="portrait"/>
Expand All @@ -85,6 +92,10 @@
android:name=".view.activity.MobileAuthenticationPinActivity"
android:launchMode="singleTask"
android:screenOrientation="portrait"/>
<activity
android:name=".view.activity.MobileAuthenticationFidoActivity"
android:launchMode="singleTask"
android:screenOrientation="portrait"/>
<activity
android:name=".view.activity.DevicesListActivity"
android:parentActivityName=".view.activity.DashboardActivity"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,17 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.onegini.mobile.exampleapp;

public interface Constants {
String[] DEFAULT_SCOPES = { "read" };
String NEW_LINE = "\n";
String GCM_SENDER_ID = "586427927998";
String GCM_REGISTRATION_COMPLETE = "gmc_registration_complete";
String EXTRA_COMMAND = "command";
String COMMAND_START = "start";
String COMMAND_FINISH = "finish";
String COMMAND_SHOW_SCANNING = "show";
String COMMAND_RECEIVED_FINGERPRINT = "received";
String COMMAND_ASK_TO_ACCEPT_OR_DENY = "ask";
}
3 changes: 2 additions & 1 deletion app/src/main/java/com/onegini/mobile/exampleapp/OneginiConfigModel.java
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.onegini.mobile.exampleapp;

import android.os.Build;
Expand All @@ -24,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 = "2.1.0";
private final String appVersion = "2.2.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";
Expand Down
16 changes: 12 additions & 4 deletions app/src/main/java/com/onegini/mobile/exampleapp/OneginiSDK.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,21 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.onegini.mobile.exampleapp;

import android.content.Context;

import com.onegini.mobile.exampleapp.view.handler.CreatePinRequestHandler;
import com.onegini.mobile.exampleapp.view.handler.FidoAuthenticationRequestHandler;
import com.onegini.mobile.exampleapp.view.handler.FingerprintAuthenticationRequestHandler;
import com.onegini.mobile.exampleapp.view.handler.MobileAuthenticationFidoRequestHandler;
import com.onegini.mobile.exampleapp.view.handler.MobileAuthenticationFingerprintRequestHandler;
import com.onegini.mobile.sdk.android.client.OneginiClient;
import com.onegini.mobile.sdk.android.client.OneginiClientBuilder;
import com.onegini.mobile.exampleapp.view.handler.MobileAuthenticationPinRequestHandler;
import com.onegini.mobile.exampleapp.view.handler.MobileAuthenticationRequestHandler;
import com.onegini.mobile.exampleapp.view.handler.CreatePinRequestHandler;
import com.onegini.mobile.exampleapp.view.handler.PinAuthenticationRequestHandler;
import com.onegini.mobile.exampleapp.view.handler.RegistrationURLHandler;
import com.onegini.mobile.sdk.android.client.OneginiClient;
import com.onegini.mobile.sdk.android.client.OneginiClientBuilder;

public class OneginiSDK {

Expand All @@ -40,13 +43,18 @@ private static OneginiClient buildSDK(final Context context) {
final Context applicationContext = context.getApplicationContext();
final CreatePinRequestHandler createPinRequestHandler = new CreatePinRequestHandler(applicationContext);
final PinAuthenticationRequestHandler pinAuthenticationRequestHandler = new PinAuthenticationRequestHandler(applicationContext);
final RegistrationURLHandler registrationURLHandler = new RegistrationURLHandler(context);

// will throw OneginiConfigNotFoundException if OneginiConfigModel class can't be found
return new OneginiClientBuilder(applicationContext, createPinRequestHandler, pinAuthenticationRequestHandler)
.setFingerprintAuthenticatioRequestHandler(new FingerprintAuthenticationRequestHandler(applicationContext))
.setFidoAuthenticationRequestHandler(new FidoAuthenticationRequestHandler(applicationContext))
.setMobileAuthenticationRequestHandler(new MobileAuthenticationRequestHandler(applicationContext))
.setMobileAuthenticationPinRequestHandler(new MobileAuthenticationPinRequestHandler(applicationContext))
.setFingerprintAuthenticatioRequestHandler(new FingerprintAuthenticationRequestHandler(applicationContext))
.setMobileAuthenticationFingerprintRequestHandler(new MobileAuthenticationFingerprintRequestHandler(applicationContext))
.setOneginiURLHandler(registrationURLHandler)
.setMobileAuthenticationFidoRequestHandler(new MobileAuthenticationFidoRequestHandler(applicationContext))
.build();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.onegini.mobile.exampleapp;

@SuppressWarnings({ "unused", "WeakerAccess" })
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.onegini.mobile.exampleapp.adapter;

import static android.view.View.GONE;
Expand Down Expand Up @@ -86,12 +87,12 @@ public int getItemCount() {
return authenticators.length;
}

public static class ViewHolder extends RecyclerView.ViewHolder {
public TextView nameTextView;
public Switch authenticatorSwitch;
public ProgressBar progressIndicator;
static class ViewHolder extends RecyclerView.ViewHolder {
final TextView nameTextView;
final Switch authenticatorSwitch;
final ProgressBar progressIndicator;

public ViewHolder(final View contactView) {
ViewHolder(final View contactView) {
super(contactView);
nameTextView = (TextView) itemView.findViewById(R.id.authenticator_name);
authenticatorSwitch = (Switch) itemView.findViewById(R.id.authenticator_switch);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.onegini.mobile.exampleapp.adapter;

import java.util.List;
Expand All @@ -29,17 +30,17 @@
public class DevicesAdapter extends
RecyclerView.Adapter<DevicesAdapter.ViewHolder> {

private List<Device> devices;
private final List<Device> devices;

public DevicesAdapter(List<Device> contacts) {
devices = contacts;
}

public static class ViewHolder extends RecyclerView.ViewHolder {
static class ViewHolder extends RecyclerView.ViewHolder {

public TextView nameTextView;
final TextView nameTextView;

public ViewHolder(View itemView) {
ViewHolder(View itemView) {
super(itemView);

nameTextView = (TextView) itemView.findViewById(R.id.textView);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.onegini.mobile.exampleapp.model;

import com.google.gson.annotations.SerializedName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.onegini.mobile.exampleapp.model;

import com.onegini.mobile.sdk.android.model.OneginiAuthenticator;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.onegini.mobile.exampleapp.model;

import com.google.gson.annotations.SerializedName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.onegini.mobile.exampleapp.model;

import com.onegini.mobile.sdk.android.model.entity.UserProfile;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.onegini.mobile.exampleapp.network;

import android.content.Context;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.onegini.mobile.exampleapp.network;

import android.content.Context;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.onegini.mobile.exampleapp.network.client;

import com.onegini.mobile.exampleapp.model.ApplicationDetails;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.onegini.mobile.exampleapp.network.client;

import android.content.Context;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.onegini.mobile.exampleapp.network.client;

import com.onegini.mobile.exampleapp.network.response.DevicesResponse;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.onegini.mobile.exampleapp.network.gcm;

import com.google.android.gms.iid.InstanceIDListenerService;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.onegini.mobile.exampleapp.network.gcm;

import java.util.Set;

import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.util.Log;
import android.widget.Toast;
import com.google.android.gms.gcm.GcmListenerService;
Expand Down Expand Up @@ -69,7 +72,7 @@ public void onError(final OneginiInitializationError error) {
if (errorType == OneginiInitializationError.DEVICE_DEREGISTERED) {
new DeregistrationUtil(getApplicationContext()).onDeviceDeregistered();
}
Toast.makeText(GCMListenerService.this, error.getErrorDescription(), Toast.LENGTH_LONG).show();
showToast(error.getErrorDescription());
}
});
}
Expand All @@ -83,19 +86,24 @@ public void onSuccess() {

@Override
public void onError(final OneginiMobileAuthenticationError oneginiMobileAuthenticationError) {
Toast.makeText(GCMListenerService.this, oneginiMobileAuthenticationError.getErrorDescription(), Toast.LENGTH_SHORT).show();
showToast(oneginiMobileAuthenticationError.getErrorDescription());
@OneginiMobileAuthenticationError.MobileAuthenticationEnrollmentErrorType final int errorType = oneginiMobileAuthenticationError.getErrorType();
if (errorType == OneginiMobileAuthenticationError.USER_DEREGISTERED) {
// the user was deregister, for example he provided a wrong PIN for too many times. You can handle the deregistration here, but since this application
// supports multiple profiles we handle it when the user tries to login the next time because we don't know which user profile was deregistered at
// this point.
} else if (errorType == OneginiMobileAuthenticationError.ACTION_CANCELED) {
Toast.makeText(GCMListenerService.this, "The user cancelled the mobile authentication request", Toast.LENGTH_LONG).show();
showToast("The user cancelled the mobile authentication request");
}
}
});
}

private void showToast(final String errorDescription) {
Handler handler = new Handler(Looper.getMainLooper());
handler.post(() -> Toast.makeText(getApplicationContext(), errorDescription, Toast.LENGTH_SHORT).show());
}

private void removeUserProfiles(final Set<UserProfile> removedUserProfiles, final Bundle extras) {
final DeregistrationUtil deregistrationUtil = new DeregistrationUtil(this);
for (final UserProfile userProfile : removedUserProfiles) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.onegini.mobile.exampleapp.network.gcm;

import java.io.IOException;
Expand Down
Loading

0 comments on commit bd040f4

Please sign in to comment.