Skip to content

Commit

Permalink
fix: modify claim name "data" to "connection_data" (#257)
Browse files Browse the repository at this point in the history
* Change "data" to "connection_data"

* Update TokenTests.cs

Update test as-well
  • Loading branch information
vona-ben authored Nov 28, 2024
1 parent 5038754 commit 870ef19
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions OpenTok/Util/TokenGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ internal Dictionary<string, object> GeneratePayload()
{ "jti", GenerateTokenId() },
{ "initial_layout_list", string.Join(" ", InitialLayoutClasses) },
{ "nonce", OpenTokUtils.GetRandomNumber() },
{ "data", this.Data },
{ "connection_data", this.Data },
};

return payload;
Expand All @@ -124,4 +124,4 @@ internal SigningCredentials GenerateCredentials()
return new SigningCredentials(new SymmetricSecurityKey(key), SecurityAlgorithms.HmacSha256);
}
}
}
}
4 changes: 2 additions & 2 deletions OpenTokTest/TokenTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ public void GenerateToken_ShouldReturnTokenWithDefaultValues()
public void GenerateToken_ShouldSetData()
{
var token = sut.GenerateToken(SessionId, data: "Some data.");
ExtractClaims(token)["data"].Should().Be("Some data.");
ExtractClaims(token)["connection_data"].Should().Be("Some data.");
}

[Fact]
Expand Down Expand Up @@ -203,4 +203,4 @@ private static Dictionary<string, string> ExtractClaims(string token)
;
}
}
}
}

0 comments on commit 870ef19

Please sign in to comment.