-
Notifications
You must be signed in to change notification settings - Fork 10
/
SpekeDrmProvider.ts
80 lines (69 loc) · 3.3 KB
/
SpekeDrmProvider.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
import {map, mapArray} from '../common/Mapper';
import ExternalIdMode from './ExternalIdMode';
/**
* @export
* @class SpekeDrmProvider
*/
export class SpekeDrmProvider {
/**
* URL of the endpoint (required)
* @type {string}
* @memberof SpekeDrmProvider
*/
public url?: string;
/**
* Your username for Basic Authentication
* @type {string}
* @memberof SpekeDrmProvider
*/
public username?: string;
/**
* Your password for Basic Authentication
* @type {string}
* @memberof SpekeDrmProvider
*/
public password?: string;
/**
* Your API key for authentication via X-API-Key HTTP Header
* @type {string}
* @memberof SpekeDrmProvider
*/
public apiKey?: string;
/**
* AWS role that will be assumed for the key exchange in case the provider runs on AWS. During the key exchange the role will be assumed to be able to access the key provider. This role is to be created in the customer's account and must be granted access to the API Gateway of the SPEKE server. For Bitmovin to be able to assume this role, the following has to be added to the trust policy of the role: ``` { \"Effect\": \"Allow\", \"Principal\": { \"AWS\": \"arn:aws:iam::630681592166:user/bitmovinCustomerSpekeAccess\" }, \"Action\": \"sts:AssumeRole\", \"Condition\": { \"StringEquals\": { \"sts:ExternalId\": \"{{externalId}}\" } } } ``` It is recommended to also set the {{externalId}} due to security reasons but it can also be ommitted. Additionally the role needs a policy similar to the following to be able to invoke the API gateway: ``` { \"Version\": \"2012-10-17\", \"Statement\": [ { \"Effect\": \"Allow\", \"Action\": [ \"execute-api:Invoke\" ], \"Resource\": [ \"arn:aws:execute-api:{{region}}:*:*_/_*_/POST/_*\" ] } ] } ``` where `{{region}}` is the region of the API gateway (for example `us-west-2`), the same has to be set in the property 'gatewayRegion'. It's also possible to set `{{region}` to `*` to give the role access to all regions.
* @type {string}
* @memberof SpekeDrmProvider
*/
public roleArn?: string;
/**
* External ID used together with the IAM role identified by `roleArn` to assume access to the SPEKE server on AWS.
* @type {string}
* @memberof SpekeDrmProvider
*/
public externalId?: string;
/**
* @type {ExternalIdMode}
* @memberof SpekeDrmProvider
*/
public externalIdMode?: ExternalIdMode;
/**
* Describes the region of the AWS API Gateway that is used to access the SPEKE server. This property is mandatory when setting 'roleArn' and has to indicate in which region the AWS API Gateway is setup. This usually corresponds to the `{{region}}` one sets in the execute-api policy for the role as described in 'roleArn'.
* @type {string}
* @memberof SpekeDrmProvider
*/
public gatewayRegion?: string;
constructor(obj?: Partial<SpekeDrmProvider>) {
if(!obj) {
return;
}
this.url = map(obj.url);
this.username = map(obj.username);
this.password = map(obj.password);
this.apiKey = map(obj.apiKey);
this.roleArn = map(obj.roleArn);
this.externalId = map(obj.externalId);
this.externalIdMode = map(obj.externalIdMode);
this.gatewayRegion = map(obj.gatewayRegion);
}
}
export default SpekeDrmProvider;