Skip to content

Commit 12dd341

Browse files
Token Exchange introduces seamless token exchange capabilities for IVS RTX, enabling customers to upgrade or downgrade token capabilities and update token attributes within the IVS client SDK without forcing clients to disconnect and reconnect.
1 parent c3b7192 commit 12dd341

File tree

10 files changed

+363
-8
lines changed

10 files changed

+363
-8
lines changed

generator/ServiceModels/ivs-realtime/ivs-realtime-2020-07-14.api.json

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1184,7 +1184,9 @@
11841184
"errorCode":{"shape":"EventErrorCode"},
11851185
"destinationStageArn":{"shape":"StageArn"},
11861186
"destinationSessionId":{"shape":"StageSessionId"},
1187-
"replica":{"shape":"Replica"}
1187+
"replica":{"shape":"Replica"},
1188+
"previousToken":{"shape":"ExchangedParticipantToken"},
1189+
"newToken":{"shape":"ExchangedParticipantToken"}
11881190
}
11891191
},
11901192
"EventErrorCode":{
@@ -1223,9 +1225,19 @@
12231225
"SUBSCRIBE_ERROR",
12241226
"JOIN_ERROR",
12251227
"REPLICATION_STARTED",
1226-
"REPLICATION_STOPPED"
1228+
"REPLICATION_STOPPED",
1229+
"TOKEN_EXCHANGED"
12271230
]
12281231
},
1232+
"ExchangedParticipantToken":{
1233+
"type":"structure",
1234+
"members":{
1235+
"capabilities":{"shape":"ParticipantTokenCapabilities"},
1236+
"attributes":{"shape":"ParticipantTokenAttributes"},
1237+
"userId":{"shape":"ParticipantTokenUserId"},
1238+
"expirationTime":{"shape":"ParticipantTokenExpirationTime"}
1239+
}
1240+
},
12291241
"Framerate":{
12301242
"type":"float",
12311243
"box":true,

generator/ServiceModels/ivs-realtime/ivs-realtime-2020-07-14.docs.json

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -407,6 +407,13 @@
407407
"Event$name": "<p>The name of the event.</p>"
408408
}
409409
},
410+
"ExchangedParticipantToken": {
411+
"base": "<p>Object specifying an exchanged participant token in a stage, created when an original participant token is updated.</p> <p> <b>Important</b>: Treat tokens as opaque; i.e., do not build functionality based on token contents. The format of tokens could change in the future.</p>",
412+
"refs": {
413+
"Event$previousToken": "<p>Source participant token for <code>TOKEN_EXCHANGED</code> event.</p>",
414+
"Event$newToken": "<p>Participant token created during <code>TOKEN_EXCHANGED</code> event.</p>"
415+
}
416+
},
410417
"Framerate": {
411418
"base": null,
412419
"refs": {
@@ -958,14 +965,16 @@
958965
"base": null,
959966
"refs": {
960967
"CreateParticipantTokenRequest$attributes": "<p>Application-provided attributes to encode into the token and attach to a stage. Map keys and values can contain UTF-8 encoded text. The maximum length of this field is 1 KB total. <i>This field is exposed to all stage participants and should not be used for personally identifying, confidential, or sensitive information.</i> </p>",
961-
"ParticipantToken$attributes": "<p>Application-provided attributes to encode into the token and attach to a stage. <i>This field is exposed to all stage participants and should not be used for personally identifying, confidential, or sensitive information.</i> </p>",
968+
"ExchangedParticipantToken$attributes": "<p>Application-provided attributes to encode into the token and attach to a stage. Map keys and values can contain UTF-8 encoded text. The maximum length of this field is 1 KB total. <i>This field is exposed to all stage participants and should not be used for personally identifying, confidential, or sensitive information.</i> </p>",
969+
"ParticipantToken$attributes": "<p>Application-provided attributes to encode into the token and attach to a stage. Map keys and values can contain UTF-8 encoded text. The maximum length of this field is 1 KB total. <i>This field is exposed to all stage participants and should not be used for personally identifying, confidential, or sensitive information.</i> </p>",
962970
"ParticipantTokenConfiguration$attributes": "<p>Application-provided attributes to encode into the corresponding participant token and attach to a stage. Map keys and values can contain UTF-8 encoded text. The maximum length of this field is 1 KB total. <i>This field is exposed to all stage participants and should not be used for personally identifying, confidential, or sensitive information.</i> </p>"
963971
}
964972
},
965973
"ParticipantTokenCapabilities": {
966974
"base": null,
967975
"refs": {
968976
"CreateParticipantTokenRequest$capabilities": "<p>Set of capabilities that the user is allowed to perform in the stage. Default: <code>PUBLISH, SUBSCRIBE</code>.</p>",
977+
"ExchangedParticipantToken$capabilities": "<p>Set of capabilities that the user is allowed to perform in the stage.</p>",
969978
"ParticipantToken$capabilities": "<p>Set of capabilities that the user is allowed to perform in the stage.</p>",
970979
"ParticipantTokenConfiguration$capabilities": "<p>Set of capabilities that the user is allowed to perform in the stage.</p>"
971980
}
@@ -999,6 +1008,7 @@
9991008
"ParticipantTokenExpirationTime": {
10001009
"base": null,
10011010
"refs": {
1011+
"ExchangedParticipantToken$expirationTime": "<p>ISO 8601 timestamp (returned as a string) for when this token expires.</p>",
10021012
"ParticipantToken$expirationTime": "<p>ISO 8601 timestamp (returned as a string) for when this token expires.</p>"
10031013
}
10041014
},
@@ -1025,6 +1035,7 @@
10251035
"base": null,
10261036
"refs": {
10271037
"CreateParticipantTokenRequest$userId": "<p>Name that can be specified to help identify the token. This can be any UTF-8 encoded text. <i>This field is exposed to all stage participants and should not be used for personally identifying, confidential, or sensitive information.</i> </p>",
1038+
"ExchangedParticipantToken$userId": "<p>Customer-assigned name to help identify the token; this can be used to link a participant to a user in the customer’s own systems. This can be any UTF-8 encoded text. <i>This field is exposed to all stage participants and should not be used for personally identifying, confidential, or sensitive information.</i> </p>",
10281039
"ParticipantToken$userId": "<p>Customer-assigned name to help identify the token; this can be used to link a participant to a user in the customer’s own systems. This can be any UTF-8 encoded text. <i>This field is exposed to all stage participants and should not be used for personally identifying, confidential, or sensitive information.</i> </p>",
10291040
"ParticipantTokenConfiguration$userId": "<p>Customer-assigned name to help identify the token; this can be used to link a participant to a user in the customer’s own systems. This can be any UTF-8 encoded text. <i>This field is exposed to all stage participants and should not be used for personally identifying, confidential, or sensitive information.</i> </p>"
10301041
}

generator/ServiceModels/ivs-realtime/ivs-realtime-2020-07-14.normal.json

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1535,6 +1535,14 @@
15351535
"replica":{
15361536
"shape":"Replica",
15371537
"documentation":"<p>If true, this indicates the <code>participantId</code> is a replicated participant. If this is a subscribe event, then this flag refers to <code>remoteParticipantId</code>. Default: <code>false</code>.</p>"
1538+
},
1539+
"previousToken":{
1540+
"shape":"ExchangedParticipantToken",
1541+
"documentation":"<p>Source participant token for <code>TOKEN_EXCHANGED</code> event.</p>"
1542+
},
1543+
"newToken":{
1544+
"shape":"ExchangedParticipantToken",
1545+
"documentation":"<p>Participant token created during <code>TOKEN_EXCHANGED</code> event.</p>"
15381546
}
15391547
},
15401548
"documentation":"<p>An occurrence during a stage session.</p>"
@@ -1575,9 +1583,32 @@
15751583
"SUBSCRIBE_ERROR",
15761584
"JOIN_ERROR",
15771585
"REPLICATION_STARTED",
1578-
"REPLICATION_STOPPED"
1586+
"REPLICATION_STOPPED",
1587+
"TOKEN_EXCHANGED"
15791588
]
15801589
},
1590+
"ExchangedParticipantToken":{
1591+
"type":"structure",
1592+
"members":{
1593+
"capabilities":{
1594+
"shape":"ParticipantTokenCapabilities",
1595+
"documentation":"<p>Set of capabilities that the user is allowed to perform in the stage.</p>"
1596+
},
1597+
"attributes":{
1598+
"shape":"ParticipantTokenAttributes",
1599+
"documentation":"<p>Application-provided attributes to encode into the token and attach to a stage. Map keys and values can contain UTF-8 encoded text. The maximum length of this field is 1 KB total. <i>This field is exposed to all stage participants and should not be used for personally identifying, confidential, or sensitive information.</i> </p>"
1600+
},
1601+
"userId":{
1602+
"shape":"ParticipantTokenUserId",
1603+
"documentation":"<p>Customer-assigned name to help identify the token; this can be used to link a participant to a user in the customer’s own systems. This can be any UTF-8 encoded text. <i>This field is exposed to all stage participants and should not be used for personally identifying, confidential, or sensitive information.</i> </p>"
1604+
},
1605+
"expirationTime":{
1606+
"shape":"ParticipantTokenExpirationTime",
1607+
"documentation":"<p>ISO 8601 timestamp (returned as a string) for when this token expires.</p>"
1608+
}
1609+
},
1610+
"documentation":"<p>Object specifying an exchanged participant token in a stage, created when an original participant token is updated.</p> <p> <b>Important</b>: Treat tokens as opaque; i.e., do not build functionality based on token contents. The format of tokens could change in the future.</p>"
1611+
},
15811612
"Framerate":{
15821613
"type":"float",
15831614
"box":true,
@@ -2780,7 +2811,7 @@
27802811
},
27812812
"attributes":{
27822813
"shape":"ParticipantTokenAttributes",
2783-
"documentation":"<p>Application-provided attributes to encode into the token and attach to a stage. <i>This field is exposed to all stage participants and should not be used for personally identifying, confidential, or sensitive information.</i> </p>"
2814+
"documentation":"<p>Application-provided attributes to encode into the token and attach to a stage. Map keys and values can contain UTF-8 encoded text. The maximum length of this field is 1 KB total. <i>This field is exposed to all stage participants and should not be used for personally identifying, confidential, or sensitive information.</i> </p>"
27842815
},
27852816
"duration":{
27862817
"shape":"ParticipantTokenDurationMinutes",

sdk/code-analysis/ServiceAnalysis/IVSRealTime/Generated/PropertyValueRules.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -627,6 +627,11 @@
627627
<max>64</max>
628628
<pattern>[a-zA-Z0-9-]*</pattern>
629629
</property-value-rule>
630+
<property-value-rule>
631+
<property>Amazon.IVSRealTime.Model.ExchangedParticipantToken.UserId</property>
632+
<min>0</min>
633+
<max>128</max>
634+
</property-value-rule>
630635
<property-value-rule>
631636
<property>Amazon.IVSRealTime.Model.GridConfiguration.FeaturedParticipantAttribute</property>
632637
<min>0</min>

sdk/src/Services/IVSRealTime/Generated/Model/Event.cs

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,9 @@ public partial class Event
3939
private EventErrorCode _errorCode;
4040
private DateTime? _eventTime;
4141
private EventName _name;
42+
private ExchangedParticipantToken _newToken;
4243
private string _participantId;
44+
private ExchangedParticipantToken _previousToken;
4345
private string _remoteParticipantId;
4446
private bool? _replica;
4547

@@ -218,6 +220,24 @@ internal bool IsSetName()
218220
return this._name != null;
219221
}
220222

