Skip to content

Commit 5711ef8

Browse files
committed
Update by suggestion
1 parent 3a80988 commit 5711ef8

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

Services/SampleFunctions/GetAzureMapsSaSToken.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
namespace SampleFunctions;
1212

13-
public class GetAzureMapsSaSToken()
13+
public class GetAzureMapsSaSToken
1414
{
1515
private static readonly string[] AllowedDomains = [
1616
"https://samples.azuremaps.com/",
@@ -26,7 +26,7 @@ public class GetAzureMapsSaSToken()
2626
/// This tokenProvider will cache the token in memory, if you would like to reduce the dependency on Azure AD we recommend
2727
/// implementing a distributed cache combined with using the other methods available on tokenProvider.
2828
/// </remarks>
29-
private readonly DefaultAzureCredential _TokenProvider = new(new DefaultAzureCredentialOptions
29+
private readonly DefaultAzureCredential _tokenProvider = new(new DefaultAzureCredentialOptions
3030
{
3131
TenantId = Environment.GetEnvironmentVariable("MAPS_SAS_TENANT_ID") ?? "",
3232
ExcludeInteractiveBrowserCredential = true,
@@ -41,7 +41,7 @@ public IActionResult Run([HttpTrigger(AuthorizationLevel.Anonymous, "get")] Http
4141
// Check if the referer header is present and if the domain is allowed
4242
if (req.Headers.TryGetValue("Referer", out var referer) && AllowedDomains.Any(domain => referer.ToString().StartsWith(domain)))
4343
{
44-
armClient = new ArmClient(_TokenProvider);
44+
armClient = new ArmClient(_tokenProvider);
4545

4646
// Generate SAS token for Azure Maps
4747
string sasToken = GenerateAzureMapsSasToken(armClient);
@@ -57,7 +57,7 @@ public IActionResult Run([HttpTrigger(AuthorizationLevel.Anonymous, "get")] Http
5757
/// Generates a Shared Access Signature (SAS) token for Azure Maps authentication.
5858
/// </summary>
5959
/// <param name="armClient">The ArmClient instance to use for authentication</param>
60-
/// <param name="expiryInMinutes">Token expiry time in seconds (default: 600)</param>
60+
/// <param name="expiryInSeconds">Token expiry time in seconds (default: 600)</param>
6161
/// <param name="maxRatePerSecond">Maximum rate per second (default: 100)</param>
6262
/// <returns>The SAS token string</returns>
6363
private string GenerateAzureMapsSasToken(ArmClient armClient, int expiryInSeconds = 600, int maxRatePerSecond = 50)
@@ -75,7 +75,7 @@ private string GenerateAzureMapsSasToken(ArmClient armClient, int expiryInSecond
7575
string principalId = Environment.GetEnvironmentVariable("AZURE_MAPS_PRINCIPAL_ID") ?? "";
7676

7777
// Set start and expiry time for the SAS token in round-trip date/time format
78-
DateTime start = DateTime.Now;
78+
DateTime start = DateTime.UtcNow;
7979
DateTime expiry = start.AddSeconds(expiryInSeconds);
8080

8181
// Create the SAS token content

Services/SampleFunctions/GetAzureMapsToken.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
namespace SampleFunctions;
88

9-
public class GetAzureMapsToken()
9+
public class GetAzureMapsToken
1010
{
1111
private static readonly string[] AllowedDomains = [
1212
"https://samples.azuremaps.com/",

0 commit comments

Comments
 (0)