Skip to end of banner
Go to start of banner

[BSS] Passwordless STB login

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Version History

« Previous Version 15 Next »

Introduction

This page introduces how we will implement passwordless login for set top boxes.

It describes the standard flow to implement passwordless login with Amino supplied STB interacting with Amino API

Solution summary

In three lines, the solution hinges on this:

  1. When logging in the STB makes a claim about its identity to Amino
  2. Amino is able to verify that claim
  3. We know which user has which STB and so can log the user in


User Stories

High level diagrams

Manufacturing process

Entone has a certificate authority (CA).

At the time of manufacture an RSA keypair signed by this CA will be added to the box.

User provisioning


The user purchases a STB.

The retail partner provisions a user account by calling the user management API (documentation)

The retail partner links the STB to the user (documentation)

The retail partner only needs to inform Amino of the STB serial number

User login


Note:

The Entone API will include the STB public key as one of the claims of the signed JWT token.

Detailed flow

Details of logging in with JWT

Sequence overview

  1. Client calls the Entone API to get a JWT used for logging in
  2. Client sends login JWT token to Middleware
  3. Middleware responds with two tokens that can be used to authenticate future requests

This is diagrammed in the section "user login" above.

Entone API

The View team will add a new function to the API with the following signature:

String ENTONE.stb.createJWT(algorithm, claim) 

Where claim is a object containing the payload of the JWT, algorithm is the mechanism to sign the signature.

The returned string is a JWT which is based64 encoded string. 

Parameters to pass to Entone API

The algorithm must be one of the values supported as the "alg" parameter in the JWT spec (here).  The only algorithm supported is RSA with sha-256 and so the algorithm parameter value should always be "RS256".

The client MUST use this format for the claim object:

$claim = [
    "iss"                => "EntoneAPI",
    "iat"                => time(),
    "exp"                => time() + TEN_MINUTES,
    "aud"                => "www.aminocom.com",
    "sub"                => "Serial number 123",
    'certificate'        => "String containing the STB public key"
    'batchCACertificate' => "String containing the STB batch CA certificate",
];

It will receive a JWT from EntoneAPI and must then call the MoveAPI endpoint as below.

MoveAPI

Endpoint

Method typeURLAuthorization
POST
https://domain.tld/api/stb/auth
Service-Token

Validation rules

The MoveAPI must validate the JWT as follows:

  1. Decode the JWT
  2. Retrieve the supplied public key from the "certificate" claim
  3. Retrieve the suppled CA certificate from the "batchCACertificate" claim
    1. If it is omitted then read the CA certificate for batch 0133 from disk
  4. Verify that:
    1. The issuer is EntoneAPI
    2. The audience is www.aminocom.com
    3. The token has not expired
    4. The token was issued in the past, or otherwise within a tolerable window to allow for server time drift
    5. JWT was signed with the key you obtained in step 2
  5. Verify that the CA certificate is signed by the Entone CA certificate
  6. Obtain the "sub" claim
  7. Find the user associated with the STB serial code indicated in the "sub"

(warning) It is important that the JWT is signed with the supplied key AND that the key was generated from the Entone root CA

Response

The Move Middleware will respond with two JWT tokens that can be used for authentication in future requests.  This is identical to DNA.

200
{
"jwt": "jp0cnVlLCJjb21wYW55IjoiVG9wdGFsIiw...",
"jwt_expiry": "Fri, 04 Dec 2015 16:01:07 +0000",
"refresh_token": "WkiUzKELZ49eM7oWxAQK_ZX...",
"refresh_token_expiry": "Fri, 04 Jan 2016 16:01:07 +0000",
"client_keystore": "MIIKwIBAzCCoYCSqGSIb3...",
"serial_no": "615500266162",
"chipset_id": "8c10d4de5760",
"mac": "8C10D4DE5761",
"user_id": "email@example.com"
}

JWT token both jwt and refresh_token are encrypted using a pass phrase and HS256 encryption.

Pass phrase is configurable by config file and will be shared separately.

JWT Sample Data

{
"iss": "dna.booxmedia.com",
"aud": "dna.booxmedia.com",
"type": "access",
"jti": "lAjYiDbptZ",
"iat": 1459161322,
"nbf": 1459161323,
"exp": 1459161922,
"data": {
         "stb": "370",
          "serial_no": "615500266162",
         "chipset_id": "8c10d4de5760",
         "mac": "8C10D4DE5761",
         "userId": "email@example.com"
}
}

401none -


Logout STB

API to handle logout request of STB

Request

MethodURLAuthorization
POST
https://customer.domain/api/stb/logout
STB (Using JWT), Service (Using service_token)

POST Body

Please note that M is for Mandatory and O is for Optional. 

Body FieldsM/ODescriptionValues
service_token
M

Token generated for a service. For example DNA has own service_token.

This token is generated from Backend and provided to application developers.

This token should be kept in a secured location on application, i.e STB

This param will be skipped if Service-Token HTTP Header  exists.
String of Alpha numeric values. Mostly MD5 or SHA1 string.
 e.g. 8f9cf3f5789e16124f38936954a98668

Headers

Please note that M is for Mandatory and O is for Optional.

HeaderM/ODescription
Authorization: Bearer
MJWT json web token provided by backend after STB authenticated successfully

Response

HTTP CodeResponse
200

none

401none

Link STB to a User

After user bought a STB this API need to be called. This API link or grant ownership of a STB to a user.

Request

MethodURLAuthorization
POST
https://boox.fi/api/management/stb/link_user
IP, Service (Digest Authentication)

POST Data Parameters

Please note that M is for Mandatory and O is for Optional.

