(Legacy) Passing client information (device, connection, and application)
- Topics:
- Authentication
Scope
This document aggregates details and cookbooks for passing client information (device, connection and application) from a Programmer application to Adobe Pass Authentication REST APIs or SDKs.
The benefits of providing client information are:
- The ability to properly enable Home Base Authentication (HBA) in the case of some device types and MVPDs that can support HBA.
- The ability to properly apply TTLs in the case of some device types (for example, configure longer TTLs for authentication sessions on TV connected devices).
- The ability to properly aggregate business metrics in broken down reports across device types using Entitlement Service Monitoring (ESM).
- Unblocks the ability to properly apply various business rules (ex. degradation) on specific device types.
Overview
The client information consists of:
- Device information about the hardware and software attributes of the device from where the user is trying to consume the Programmer content.
- Connection information about the connection attributes of the device from where the user is connecting to Adobe Pass Authentication services and/or Programmer services (e.g. server-to-server implementations).
- Application information about the registered application from where the user is trying to consume the Programmer content.
The client information is a JSON object built with keys presented in the following table.
primaryHardwareType
, osName
, osFamily
, browserName
, browserVendor
, connectionSecure
.API references
This section presents the API responsible for handling client information when using Adobe Pass Authentication REST APIs or SDKs.
REST API
Adobe Pass Authentication services support receiving the client information in the following ways:
- As a header: “X-Device-Info”
- As a query parameter: “device_info”
- As a post parameter: “device_info”
SDK
JavaScript SDK
The AccessEnabler JavaScript SDK builds by default a client information JSON object, which will be passed to Adobe Pass Authentication services, unless overridden.
The AccessEnabler JavaScript SDK supports overriding only the “applicationId” key from the client information JSON object through the setRequestor’s applicationId options parameter.
applicationId
parameter value must be a plain text String value.In case the Programmer application decides to pass the applicationId, then the rest of client information keys will still be computed by the AccessEnabler JavaScript SDK.
iOS/tvOS SDK
The AccessEnabler iOS/tvOS SDK builds by default a client information JSON object, which will be passed to Adobe Pass Authentication services, unless overridden.
The AccessEnabler iOS/tvOS SDK supports overriding the whole client information JSON object through the setOptions’s device_info parameter.
Android/FireOS SDK
The AccessEnabler
Android/FireOS SDK builds by default a client information JSON object, which will be passed to Adobe Pass Authentication services, unless overridden.
The AccessEnabler
Android/FireOS SDK supports overriding the whole client information JSON object through the setOptions’s/setOptions’s device_info
parameter.
device_info
parameter value must be a Base64 encoded String value.device_info
, then all client information keys computed by the AccessEnabler
Android/FireOS SDK will be overridden. Therefore, it is very important to compute and pass the values for as many keys as possible. For more details regarding the implementation, see the Overview table and the Android and FireOS cookbook.Cookbooks
This section presents a cookbook for building the client information JSON Object in the case of different device types.
Android
The device information can be constructed the following way:
The connection information can be constructed the following way:
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
getSystemService(Context.CONNECTIVITY_SERVICE).getActiveNetworkInfo().getType()
"WIFI","BLUETOOTH","MOBILE","ETHERNET","VPN","DUMMY","MOBILE_DUN","WIMAX","notAccessible"
The application information can be constructed the following way:
Sample code
private JSONObject computeClientInformation() {
String LOGGING_TAG = "DefineClass.class";
JSONObject clientInformation = new JSONObject();
String connectionType;
try {
ConnectivityManager cm = (ConnectivityManager) getContext().getSystemService(CONNECTIVITY_SERVICE);
NetworkInfo activeNetwork = cm.getActiveNetworkInfo();
if (activeNetwork != null && activeNetwork.isConnectedOrConnecting()) {
switch (activeNetwork.getType()) {
case ConnectivityManager.TYPE_WIFI: {
connectionType = "WIFI";
break;
}
case ConnectivityManager.TYPE_BLUETOOTH: {
connectionType = "BLUETOOTH";
break;
}
case ConnectivityManager.TYPE_MOBILE: {
connectionType = "MOBILE";
break;
}
case ConnectivityManager.TYPE_ETHERNET: {
connectionType = "ETHERNET";
break;
}
case ConnectivityManager.TYPE_VPN: {
connectionType = "VPN";
break;
}
case ConnectivityManager.TYPE_DUMMY: {
connectionType = "DUMMY";
break;
}
case ConnectivityManager.TYPE_MOBILE_DUN: {
connectionType = "MOBILE_DUN";
break;
}
case ConnectivityManager.TYPE_WIMAX: {
connectionType = "WIMAX";
break;
}
default:
connectionType = ConnectivityManager.EXTRA_OTHER_NETWORK_INFO;
}
} else {
connectionType = ConnectivityManager.EXTRA_NO_CONNECTIVITY;
}
} catch (Exception e) {
connectionType = "notAccessible";
}
try {
clientInformation.put("model",Build.MODEL);
clientInformation.put("vendor", Build.BRAND);
clientInformation.put("manufacturer",Build.MANUFACTURER);
clientInformation.put("version",Build.DEVICE);
clientInformation.put("osName","Android");
clientInformation.put("osVersion",Build.VERSION.RELEASE);
clientInformation.put("connectionType",connectionType);
clientInformation.put("applicationId","CNN");
} catch (JSONException e) {
Log.e(LOGGING_TAG, e.getMessage());
}
return Base64.encodeToString(clientInformation.toString().getBytes(), Base64.NO_WRAP);
}
FireTV
The device information can be constructed the following way:
The connection information can be constructed the following way:
The application information can be constructed the following way:
iOS/tvOS
The device information can be constructed the following way:
The connection information can be constructed the following way:
The application information can be constructed the following way:
Sample code
+ (NSString *)computeClientInformation {
struct utsname u;
uname(&u);
NSString *hardware = [NSString stringWithCString:u.machine encoding:NSUTF8StringEncoding];
UIDevice *device = [UIDevice currentDevice];
NSString *deviceType;
switch (UI_USER_INTERFACE_IDIOM()) {
case UIUserInterfaceIdiomPhone:
deviceType = @"MobilePhone";
break;
case UIUserInterfaceIdiomPad:
deviceType = @"Tablet";
break;
case UIUserInterfaceIdiomTV:
deviceType = @"TV";
break;
default:
deviceType = @"Unknown";
}
CGRect screenRect = [[UIScreen mainScreen] bounds];
NSNumber *screenWidth = @((float) screenRect.size.width);
NSNumber *screenHeight = @((float) screenRect.size.height);
Reachability *reachability = [Reachability reachabilityForInternetConnection];
[reachability startNotifier];
NetworkStatus status = [reachability currentReachabilityStatus];
NSString *connectionType;
if (status == NotReachable) {
connectionType = @"notConnected";
} else if (status == ReachableViaWiFi) {
connectionType = @"WiFi";
} else if (status == ReachableViaWWAN) {
connectionType = @"cellular";
}
NSMutableDictionary *clientInformation = [@{
@"type": deviceType,
@"model": device.model,
@"vendor": @"Apple",
@"manufacturer": @"Apple",
@"version": [hardware stringByReplacingOccurrencesOfString:device.model withString:@""],
@"osName": device.systemName,
@"osVersion": device.systemVersion,
@"displayWidth": screenWidth,
@"displayHeight": screenHeight,
@"connectionType": connectionType,
@"applicationId": @"CNN"
} mutableCopy];
NSError *error;
NSData *jsonData = [NSJSONSerialization dataWithJSONObject:clientInformation options:NSJSONWritingPrettyPrinted error:&error];
NSString *base64Encoded = [jsonData base64EncodedStringWithOptions:0];
return base64Encoded;
}
Roku
The device information can be constructed the following way:
The connection information can be constructed the following way:
The application information can be constructed the following way:
XBOX 1/360
The device information can be constructed the following way:
The connection information can be constructed the following way:
The application information can be constructed the following way:
Resources