Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,10 @@ public IActionResult DownloadSelfAssessmentReport(int selfAssessmentId)
public IActionResult TableauCompetencyDashboard()
{
var userEmail = User.GetUserPrimaryEmail();
var jwt = tableauConnectionHelper.GetTableauJwt(userEmail);
var adminId = User.GetAdminId();
var jwt = tableauConnectionHelper.GetTableauJwt();
ViewBag.Email = userEmail;
ViewBag.AdminId = adminId;
ViewBag.SiteName = tableauSiteName;
ViewBag.TableauServerUrl = tableauUrl;
ViewBag.WorkbookName = workbookName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

public interface ITableauConnectionHelperService
{
string GetTableauJwt(string email);
string GetTableauJwt();
}
public class TableauConnectionHelper : ITableauConnectionHelperService
{
Expand All @@ -24,7 +24,7 @@ public TableauConnectionHelper(IConfiguration config)
connectedAppSecretKey = config.GetTableauClientSecret();
user = config.GetTableauUser();
}
public string GetTableauJwt(string email)
public string GetTableauJwt()
{
var key = Encoding.UTF8.GetBytes(connectedAppSecretKey);
var signingCredentials = new SigningCredentials(new SymmetricSecurityKey(key), SecurityAlgorithms.HmacSha256);
Expand All @@ -41,8 +41,7 @@ public string GetTableauJwt(string email)
{ "aud", "tableau" },
{ "exp", new DateTimeOffset(DateTime.UtcNow.AddMinutes(5)).ToUnixTimeSeconds() },
{ "sub", user },
{ "scp", new[] { "tableau:views:embed" } },
{ "ExernalUserEmail", new [] { email } }
{ "scp", new[] { "tableau:views:embed" } }
};
var token = new JwtSecurityToken(header, payload);
var tokenHandler = new JwtSecurityTokenHandler();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
var viewName = ViewBag.ViewName;
var jwtToken = ViewBag.JwtToken;
var siteName = ViewBag.SiteName;
var aid = ViewBag.AdminId;
var email = ViewBag.Email;
var srcUrl = $"{tableauServerUrl}/t/{siteName}/views/{workbookName}/{viewName}";
ViewData["Title"] = "Supervised self assessments dashboard";
}
Expand All @@ -21,6 +23,8 @@
<tableau-viz id='tableau-viz'
src='@srcUrl' token='@jwtToken' toolbar='bottom'>
If the dashboard doesn't appear after a few seconds, <a href="#">reload the page</a>
<viz-parameter name="aid" value="@aid"></viz-parameter>
<viz-parameter name="email" value="@email"></viz-parameter>
</tableau-viz>
@section scripts {
@* We are not using Yarn/npm for the Tableau JS becaue of errors during installation relating to a missing dependency *@
Expand Down
Loading