Triton Mobile SDK for Android 3.5.1 This is a custom android player made by Triton Digital

Loading...
Searching...
No Matches
Static Public Member Functions | List of all members
com.tritondigital.util.AuthUtil Class Reference

Utility to create an authentication token. More...

## Static Public Member Functions
static String | createJwtToken (String secretKey, String secretKeyId, boolean registeredUser, String userId, Map< String, String > targetingParams)
| Creates a JWT token.

## Detailed Description

Utility to create an authentication token.

Example - Token Authorization (self signed)
  // Create the targeting parameters
  HashMap<String, String> targetingParams = new HashMap();
  targetingParams.put(StreamUrlBuilder.COUNTRY_CODE, "US");
  targetingParams.put(StreamUrlBuilder.POSTAL_CODE, "12345");
  targetingParams.put(StreamUrlBuilder.GENDER, "m");
  targetingParams.put(StreamUrlBuilder.YEAR_OF_BIRTH, "1990");
  // Create the authentication token
  String token = AuthUtil.createJwtToken("MySecretKey", "MySecretKeyId", true, "foo@bar.com", targetingParams);
  // Create the player settings.
  Bundle settings = new Bundle();
  settings.putBoolean(TritonPlayer.SETTINGS_TARGETING_LOCATION_TRACKING_ENABLED, true);
  settings.putSerializable(TritonPlayer.SETTINGS_TARGETING_PARAMS, targetingParams);
  settings.putString(TritonPlayer.SETTINGS_AUTH_TOKEN, token);
  settings.putString(TritonPlayer.SETTINGS_STATION_BROADCASTER, "Triton Digital");
  settings.putString(TritonPlayer.SETTINGS_STATION_NAME, "MOBILEFM");
  settings.putString(TritonPlayer.SETTINGS_STATION_MOUNT, "MOBILEFM_AACV2");
  // Create the player.
  TritonPlayer player = new TritonPlayer(this, settings);
  player.play();
  com.tritondigital.util.AuthUtil
  Utility to create an authentication token.
  Definition AuthUtil.java:45
  com.tritondigital.util.AuthUtil.createJwtToken
  static String createJwtToken(String secretKey, String secretKeyId, boolean registeredUser, String userId, Map< String, String > targetingParams)
  Creates a JWT token.
  Definition AuthUtil.java:133

## Member Function Documentation

## ◆ createJwtToken()

static String com.tritondigital.util.AuthUtil.createJwtToken | ( | String | secretKey,
|  | String | secretKeyId,
|  | boolean | registeredUser,
|  | String | userId,
|  | Map< String, String > | targetingParams
| ) |  |
| static

Creates a JWT token.

Parameters

  secretKey | HMAC secret key (provided by Triton)
  secretKeyId | The Secret Key's ID or "null" (provided by Triton)
  registeredUser | True if the user is considered registered
  userId | User ID (from authentication). Can be null
  targetingParams | Triton targeting params (see TritonPlayer::SETTINGS_TARGETING_PARAMS). Can be null

The documentation for this class was generated from the following file:

- util/src/main/java/com/tritondigital/util/AuthUtil.java