Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

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

Basis of solution

This solution is based on /wiki/spaces/BOOX/pages/38273392/wiki/spaces/BOOX/pages/38273392

The flow is identical to DNA with the following exceptions:

  • The method of signing the token is JWT RS256
  • The call to /api/stb/auth is made using the JWT token

Table of Contents

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

Drawio
bordertrue
viewerToolbartrue
fitWindowfalse
diagramNamebig picture
simpleViewerfalse
width400
diagramWidth842
revision1

Table of Contents


User Stories

High level diagrams

Manufacturing process

Drawio
bordertrue
viewerToolbartrue
fitWindowfalse
diagramNamemanufacture
simpleViewerfalse
width600
diagramWidth771
revision1

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


Drawio
bordertrue
viewerToolbartrue
fitWindowfalse
diagramNameuser provisioning
simpleViewerfalse
width600
diagramWidth811
revision1

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 mac address.

User login


Drawio
bordertrue
viewerToolbartrue
fitWindowfalse
diagramNameuser login
simpleViewerfalse
width600
diagramWidth1061
revision2

Note:

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

Detailed flow

Login STB

Sequence overview

  1. STB client calls the Entone API to get a signed JWT token
  2. STB client calls the Move STB Authentication endpoint with the token and the public key
  3. Move API verifies the supplied public key by checking against a stored (trusted) version of the Entone  public key

  4. Move API verifies the JWT with the public key
  5. Move API matches the supplied STB serial number to the user
  6. Move API logs in the user

Logout STB

API to handle logout request of STB

Request

MethodURLAuthorization
POST
https://boox.fi/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.

Warning

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 of user who is provisioned for using the STBValid email address.
e.g. john.doe@example.com 
public_keys
M

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


Note

Public keys are stored based on the POST body order.

So first public key is considered having key index 0.

Last public key is considered having key index 7.

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://boox.fi/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

Info
Existing API linkhttps://dna.booxmedia.com:10086/docs/d5/d8b/user_management.html#add_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 DNA 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 DNA we will configure them as mandatory, so that if they are not provided by Visio when creating a new user API will return an error to provide the mandatory input param. While for others e.g. Delta 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). Also until DNA is not ready for the params to be mandatory we can keep it configured as optional for them
  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.

Info
titleChange

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.

Info
titleChange

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.SUSPEND or ACTIVATE keywords are allowed only.

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

Info
Existing API linkhttps://dna.booxmedia.com:10086/docs/d5/d8b/user_management.html#edit_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.

Info
titleChange

This is new field.

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

purchase_pinO

Purchase PIN code.

Info
titleChange

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