Building a native Android app with (android) ADAL library for azure active directory


Looking at the instructions for the project in gihub, there are “sparse” – to say the least. We guess that we needed the Android Development Platform  – which we duly installed on MacOS. (We customized that further – for the Amazon kindle platform upon which we intend to test the app.).

While I could almost import the repository from the github URI, the import tool could not find any project (and thus failed to complete importing.) So, we used the “general project” option, instead.

image

https://github.com/AzureADSamples/NativeClient-Android

Screen Shot 2014-05-31 at 11.21.51 AM

Screen Shot 2014-05-31 at 11.23.24 AM

Screen Shot 2014-05-31 at 11.24.52 AM

 

Running this project produces error messages about “default launchers”.

So, we created a dummy android-application project, called foo, and compiled and ran it – hoping to fully configure all the tools settings – including configuring a virtual machine to run the app under:

Screen Shot 2014-05-31 at 11.30.59 AM

Screen Shot 2014-05-31 at 11.33.16 AM

Screen Shot 2014-05-31 at 11.34.34 AM

adding skin and CPU, to the defaults of “create AVD”

Screen Shot 2014-05-31 at 11.35.50 AM

starting the VM

Screen Shot 2014-05-31 at 11.37.45 AM

for app “foo”

Turns out that this doesn’t help us build and launch our “general app” – but we learned a lot! So try an import into new project from existing  files:

Screen Shot 2014-05-31 at 11.46.50 AM

Screen Shot 2014-05-31 at 11.48.23 AM

Running this project, we do  get to select a run time now:

Screen Shot 2014-05-31 at 11.49.56 AM

gets us along way to at least seeing a running vm (of the wrong api level,so far)

Screen Shot 2014-05-31 at 11.52.39 AM

So, not knowing much about this stuff, we just create the latest API level device (19, today):

Screen Shot 2014-05-31 at 11.54.35 AM

which gets us as far as

Screen Shot 2014-05-31 at 12.00.51 PM

note the comments about loading apks, and launching microsoft apps.

after dragging the lock item to the right to open up the main viewport of the phone we see

Screen Shot 2014-05-31 at 12.02.39 PM

 

which is all very nice, as a todoapp, but where is the office365 logon?

we see that the code has some pre-configured office 365 configuration information. So let’s change that for our own!

Screen Shot 2014-05-31 at 12.17.07 PM

Screen Shot 2014-05-31 at 12.24.17 PM

using safari browser to configure an AAD client app, in windows azure portal

Screen Shot 2014-05-31 at 12.24.51 PM

Screen Shot 2014-05-31 at 12.26.46 PM

align code with newly generated client id for the client-app

Screen Shot 2014-05-31 at 12.31.15 PM

align code with the server API we  deployed from the microsoft wfp->webAPI sample project (also used by the IOS app to webapi sample).

Now we hook up the client (logical proxy in AAD land) with the server (logical proxy in AAD land), using the AAD “enforcement and connectivity security model”:

Screen Shot 2014-05-31 at 12.33.31 PM

This means that token re-issuing – when an id-token is to be swapped for an access token (or refresh token) is constrained – to enforce the policy noted above – at issuing time. This or course dumbs down apps (just the way CIA/NSA want them), putting power and communication control in the hands of a few cloud vendors (just the way…)

Ok Running the project makes no difference to the use of the API – which clearly does not depend on the constants which just re-coded.

ok. its clear that we have to now go do whatever it takes to “install” the android ADAL project itself – so it presumably augments this app project – and gives us some code fragments perhaps.

Advertisements

About home_pw@msn.com

Computer Programmer who often does network administration with focus on security servers. Very strong in Microsoft Azure cloud!
This entry was posted in AAD, Azure AD. Bookmark the permalink.