223+
/// <summary>
224+
/// Gets and sets the property NewToken.
225+
/// <para>
226+
/// Participant token created during <c>TOKEN_EXCHANGED</c> event.
227+
/// </para>
228+
/// </summary>
229+
public ExchangedParticipantToken NewToken
230+
{
231+
get { return this._newToken; }
232+
set { this._newToken = value; }
233+
}
234+
235+
// Check to see if NewToken property is set
236+
internal bool IsSetNewToken()
237+
{
238+
return this._newToken != null;
239+
}
240+
221241
/// <summary>
222242
/// Gets and sets the property ParticipantId.
223243
/// <para>
@@ -238,6 +258,24 @@ internal bool IsSetParticipantId()
238258
return this._participantId != null;
239259
}
240260

261+
/// <summary>
262+
/// Gets and sets the property PreviousToken.
263+
/// <para>
264+
/// Source participant token for <c>TOKEN_EXCHANGED</c> event.
265+
/// </para>
266+
/// </summary>
267+
public ExchangedParticipantToken PreviousToken
268+
{
269+
get { return this._previousToken; }
270+
set { this._previousToken = value; }
271+
}
272+
273+
// Check to see if PreviousToken property is set
274+
internal bool IsSetPreviousToken()
275+
{
276+
return this._previousToken != null;
277+
}
278+
241279
/// <summary>
242280
/// Gets and sets the property RemoteParticipantId.
243281
/// <para>
Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
/*
2+
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License").
5+
* You may not use this file except in compliance with the License.
6+
* A copy of the License is located at
7+
*
8+
* http://aws.amazon.com/apache2.0
9+
*
10+
* or in the "license" file accompanying this file. This file is distributed
11+
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12+
* express or implied. See the License for the specific language governing
13+
* permissions and limitations under the License.
14+
*/
15+
16+
/*
17+
* Do not modify this file. This file is generated from the ivs-realtime-2020-07-14.normal.json service model.
18+
*/
19+
using System;
20+
using System.Collections.Generic;
21+
using System.Xml.Serialization;
22+
using System.Text;
23+
using System.IO;
24+
using System.Net;
25+
26+
using Amazon.Runtime;
27+
using Amazon.Runtime.Internal;
28+
29+
#pragma warning disable CS0612,CS0618,CS1570
30+
namespace Amazon.IVSRealTime.Model
31+
{
32+
/// <summary>
33+
/// Object specifying an exchanged participant token in a stage, created when an original
34+
/// participant token is updated.
35+
///
36+
///
37+
/// <para>
38+
/// <b>Important</b>: Treat tokens as opaque; i.e., do not build functionality based
39+
/// on token contents. The format of tokens could change in the future.
40+
/// </para>
41+
/// </summary>
42+
public partial class ExchangedParticipantToken
43+
{
44+
private Dictionary<string, string> _attributes = AWSConfigs.InitializeCollections ? new Dictionary<string, string>() : null;
45+
private List<string> _capabilities = AWSConfigs.InitializeCollections ? new List<string>() : null;
46+
private DateTime? _expirationTime;
47+
private string _userId;
48+
49+
/// <summary>
50+
/// Gets and sets the property Attributes.
51+
/// <para>
52+
/// Application-provided attributes to encode into the token and attach to a stage. Map
53+
/// keys and values can contain UTF-8 encoded text. The maximum length of this field is
54+
/// 1 KB total. <i>This field is exposed to all stage participants and should not be used
55+
/// for personally identifying, confidential, or sensitive information.</i>
56+
/// </para>
57+
/// <para />
58+
/// Starting with version 4 of the SDK this property will default to null. If no data for this property is returned
59+
/// from the service the property will also be null. This was changed to improve performance and allow the SDK and caller
60+
/// to distinguish between a property not set or a property being empty to clear out a value. To retain the previous
61+
/// SDK behavior set the AWSConfigs.InitializeCollections static property to true.
62+
/// </summary>
63+
public Dictionary<string, string> Attributes
64+
{
65+
get { return this._attributes; }
66+
set { this._attributes = value; }
67+
}
68+
69+
// Check to see if Attributes property is set
70+
internal bool IsSetAttributes()
71+
{
72+
return this._attributes != null && (this._attributes.Count > 0 || !AWSConfigs.InitializeCollections);
73+
}
74+
75+
/// <summary>
76+
/// Gets and sets the property Capabilities.
77+
/// <para>
78+
/// Set of capabilities that the user is allowed to perform in the stage.
79+
/// </para>
80+
/// <para />
81+
/// Starting with version 4 of the SDK this property will default to null. If no data for this property is returned
82+
/// from the service the property will also be null. This was changed to improve performance and allow the SDK and caller
83+
/// to distinguish between a property not set or a property being empty to clear out a value. To retain the previous
84+
/// SDK behavior set the AWSConfigs.InitializeCollections static property to true.
85+
/// </summary>
86+
[AWSProperty(Min=0, Max=2)]
87+
public List<string> Capabilities
88+
{
89+
get { return this._capabilities; }
90+
set { this._capabilities = value; }
91+
}
92+
93+
// Check to see if Capabilities property is set
94+
internal bool IsSetCapabilities()
95+
{
96+
return this._capabilities != null && (this._capabilities.Count > 0 || !AWSConfigs.InitializeCollections);
97+
}
98+
99+
/// <summary>
100+
/// Gets and sets the property ExpirationTime.
101+
/// <para>
102+
/// ISO 8601 timestamp (returned as a string) for when this token expires.
103+
/// </para>
104+
/// </summary>
105+
public DateTime? ExpirationTime
106+
{
107+
get { return this._expirationTime; }
108+
set { this._expirationTime = value; }
109+
}
110+
111+
// Check to see if ExpirationTime property is set
112+
internal bool IsSetExpirationTime()
113+
{
114+
return this._expirationTime.HasValue;
115+
}
116+
117+
/// <summary>
118+
/// Gets and sets the property UserId.
119+
/// <para>
120+
/// Customer-assigned name to help identify the token; this can be used to link a participant
121+
/// to a user in the customer’s own systems. This can be any UTF-8 encoded text. <i>This
122+
/// field is exposed to all stage participants and should not be used for personally identifying,
123+
/// confidential, or sensitive information.</i>
124+
/// </para>
125+
/// </summary>
126+
[AWSProperty(Min=0, Max=128)]
127+
public string UserId
128+
{
129+
get { return this._userId; }
130+
set { this._userId = value; }
131+
}
132+
133+
// Check to see if UserId property is set
134+
internal bool IsSetUserId()
135+
{
136+
return this._userId != null;
137+
}
138+
139+
}
140+
}

