Instruction for upgrading the Onegini Android SDK to version 7.0
When upgrading from old SDK 6.X version to the version 7.0, several changes have to be applied in the end application:
Retrofit 2
Starting from version 7.0.0 the Onegini SDK uses the Retrofit 2 for all internal communication. For resource calls a secured OkHttpClient
from OkHttp 3 is
exposed. The app can use the OkHttpClient
to make resource calls using both Retrofit 2.x and Retrofit 1.x (with an additional 3rd party library).
Example how to use OkHttpClient with Retrofit 2.x
final OneginiClient oneginiClient = OneginiSDK.getOneginiClient(context);
final Retrofit retrofit = new Retrofit.Builder()
.client(oneginiClient.getDeviceClient().getAnonymousResourceOkHttpClient())
.baseUrl(oneginiClient.getConfigModel().getResourceBaseUrl() + "/") // In Retrofit 2.X the base URL should end with '/'
.build();
Example how to use OkHttpClient with Retrofit 1.x
With additional dependency added to the app project: com.jakewharton.retrofit:retrofit1-okhttp3-client
final OneginiClient oneginiClient = OneginiSDK.getOneginiClient(context);
final RestAdapter restAdapter = new RestAdapter.Builder()
.setClient(new Ok3Client(oneginiClient.getDeviceClient().getAnonymousResourceOkHttpClient()))
.setEndpoint(oneginiClient.getConfigModel().getResourceBaseUrl())
.build();
Mobile authentication enrollment
In previous versions the SDK was exposing the
enrollUserForMobileAuthentication(final String registrationId, final OneginiMobileAuthenticationEnrollmentHandler enrollmentHandler)
method to allow the end
user to register for mobile authentication with push.
Starting from 7.0.0 the push enrollment is a two step action. Firstly, the authenticated user has to enroll for the mobile authentication feature using new
method: UserClient#enrollUserForMobileAuth(final OneginiMobileAuthEnrollmentHandler handler)
. Only when user has succeeded to enroll for mobile
authentication, he's then allowed to register for a mobile authentication with push using GCM registration ID:
UserClient#enrollUserForMobileAuthWithPush(final String registrationId, final OneginiMobileAuthWithPushEnrollmentHandler enrollmentHandler)
. Please check the
mobile authentication documentation for details.
OneginiError
Starting from version 7.0.0 the OneginiError
class implements the Throwable
interface.
The public String getErrorDescription()
method doesn't exist anymore. Instead the public String getMessage()
should be used.
The public Exception getException()
method doesn't exist anymore. Instead the public Throwable getCause()
should be used.
Renamed methods and handlers
From now on we distinguish two types of mobile authentication: with Push
and with OTP
. Therefore we renamed some method and handlers names listed below.
The list uses a pattern "previous naming -> currently naming":
handleMobileAuthenticationRequest - > handleMobileAuthWithPushRequest
setMobileAuthenticationRequestHandler -> setMobileAuthWithPushRequestHandler
setMobileAuthenticationPinRequestHandler -> setMobileAuthWithPushPinRequestHandler
setMobileAuthenticationFingerprintRequestHandler -> setMobileAuthWithPushFingerprintRequestHandler
setMobileAuthenticationCustomRequestHandler -> setMobileAuthWithPushCustomRequestHandler
setMobileAuthenticationFidoRequestHandler -> setMobileAuthWithPushFidoRequestHandler
OneginiMobileAuthenticationRequestHandler -> OneginiMobileAuthWithPushRequestHandler
OneginiMobileAuthenticationPinRequestHandler -> OneginiMobileAuthWithPushPinRequestHandler
OneginiMobileAuthenticationFingerprintRequestHandler -> OneginiMobileAuthWithPushFingerprintRequestHandler
OneginiMobileAuthenticationCustomRequestHandler -> OneginiMobileAuthWithPushCustomRequestHandler
OneginiMobileAuthenticationFidoRequestHandler -> OneginiMobileAuthWithPushFidoRequestHandler
The reason is to be more precise which mobile authentication type the handler is (push
or OTP
). From now on we have shortened MobileAuthentication
into
MobileAuth
for shorter and cleaner names.
OpenID Connect
The OpenID Connect functionality is not supported anymore. Therefore:
- The
UserClient#getOpenIdUserInfo()
method has been removed - The
com.nimbusds:nimbus-jose-jwt
dependency has been removed - Apache Commons IO (
commons-io:commons-io:2.5
) dependency has been added.