Improve Android XWiki authenticator

Last modified by Vincent Massol on 2024/02/26 17:52

 

https://material.io/design/
https://www.youtube.com/watch?v=DdQTXrk6YTk&feature=youtu.be

Description

 XWiki aims to get all the contacts of your organization's intranet automatically and sync across on your phone. As of now, XWiki already has an Android application with basic features like:

  • Single XWiki account,
  • Displaying the contacts and,
  • Syncing the selected group contacts and syncing them across the device, in a regular interval.

Below is how XWiki works as of now,

Screenshot 2019-05-25 at 9.01.22 AM.png 

    The limitation with the current implementation and my approach to making it better:

  • No support for multiple accounts: XWiki does show-up in the add account page in the device settings but upon clicking toast is appeared stating “The user already exists” 

     Screenshot_2019-05-25-06-51-34-668_com.android.settings.png

      My approach:

           o  Adding account: (final Account account = new Account(accountName, Constants.ACCOUNT_TYPE))  

               and getting added account:  (Account availableAccounts[] = mAccountManager.getAccountsByType(Constants.ACCOUNT_TYPE)) is easy but challenge is to sync multiple account properly which requires to save the key                                                                                          information (accountName, accountPassword, accountServer) in DB and accessing them easily to sync user account. This approach requires changes to be done app-wide. 

  • Add support for OCID (OpenID Connect Provider): To interact with Authorization service we’ll be creating the: 

           o  AuthorizationServiceConfiguration here we’ll specify the URI to get the XWiki managed configuration hence creating the service configuration. 

           o  Then to obtains the authorization code we’ll be creating a request using AuthorizationRequest.Builder passing the above config, clientId, Response type, and the redirect URI.

           o  And finally opening the request in the browser using AuthorizationService which will perform the authorization. 

           o  At this point, we’ll be listening to the AuthorizationResponse. If the authorization is completed (authService.performTokenRequest). If the token response here is received successfully received, then authorization is completed. 

         

           An example of how Google perform this action when third party request sign-in. In our app, it will be similar where user does not have to enter the credentials has the advantage to directly sign-in using this approach.

       Screenshot_2019-05-25-07-27-08-546_com.google.android.gms.png

 

      Screenshot_2019-05-25-07-27-17-293_com.google.android.gms.png

 

 

 

 

 

  • Adding architectural pattern is used: An architecture pattern allows us to define a guide for the ‘architecture’ of a software system, making it scalable, maintainable and testable. Differing from design patterns, these have a major abstraction level. I plan to use MVVM which has the following benefits:

           o   Includes three key parts: Model, View (user interface), ViewModel (as an agent between view and model).

           o   Provides clearer separation of the UI and application logic.

           o   Unit testing even easier, as there is no dependency on the View;

 

  • Migrating code into kotlin as prescribed by Google guideline: Kotlin is now official language for Android. As all the apps are migrating their existing code into kotlin, I plan to do the same. It has many advantages over Java.
  • Add more unit test cases in the app: Right now the app has basic Unit test cases written, before writing any new code I would want to create a TDD environment.
  • Edit contact improvement: Editing contacts is one of the basic functionality of any management system. Right now some part of edit contact functionality already exists in the code but that is not integrated in the app and not accessible to users. I will build other edit contact features on top of existing code.

       Screenshot 2019-05-25 at 8.56.14 AM.png

 

  • Improving overall app design by following Google Material design. I'll be strictly following the Google material design throughout the app and improving the overall design.
  • Finally Provide a library for easy implementation of dedicated XWiki authenticator: Initially, I thought to create a JAR file so any JAVA based project can use but it does not allow to include android resources or manifest files. Once JAR is created the existing android XWiki app will use the new library as a dependency. Since the core logic will be moved to a library testing will be much easier and required. Later on the same library can be hosted using jitpack or jCenter so that other developers would just need to add a grade dependency.

 


Tags:
    

Get Connected