sdk/src/Services/IVSRealTime/Generated/Model/Internal/MarshallTransformations/EventUnmarshaller.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,12 +86,24 @@ public Event Unmarshall(JsonUnmarshallerContext context, ref StreamingUtf8JsonRe
8686
unmarshalledObject.Name = unmarshaller.Unmarshall(context, ref reader);
8787
continue;
8888
}
89+
if (context.TestExpression("newToken", targetDepth))
90+
{
91+
var unmarshaller = ExchangedParticipantTokenUnmarshaller.Instance;
92+
unmarshalledObject.NewToken = unmarshaller.Unmarshall(context, ref reader);
93+
continue;
94+
}
8995
if (context.TestExpression("participantId", targetDepth))
9096
{
9197
var unmarshaller = StringUnmarshaller.Instance;
9298
unmarshalledObject.ParticipantId = unmarshaller.Unmarshall(context, ref reader);
9399
continue;
94100
}
101+
if (context.TestExpression("previousToken", targetDepth))
102+
{
103+
var unmarshaller = ExchangedParticipantTokenUnmarshaller.Instance;
104+
unmarshalledObject.PreviousToken = unmarshaller.Unmarshall(context, ref reader);
105+
continue;
106+
}
95107
if (context.TestExpression("remoteParticipantId", targetDepth))
96108
{
97109
var unmarshaller = StringUnmarshaller.Instance;

0 commit comments

Comments
 (0)