mirror of
https://github.com/bitwarden/directory-connector
synced 2025-12-16 16:23:41 +00:00
null checks
This commit is contained in:
@@ -38,7 +38,7 @@ namespace Bit.Core.Services
|
|||||||
}
|
}
|
||||||
|
|
||||||
var encBytes = SettingsService.Instance.AccessToken;
|
var encBytes = SettingsService.Instance.AccessToken;
|
||||||
if(encBytes != null)
|
if(encBytes?.Value != null)
|
||||||
{
|
{
|
||||||
_accessToken = Encoding.ASCII.GetString(encBytes.Decrypt());
|
_accessToken = Encoding.ASCII.GetString(encBytes.Decrypt());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,8 +18,8 @@ namespace Bit.Core.Utilities
|
|||||||
|
|
||||||
var authContext = new AuthenticationContext(
|
var authContext = new AuthenticationContext(
|
||||||
$"https://login.windows.net/{SettingsService.Instance.Server.Azure.Tenant}/oauth2/token");
|
$"https://login.windows.net/{SettingsService.Instance.Server.Azure.Tenant}/oauth2/token");
|
||||||
var creds = new ClientCredential(SettingsService.Instance.Server.Azure.Id,
|
var secret = SettingsService.Instance.Server.Azure.Secret.DecryptToString();
|
||||||
SettingsService.Instance.Server.Azure.Secret.DecryptToString());
|
var creds = new ClientCredential(SettingsService.Instance.Server.Azure.Id, secret);
|
||||||
var authResult = await authContext.AcquireTokenAsync("https://graph.microsoft.com/", creds);
|
var authResult = await authContext.AcquireTokenAsync("https://graph.microsoft.com/", creds);
|
||||||
request.Headers.Add("Authorization", $"Bearer {authResult.AccessToken}");
|
request.Headers.Add("Authorization", $"Bearer {authResult.AccessToken}");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user