ParametersM/ODescriptionValues
serviceMService to which the user belongs.String of service username. Shared separately.
serial_no
MSerial Number of STB. If device does not exists with provided serial no then it will be added.

Alpha numeric string.
e.g.  615507895162

email
MEmail address (being used as an user identifier in AminoTV) of user who is provisioned for using the STBValid email address.
e.g. john.doe@example.com 
public_keys
O

8 Public keys which will be used to authenticate the STB.



key0_base64;key1_base64;...........;key7_base64 (no limit on max length).

where each public key is base-64 encoded,semicolon(;) is used between keys as separator.


chipset_idOSTB device chipset number/ID.chipset_id is a random list of characters (max 32 characters).
macOEthernet interface MAC address.mac is a random list of characters (max 18 characters).

Response

HTTP CodeResponse
200

{

	"id": "123",
	"serial_no": "DNA-STB0001",
	"user": {
		"id": "10001",
		"email": "stb_user@dnastb.com"
	}
}
400
{
  "error" {
    "code": 9,
    "text": "Access to this resource is locked to IP addresses"
  }
}
401none

Error Codes

Error CodeDescription
1414Email does not exist
1426Parameter is required
1427Invalid length of chipset_id
1428Invalid length of mac
1433STB exists and linked
1434Record already exists for value
1435STB is already assigned
1436Invalid email address format

Unlink STB from User

This API remove ownership of a STB from an user. Use cases: when user sells his/her device, when a device got stolen. 

Request

MethodURLAuthorization
POST
https://customer.domain/api/management/stb/unlink_user
IP, Service (Digest Authentication)

POST Data Parameters

Please note that M is for Mandatory and O is for Optional.

ParametersM/ODescriptionValues
serviceMService to which the user belongs.String of service username. Shared separately.
serial_no
MSerial Number of STBAlpha numeric string.
e.g.  615507895162
email
MEmail address of user who is provisioned for using the STBValid email address.
e.g. john.doe@example.com 

Response

HTTP CodeResponse
200

none

400
{
  "error" {
    "code": 9,
    "text": "Access to this resource is locked to IP addresses"
  }
}
401none

Error Codes

Error CodeDescription
1414Email does not exist
1426Parameter is required
1432serial_no does not exists
1418Invalid STB link
1436Invalid email address format

Add New User Account

This API is used to add a new user account. Following rules apply:

  • Email address or customer-id should not belong to any customer that is not in DELETED state; otherwise API will return an error.
  • If the user with that email exists in DELETED state and his grace period is not expired, his previous registration state is restored.
  • A new user is created in UNREGISTERED state.


Design Points (to be considered for future):

  1. The main problem with making the two pin params as mandatory is that this feature is very specific to a customer requirements, while other frontends don't expect them. Therefore, we need a way so that both parties remain happy by giving a better design.
  2. For that we should make it configurable whether the two params are mandatory. So for those who require those PINs, we will configure them as mandatory, so that if they are not provided by 3rd provisioning system when creating a new user API will return an error to provide the mandatory input param. While for others, we will configure them as optional so that if they don't provide the params, API will successfully create a user and set the pins in DB as NULL (empty).
  3. It is easy to implement from effort point of view and much flexible and reliable

Request

Method TypeURLAuthorization
POSThttps://boox.fi/api/management/userService (Digest Authentication)

Query Strings

Please note that M is for Mandatory and O for Optional.

ParameterM/ODescriptionValues
serviceMService to which the user belongs.String of service username. Shared separately.
emailMEmail address of the user.Email address of the user
cidMCustomer Identifier.Numeric ID generated from Visio
auth_pinM

Authentication PIN code.

Change

This is new field.

At the DNA TV Rel 2.9 publish time, the provisioning party (Visio)
is not capable of supporting this. Change to optional temporarily. See Design Points above

Number with the length of 4.
e.g. 8798 
purchase_pinM

Purchase PIN code.

Change

This is new field.

At the DNA TV Rel 2.9 publish time, the provisioning party (Visio)
is not capable of supporting this. Change to optional temporarily. See Design Points above

Number with the length of 4.
e.g. 8798 
dobOUser Date of birth in YYYY-MM-DD format.

Error Codes

Error CodeDescription
1403email is missing
1405cid is missing
1406auth_pin is missing
1407purchase_pin is missing
1412Email already exists
1413CID already Exists

Edit Existing User Account

This API is used to suspend or activate a user account. It can also be used to change the email or customer-id of an existing account. Following rules apply:

  • A user in DELETED state is not updated.
  • "email" and "cid" parameters should not belong to any existing user, even if the user in in DELETED state
  • If a user is suspended, his state is changed to DISABLED
  • If a DISABLED user is activated and grace period has not expired, then previous registration state is restored, otherwise his state is changed to UNREGISTERED
  • In other cases, if a user is activated, his state changed to REGISTERED.

Request

Method TypeURLAuthorization
PUThttps://boox.fi/api/management/user/<email>Service (Digest Authentication)

Querystrings

Please note that M is for Mandatory and O for Optional.

ParameterM/ODescriptionValues
serviceMService to which the user belongs.String of service username. Shared separately.
emailONew email address of the user. Defaults to no value.Email address of the user
cidONew customer Identifier. Defaults to no value.Numeric ID generated from Visio
auth_pinO

Authentication PIN code.

Change

This is new field.

Number with the length of 4.
e.g. 8798 

purchase_pinO

Purchase PIN code.

Change

This is new field.

Number with the length of 4.
e.g. 8798 
actionOSUSPEND or ACTIVATE keywords. Defaults to no value.SUSPEND or ACTIVATE keywords are allowed only.

Error Codes

Error CodeDescription
1407action value is invalid
100User not found in the system
1404email is invalid
1406cid is invlid
  • No labels