How to set up username and password authentication with the AirWatch Android SDK

The AirWatch Android SDK provides an API to allow the authentication of a user against AirWatch. An application can limit its access to users by integrating user authentication. Users need to be authenticated against the AirWatch Console, whether it is for a basic enrollment user or an Active Directory account, allowing your application to follow the same corporate security policies that are enforced with your other applications and systems.

 One type of authentication possible through the SDK is to use username and password credentials.

Authentication Type

Setting

Description

Passcode

Designates a local passcode requirement for AirWatch applications or wrapped applications that have the default settings profile applied to them. Device users set their passcode on the device at the application level when they first access the application.

Username and Password

Requires a user to authenticate to AirWatch using the AirWatch credentials. Set these credentials when you add users in the Accounts area of the AirWatch Admin Console.

Disable

Requires no authentication to access the application.

 

Note: Authentication Type and SSO can work together or alone. If you enable an Authentication Type (passcode or username/password) without SSO, then users must enter a separate passcode or credentials for each individual application. If you enable both Authentication Type and SSO, then users enter either their passcode or credentials (whichever you configure as the Authentication Type) once and do not have to re-enter them until the SSO session terminates. 

To set up your application to use a username and password to limit access, you can push down a custom SDK profile or use the default application settings set up in the Admin Console.

In order to use the default application settings, navigate to Groups & Settings > All Settings > Apps > Settings and Policies > Security Policies and set the Authentication Type to Username and Password.

For Username and Password authentication, below are the following options:

Username and Password Setting

Description

Authentication Timeout

Set the allowable time for access to applications before disallowing access due to inactivity. If SSO is enabled and the passcode times out, the SSO identity logs out of all AirWatch and configured corporate applications and resources.

Max Number of Failed Attempts

Set the maximum times a user can login with an incorrect passcode before having to authenticate and set a new passcode.

Implementing an Authentication Wall

The following section helps you limit access to your application to AirWatch users. Begin by setting up a Login View such as the one below to allow users to enter in their credentials and access the application. You can then have your application force users to login in this View before removing the authentication wall.

1.png

 

The code for this specific xml layout will look like the following:

xml_code.png

 

You can write a class that will be displayed at the app launch in order to demonstrate this capability. The important methods to look out for are the getAuthenticationType() and authenticateUser() methods from the SDKManager class. The code will look like the following:

3.png

4.png

 

You should now have an authentication wall that will allow a user to login and authenticate. In this example, you will see a Toast appear with a Boolean true or false value indicating the success or failure of the authentication. I will be attached the layout file as well as the Activity class used to set up the authentication wall in the example above.

Finishing Up 

You should now be able to limit access to your application by implementing an authentication wall that blocks a user pending their entry of credentials. For more information, please see the AirWatch Android SDK Technical Implementation Guide as well as the javadocs that come as part of the Android SDK.

Have more questions? Submit a request

0 Comments

Article is closed for comments.