Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #278: Provide all material to support multiple authentication scheme #359

Open
wants to merge 5 commits into
base: development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 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
18 changes: 0 additions & 18 deletions CDP4-SDK.sln
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CDP4ServicesDal", "CDP4Serv
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CDP4ServicesDal.Tests", "CDP4ServicesDal.Tests\CDP4ServicesDal.Tests.csproj", "{2FF7ED2F-F866-40B9-9FCC-D151404242F2}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CDP4WspDal", "CDP4WspDal\CDP4WspDal.csproj", "{73547666-55AA-4364-9A5E-1A50693D1576}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CDP4WspDal.Tests", "CDP4WspDal.Tests\CDP4WspDal.Tests.csproj", "{88D4A523-C0DA-49C4-94DE-8E3BF93856BB}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CDP4Dal.NetCore.Tests", "CDP4Dal.NetCore.Tests\CDP4Dal.NetCore.Tests.csproj", "{E7A734D4-B28C-4D40-9C20-7EBB70AAAF3C}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CDP4ServicesDal.NetCore.Tests", "CDP4ServicesDal.NetCore.Tests\CDP4ServicesDal.NetCore.Tests.csproj", "{588AA66A-067B-408F-A5A0-2CC90770850A}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CDP4WspDal.NetCore.Tests", "CDP4WspDal.NetCore.Tests\CDP4WspDal.NetCore.Tests.csproj", "{46B293DE-39D4-4012-9FAA-DA7A62F0AD45}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CDP4JsonFileDal.NetCore.Tests", "CDP4JsonFileDal.NetCore.Tests\CDP4JsonFileDal.NetCore.Tests.csproj", "{0764766C-07C4-40D8-9910-25D93002A927}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CDP4Rules", "CDP4Rules\CDP4Rules.csproj", "{9EE84CC2-E768-4AB5-A657-1C36D602BEB4}"
Expand Down Expand Up @@ -132,14 +126,6 @@ Global
{2FF7ED2F-F866-40B9-9FCC-D151404242F2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2FF7ED2F-F866-40B9-9FCC-D151404242F2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2FF7ED2F-F866-40B9-9FCC-D151404242F2}.Release|Any CPU.Build.0 = Release|Any CPU
{73547666-55AA-4364-9A5E-1A50693D1576}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{73547666-55AA-4364-9A5E-1A50693D1576}.Debug|Any CPU.Build.0 = Debug|Any CPU
{73547666-55AA-4364-9A5E-1A50693D1576}.Release|Any CPU.ActiveCfg = Release|Any CPU
{73547666-55AA-4364-9A5E-1A50693D1576}.Release|Any CPU.Build.0 = Release|Any CPU
{88D4A523-C0DA-49C4-94DE-8E3BF93856BB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{88D4A523-C0DA-49C4-94DE-8E3BF93856BB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{88D4A523-C0DA-49C4-94DE-8E3BF93856BB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{88D4A523-C0DA-49C4-94DE-8E3BF93856BB}.Release|Any CPU.Build.0 = Release|Any CPU
{E7A734D4-B28C-4D40-9C20-7EBB70AAAF3C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E7A734D4-B28C-4D40-9C20-7EBB70AAAF3C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E7A734D4-B28C-4D40-9C20-7EBB70AAAF3C}.Release|Any CPU.ActiveCfg = Release|Any CPU
Expand All @@ -148,10 +134,6 @@ Global
{588AA66A-067B-408F-A5A0-2CC90770850A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{588AA66A-067B-408F-A5A0-2CC90770850A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{588AA66A-067B-408F-A5A0-2CC90770850A}.Release|Any CPU.Build.0 = Release|Any CPU
{46B293DE-39D4-4012-9FAA-DA7A62F0AD45}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{46B293DE-39D4-4012-9FAA-DA7A62F0AD45}.Debug|Any CPU.Build.0 = Debug|Any CPU
{46B293DE-39D4-4012-9FAA-DA7A62F0AD45}.Release|Any CPU.ActiveCfg = Release|Any CPU
{46B293DE-39D4-4012-9FAA-DA7A62F0AD45}.Release|Any CPU.Build.0 = Release|Any CPU
{0764766C-07C4-40D8-9910-25D93002A927}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0764766C-07C4-40D8-9910-25D93002A927}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0764766C-07C4-40D8-9910-25D93002A927}.Release|Any CPU.ActiveCfg = Release|Any CPU
Expand Down
4 changes: 4 additions & 0 deletions CDP4-SDK.sln.DotSettings
Original file line number Diff line number Diff line change
Expand Up @@ -272,11 +272,15 @@
<s:Boolean x:Key="/Default/CodeStyle/Naming/CSharpNaming/ApplyAutoDetectedRules/@EntryValue">False</s:Boolean>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=PrivateInstanceFields/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /&gt;</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=PrivateStaticFields/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /&gt;</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/UserRules/=4a98fdf6_002D7d98_002D4f5a_002Dafeb_002Dea44ad98c70c/@EntryIndexedValue">&lt;Policy&gt;&lt;Descriptor Staticness="Instance" AccessRightKinds="Private" Description="Instance fields (private)"&gt;&lt;ElementKinds&gt;&lt;Kind Name="FIELD" /&gt;&lt;Kind Name="READONLY_FIELD" /&gt;&lt;/ElementKinds&gt;&lt;/Descriptor&gt;&lt;Policy Inspect="True" WarnAboutPrefixesAndSuffixes="False" Prefix="" Suffix="" Style="aaBb" /&gt;&lt;/Policy&gt;</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/UserRules/=f9fce829_002De6f4_002D4cb2_002D80f1_002D5497c44f51df/@EntryIndexedValue">&lt;Policy&gt;&lt;Descriptor Staticness="Static" AccessRightKinds="Private" Description="Static fields (private)"&gt;&lt;ElementKinds&gt;&lt;Kind Name="FIELD" /&gt;&lt;/ElementKinds&gt;&lt;/Descriptor&gt;&lt;Policy Inspect="True" WarnAboutPrefixesAndSuffixes="False" Prefix="" Suffix="" Style="aaBb" /&gt;&lt;/Policy&gt;</s:String>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EFeature_002EServices_002ECodeCleanup_002EFileHeader_002EFileHeaderSettingsMigrate/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpKeepExistingMigration/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpPlaceEmbeddedOnSameLineMigration/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpUseContinuousIndentInsideBracesMigration/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002EMemberReordering_002EMigrations_002ECSharpFileLayoutPatternRemoveIsAttributeUpgrade/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EAlwaysTreatStructAsNotReorderableMigration/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EMigrateBlankLinesAroundFieldToBlankLinesAroundProperty/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EPredefinedNamingRulesToUserRulesUpgrade/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/ReSpeller/CheckLocals/@EntryValue">False</s:Boolean>
<s:Boolean x:Key="/Default/ReSpeller/ReSpellerEnabled/@EntryValue">False</s:Boolean></wpf:ResourceDictionary>
1 change: 1 addition & 0 deletions CDP4Common.NetCore.Tests/CDP4Common.NetCore.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<Copyright>Copyright © Starion Group S.A.</Copyright>
<RepositoryUrl>https://github.com/STARIONGROUP/COMET-SDK-Community-Edition.git</RepositoryUrl>
<IsPackable>false</IsPackable>
<LangVersion>latest</LangVersion>
</PropertyGroup>

<ItemGroup>
Expand Down
1 change: 1 addition & 0 deletions CDP4Common.Tests/CDP4Common.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<Copyright>Copyright © Starion Group S.A.</Copyright>
<RepositoryUrl>https://github.com/STARIONGROUP/COMET-SDK-Community-Edition.git</RepositoryUrl>
<IsPackable>false</IsPackable>
<LangVersion>latest</LangVersion>
</PropertyGroup>

<ItemGroup>
Expand Down
1 change: 1 addition & 0 deletions CDP4Common/CDP4Common.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
[BUMP] Version to 27.4.2
</PackageReleaseNotes>
<PackageReadmeFile>README.md</PackageReadmeFile>
<LangVersion>latest</LangVersion>
</PropertyGroup>

<ItemGroup>
Expand Down
1 change: 1 addition & 0 deletions CDP4Dal.NetCore.Tests/CDP4Dal.NetCore.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<Copyright>Copyright © Starion Group S.A.</Copyright>
<RepositoryUrl>https://github.com/STARIONGROUP/COMET-SDK-Community-Edition.git</RepositoryUrl>
<IsPackable>false</IsPackable>
<LangVersion>latest</LangVersion>
</PropertyGroup>

<ItemGroup>
Expand Down
40 changes: 40 additions & 0 deletions CDP4Dal.NetCore.Tests/DAL/DalTestFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,26 @@ public override Task<IEnumerable<Thing>> CherryPick(Guid engineeringModelId, Gui
{
throw new System.NotImplementedException();
}

/// <summary>
/// Provides login capabitilities against data-source, based on provided <paramref name="userName"/> and <paramref name="password"/>.
/// </summary>
/// <param name="userName">The username that should be used for authentication</param>
/// <param name="password">The password that should be used for authentication</param>
/// <param name="cancellationToken">The <see cref="System.Threading.CancellationToken"/></param>
/// <remarks>This method should be used when using a CDP4-COMET WebServices and that it provides LocalJwtBearer authentication flow</remarks>
public override Task Login(string userName, string password, CancellationToken cancellationToken)
{
throw new System.NotImplementedException();
}

/// <summary>
/// Applies Authentication information based on the <see cref="Dal.Credentials" />
/// </summary>
public override void ApplyAuthenticationCredentials(Credentials credentials)
{
throw new System.NotImplementedException();
}
}

[DalExportAttribute("decorateddal", "a decorated dal", "1.1.0", DalType.Web)]
Expand Down Expand Up @@ -565,5 +585,25 @@ public override Task<IEnumerable<Thing>> CherryPick(Guid engineeringModelId, Gui
{
throw new NotSupportedException();
}

/// <summary>
/// Provides login capabitilities against data-source, based on provided <paramref name="userName"/> and <paramref name="password"/>.
/// </summary>
/// <param name="userName">The username that should be used for authentication</param>
/// <param name="password">The password that should be used for authentication</param>
/// <param name="cancellationToken">The <see cref="System.Threading.CancellationToken"/></param>
/// <remarks>This method should be used when using a CDP4-COMET WebServices and that it provides LocalJwtBearer authentication flow</remarks>
public override Task Login(string userName, string password, CancellationToken cancellationToken)
{
throw new System.NotImplementedException();
}

/// <summary>
/// Applies Authentication information based on the <see cref="Dal.Credentials" />
/// </summary>
public override void ApplyAuthenticationCredentials(Credentials credentials)
{
throw new System.NotImplementedException();
}
}
}
43 changes: 43 additions & 0 deletions CDP4Dal.NetCore.Tests/SessionTestFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ namespace CDP4Dal.NetCore.Tests
using CDP4Dal.Events;
using CDP4Dal.Exceptions;

using CDP4DalCommon.Authentication;
using CDP4DalCommon.Tasks;

using Moq;
Expand Down Expand Up @@ -1096,5 +1097,47 @@ public Task<IEnumerable<Thing>> CherryPick(Guid engineeringModelId, Guid iterati
{
throw new System.NotImplementedException();
}

/// <summary>
/// Requests to retrieve all available <see cref="AuthenticationSchemeKind" /> available on the datasource
/// </summary>
/// <param name="cancellationToken">The <see cref="System.Threading.CancellationToken" /></param>
/// <returns>An awaitable <see cref="System.Threading.Tasks.Task{TResult}"/> that contains the value of the queried <see cref="AuthenticationSchemeResponse" /></returns>
public Task<AuthenticationSchemeResponse> RequestAvailableAuthenticationScheme(CancellationToken cancellationToken)
{
return Task.FromResult(new AuthenticationSchemeResponse()
{
Schemes = [AuthenticationSchemeKind.Basic]
});
}

/// <summary>
/// Initializes this <see cref="Dal" /> with created <see cref="Dal.Credentials" />.
/// </summary>
/// <param name="credentials">The <see cref="Dal.Credentials"/></param>
/// <remarks>To be used in case of multiple-step authentication, requires to be able to support multiple Authentication scheme</remarks>
public void InitializeDalCredentials(Credentials credentials)
{
}

/// <summary>
/// Provides login capabitilities against data-source, based on provided <paramref name="userName"/> and <paramref name="password"/>.
/// </summary>
/// <param name="userName">The username that should be used for authentication</param>
/// <param name="password">The password that should be used for authentication</param>
/// <param name="cancellationToken">The <see cref="System.Threading.CancellationToken"/></param>
/// <remarks>This method should be used when using a CDP4-COMET WebServices and that it provides LocalJwtBearer authentication flow</remarks>
public Task Login(string userName, string password, CancellationToken cancellationToken)
{
throw new System.NotImplementedException();
}

/// <summary>
/// Applies Authentication information based on the <see cref="Dal.Credentials" />
/// </summary>
/// <param name="credentials">The <see cref="Credentials" /></param>
public void ApplyAuthenticationCredentials(Credentials credentials)
{
}
}
}
1 change: 1 addition & 0 deletions CDP4Dal.Tests/CDP4Dal.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<Copyright>Copyright © Starion Group S.A.</Copyright>
<RepositoryUrl>https://github.com/STARIONGROUP/COMET-SDK-Community-Edition.git</RepositoryUrl>
<IsPackable>false</IsPackable>
<LangVersion>latest</LangVersion>
</PropertyGroup>

<ItemGroup>
Expand Down
42 changes: 42 additions & 0 deletions CDP4Dal.Tests/DAL/DalTestFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,27 @@ public override Task<IEnumerable<Thing>> CherryPick(Guid engineeringModelId, Gui
{
throw new NotImplementedException();
}

/// <summary>
/// Provides login capabitilities against data-source, based on provided <paramref name="userName"/> and <paramref name="password"/>.
/// </summary>
/// <param name="userName">The username that should be used for authentication</param>
/// <param name="password">The password that should be used for authentication</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/></param>
/// <remarks>This method should be used when using a CDP4-COMET WebServices and that it provides LocalJwtBearer authentication flow</remarks>
public override Task Login(string userName, string password, CancellationToken cancellationToken)
{
throw new System.NotImplementedException();
}

/// <summary>
/// Applies Authentication information based on the <see cref="Dal.Credentials" />
/// </summary>
/// <param name="credentials"></param>
public override void ApplyAuthenticationCredentials(Credentials credentials)
{
throw new System.NotImplementedException();
}
}

[DalExportAttribute("decorateddal","a decorated dal","1.1.0",DalType.Web)]
Expand Down Expand Up @@ -565,5 +586,26 @@ public override Task<IEnumerable<Thing>> CherryPick(Guid engineeringModelId, Gui
{
throw new NotSupportedException();
}

/// <summary>
/// Provides login capabitilities against data-source, based on provided <paramref name="userName"/> and <paramref name="password"/>.
/// </summary>
/// <param name="userName">The username that should be used for authentication</param>
/// <param name="password">The password that should be used for authentication</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/></param>
/// <remarks>This method should be used when using a CDP4-COMET WebServices and that it provides LocalJwtBearer authentication flow</remarks>
public override Task Login(string userName, string password, CancellationToken cancellationToken)
{
throw new System.NotImplementedException();
}

/// <summary>
/// Applies Authentication information based on the <see cref="Dal.Credentials" />
/// </summary>
/// <param name="credentials"></param>
public override void ApplyAuthenticationCredentials(Credentials credentials)
{
throw new System.NotImplementedException();
}
}
}
44 changes: 44 additions & 0 deletions CDP4Dal.Tests/SessionTestFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ namespace CDP4Dal.Tests
using CDP4Dal.Events;
using CDP4Dal.Exceptions;

