Skip to content

Commit

Permalink
Add ScopeID (#477)
Browse files Browse the repository at this point in the history
* Add ScopeID

* Update src/AzureIoTHub.Portal/Client/Pages/Devices/ConnectionStringDialog.razor

Co-authored-by: Kevin BEAUGRAND <[email protected]>

* Update src/AzureIoTHub.Portal/Client/Pages/Edge_Devices/ConnectionStringDialog.razor

Co-authored-by: Kevin BEAUGRAND <[email protected]>

Co-authored-by: crib <[email protected]>
Co-authored-by: Kevin BEAUGRAND <[email protected]>
  • Loading branch information
3 people authored Mar 23, 2022
1 parent 5541bb3 commit ee48d8f
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,9 @@ public async Task GetEnrollmentCredentialsAsyncShouldGetDPSAttestation(string mo
_ = this.mockConfigHandler.SetupGet(c => c.DPSEndpoint)
.Returns("FakeEndpoint");

_ = this.mockConfigHandler.SetupGet(c => c.DPSScopeID)
.Returns("FakeScopeID");

// Act
var result = await manager.GetEnrollmentCredentialsAsync(
"sn-007-888-abc-mac-a1-b2-c3-d4-e5-f6",
Expand All @@ -265,6 +268,7 @@ public async Task GetEnrollmentCredentialsAsyncShouldGetDPSAttestation(string mo
Assert.IsNotNull(result);
Assert.AreEqual("sn-007-888-abc-mac-a1-b2-c3-d4-e5-f6", result.RegistrationID);
Assert.AreEqual("https://FakeEndpoint", result.ProvisioningEndpoint);
Assert.AreEqual("FakeScopeID", result.ScopeID);
Assert.AreEqual("Jsm0lyGpjaVYVP2g3FnmnmG9dI/9qU24wNoykUmermc=", result.SymmetricKey);
this.mockRepository.VerifyAll();
}
Expand Down Expand Up @@ -293,6 +297,9 @@ public async Task WhenEnrollmentGoupsNotExistGetEnrollmentCredentialsAsyncShould
_ = this.mockConfigHandler.SetupGet(c => c.DPSEndpoint)
.Returns("FakeEndpoint");

_ = this.mockConfigHandler.SetupGet(c => c.DPSScopeID)
.Returns("FakeScopeID");

_ = this.mockProvisioningServiceClient.Setup(c => c.CreateOrUpdateEnrollmentGroupAsync(
It.Is<EnrollmentGroup>(x => x.EnrollmentGroupId == enrollmentGroupName && x.Attestation is SymmetricKeyAttestation)))
.Callback(() =>
Expand All @@ -317,6 +324,7 @@ public async Task WhenEnrollmentGoupsNotExistGetEnrollmentCredentialsAsyncShould
Assert.IsNotNull(result);
Assert.AreEqual("sn-007-888-abc-mac-a1-b2-c3-d4-e5-f6", result.RegistrationID);
Assert.AreEqual("https://FakeEndpoint", result.ProvisioningEndpoint);
Assert.AreEqual("FakeScopeID", result.ScopeID);
Assert.AreEqual("Jsm0lyGpjaVYVP2g3FnmnmG9dI/9qU24wNoykUmermc=", result.SymmetricKey);

this.mockRepository.VerifyAll();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@
<MudText Style="text-decoration:underline"><b>Device Id</b></MudText>
<MudTextField @bind-Value="@Credentials.RegistrationID" Class="mt-0" Variant="Variant.Text" Margin="Margin.Dense" ReadOnly="true" Adornment="Adornment.End" AdornmentIcon="@Icons.Filled.ContentCopy" OnAdornmentClick="@(() => ClipboardService.WriteTextAsync(Credentials.RegistrationID))" />
</MudItem>
<MudItem Class="mt-0" xs="12">
<MudText Style="text-decoration:underline"><b>ScopeId</b></MudText>
<MudTextField @bind-Value="@Credentials.ScopeID" Class="mt-0" Variant="Variant.Text" Margin="Margin.Dense" ReadOnly="true" Adornment="Adornment.End" AdornmentIcon="@Icons.Filled.ContentCopy" OnAdornmentClick="@(() => ClipboardService.WriteTextAsync(Credentials.ScopeID))" />
</MudItem>
<MudItem Class="mt-0" xs="12">
<MudText Style="text-decoration:underline"><b>Symmetric Key</b></MudText>
<MudTextField @bind-Value="@Credentials.SymmetricKey" Variant="Variant.Text" InputType="InputType.Password" Margin="Margin.Dense" ReadOnly="true" Adornment="Adornment.End" AdornmentIcon="@Icons.Filled.ContentCopy" OnAdornmentClick="@(() => ClipboardService.WriteTextAsync(Credentials.SymmetricKey))" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@
<MudText Style="text-decoration:underline"><b>Device Id</b></MudText>
<MudTextField @bind-Value="@Credentials.RegistrationID" Class="mt-0" Variant="Variant.Text" Margin="Margin.Dense" ReadOnly="true" Adornment="Adornment.End" AdornmentIcon="@Icons.Filled.ContentCopy" OnAdornmentClick="@(() => ClipboardService.WriteTextAsync(Credentials.RegistrationID))" />
</MudItem>
<MudItem Class="mt-0" xs="12">
<MudText Style="text-decoration:underline"><b>ScopeId</b></MudText>
<MudTextField @bind-Value="@Credentials.ScopeID" Class="mt-0" Variant="Variant.Text" Margin="Margin.Dense" ReadOnly="true" Adornment="Adornment.End" AdornmentIcon="@Icons.Filled.ContentCopy" OnAdornmentClick="@(() => ClipboardService.WriteTextAsync(Credentials.ScopeID))" />
</MudItem>
<MudItem Class="mt-0" xs="12">
<MudText Style="text-decoration:underline"><b>Symmetric Key</b></MudText>
<MudTextField @bind-Value="@Credentials.SymmetricKey" Variant="Variant.Text" InputType="InputType.Password" Margin="Margin.Dense" ReadOnly="true" Adornment="Adornment.End" AdornmentIcon="@Icons.Filled.ContentCopy" OnAdornmentClick="@(() => ClipboardService.WriteTextAsync(Credentials.SymmetricKey))" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ public async Task<EnrollmentCredentials> GetEnrollmentCredentialsAsync(string de
{
SymmetricKey = symmetricKey,
RegistrationID = deviceId,
ScopeID = this.config.DPSScopeID,
ProvisioningEndpoint = $"https://{this.config.DPSEndpoint}"
};
}
Expand Down

0 comments on commit ee48d8f

Please sign in to comment.