From 30c6ca21bd80b23e2a3baa721e34190aafd6b7e6 Mon Sep 17 00:00:00 2001 From: davidgouge Date: Fri, 15 Mar 2019 14:18:44 +0000 Subject: [PATCH] Removed Obsolete attribute from ClientToken and added to AAD properties --- .../AttributeTests.cs | 27 +++++++++++++++++++ ....Notifications.Api.Client.UnitTests.csproj | 9 +++++++ .../packages.config | 2 ++ .../NotificationsApiClientConfiguration.cs | 8 ++++-- 4 files changed, 44 insertions(+), 2 deletions(-) create mode 100644 src/SFA.DAS.Notifications.Api.Client.UnitTests/NotificationsApiClientConfigurationTests/AttributeTests.cs diff --git a/src/SFA.DAS.Notifications.Api.Client.UnitTests/NotificationsApiClientConfigurationTests/AttributeTests.cs b/src/SFA.DAS.Notifications.Api.Client.UnitTests/NotificationsApiClientConfigurationTests/AttributeTests.cs new file mode 100644 index 00000000..93c4cf1b --- /dev/null +++ b/src/SFA.DAS.Notifications.Api.Client.UnitTests/NotificationsApiClientConfigurationTests/AttributeTests.cs @@ -0,0 +1,27 @@ +using System; +using FluentAssertions; +using NUnit.Framework; +using SFA.DAS.Notifications.Api.Client.Configuration; + +namespace SFA.DAS.Notifications.Api.Client.UnitTests.NotificationsApiClientConfigurationTests +{ + [TestFixture] + public class AttributeTests + { + [Test] + public void ClientTokenDoesNotHaveAnObsoleteAttribute() + { + typeof(NotificationsApiClientConfiguration).GetProperty("ClientToken").Should().NotBeDecoratedWith(); + } + + + [TestCase("ClientId")] + [TestCase("ClientSecret")] + [TestCase("IdentifierUri")] + [TestCase("Tenant")] + public void AADPropertyHasObsoleteAttribute(string propertyName) + { + typeof(NotificationsApiClientConfiguration).GetProperty(propertyName).Should().BeDecoratedWith(); + } + } +} \ No newline at end of file diff --git a/src/SFA.DAS.Notifications.Api.Client.UnitTests/SFA.DAS.Notifications.Api.Client.UnitTests.csproj b/src/SFA.DAS.Notifications.Api.Client.UnitTests/SFA.DAS.Notifications.Api.Client.UnitTests.csproj index a60c4be5..32d60662 100644 --- a/src/SFA.DAS.Notifications.Api.Client.UnitTests/SFA.DAS.Notifications.Api.Client.UnitTests.csproj +++ b/src/SFA.DAS.Notifications.Api.Client.UnitTests/SFA.DAS.Notifications.Api.Client.UnitTests.csproj @@ -35,6 +35,10 @@ ..\packages\Castle.Core.3.3.3\lib\net45\Castle.Core.dll True + + ..\packages\FluentAssertions.5.6.0\lib\net45\FluentAssertions.dll + True + ..\packages\Microsoft.ApplicationInsights.2.2.0\lib\net45\Microsoft.ApplicationInsights.dll @@ -60,6 +64,10 @@ + + ..\packages\System.ValueTuple.4.4.0\lib\netstandard1.0\System.ValueTuple.dll + True + @@ -71,6 +79,7 @@ + diff --git a/src/SFA.DAS.Notifications.Api.Client.UnitTests/packages.config b/src/SFA.DAS.Notifications.Api.Client.UnitTests/packages.config index 467c6ef7..0f6195dd 100644 --- a/src/SFA.DAS.Notifications.Api.Client.UnitTests/packages.config +++ b/src/SFA.DAS.Notifications.Api.Client.UnitTests/packages.config @@ -1,10 +1,12 @@  + + \ No newline at end of file diff --git a/src/SFA.DAS.Notifications.Api.Client/Configuration/NotificationsApiClientConfiguration.cs b/src/SFA.DAS.Notifications.Api.Client/Configuration/NotificationsApiClientConfiguration.cs index c546be74..53b70d88 100644 --- a/src/SFA.DAS.Notifications.Api.Client/Configuration/NotificationsApiClientConfiguration.cs +++ b/src/SFA.DAS.Notifications.Api.Client/Configuration/NotificationsApiClientConfiguration.cs @@ -5,12 +5,16 @@ namespace SFA.DAS.Notifications.Api.Client.Configuration public class NotificationsApiClientConfiguration : INotificationsApiClientConfiguration { public string ApiBaseUrl { get; set; } + + [Obsolete("Azure AD authentication is obsolete. Use JWT authentication.")] public string ClientId { get; set; } + [Obsolete("Azure AD authentication is obsolete. Use JWT authentication.")] public string ClientSecret { get; set; } + [Obsolete("Azure AD authentication is obsolete. Use JWT authentication.")] public string IdentifierUri { get; set; } + [Obsolete("Azure AD authentication is obsolete. Use JWT authentication.")] public string Tenant { get; set; } - - [Obsolete("Jwt token usage is obsolete. Use Azure AD authentication.")] + public string ClientToken { get; set; } } } \ No newline at end of file