using CDP4DalCommon.Authentication;
using CDP4DalCommon.Tasks;

using Moq;
Expand Down Expand Up @@ -1183,5 +1184,48 @@ public Task<IEnumerable<Thing>> CherryPick(Guid engineeringModelId, Guid iterati
{
throw new NotImplementedException();
}

/// <summary>
/// Requests to retrieve all available <see cref="AuthenticationSchemeKind" /> available on the datasource
/// </summary>
/// <param name="cancellationToken"></param>
/// <returns>An awaitable <see cref="Task{TResult}"/> that contains the value of the queried <see cref="AuthenticationSchemeResponse" /></returns>
public Task<AuthenticationSchemeResponse> RequestAvailableAuthenticationScheme(CancellationToken cancellationToken)
{
return Task.FromResult(new AuthenticationSchemeResponse()
{
Schemes = [AuthenticationSchemeKind.Basic]
});
}

/// <summary>
/// Initializes this <see cref="Dal" /> with created <see cref="Dal.Credentials" />.
/// </summary>
/// <param name="credentials">The <see cref="Dal.Credentials"/></param>
/// <remarks>To be used in case of multiple-step authentication, requires to be able to support multiple Authentication scheme</remarks>
public void InitializeDalCredentials(Credentials credentials)
{
}

/// <summary>
/// Provides login capabitilities against data-source, based on provided <paramref name="userName"/> and <paramref name="password"/>.
/// </summary>
/// <param name="userName">The username that should be used for authentication</param>
/// <param name="password">The password that should be used for authentication</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/></param>
/// <remarks>This method should be used when using a CDP4-COMET WebServices and that it provides LocalJwtBearer authentication flow</remarks>
public Task Login(string userName, string password, CancellationToken cancellationToken)
{
throw new System.NotImplementedException();
}

/// <summary>
/// Applies Authentication information based on the <see cref="Dal.Credentials" />
/// </summary>
/// <param name="credentials"></param>
public void ApplyAuthenticationCredentials(Credentials credentials)
{
throw new System.NotImplementedException();
}
}
}
1 change: 1 addition & 0 deletions CDP4Dal/CDP4Dal.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
[BUMP] To CDP4DalCommon 27.4.2
</PackageReleaseNotes>
<PackageReadmeFile>README.md</PackageReadmeFile>
<LangVersion>latest</LangVersion>
</PropertyGroup>

<ItemGroup>
Expand Down
Loading
Loading