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

Conversation

antoineatstariongroup
Copy link
Contributor

Prerequisites

  • I have written a descriptive pull-request title
  • I have verified that there are no overlapping pull-requests open
  • I have verified that I am following the COMET-SDK code style guidelines
  • I have provided test coverage for my change (where applicable)

Description

Fix #278

  • Provide all material at Session and CDP4ServicesDal level to support multiple authentication scheme (Basic and JWT based)
  • Stop support of WSP
  • Tests shows how we can easily authenticate and open a session depending on the authentication scheme
  • Fully compatible with old WebServices version (that only supports Basic Auth)

/// Retrieves all supported <see cref="AuthenticationSchemeKind" /> by the CDP4-COMET datasource
/// </summary>
/// <returns>An awaitable <see cref="Task{TResult}"/> that contains the value of the queried <see cref="AuthenticationSchemeResponse" /></returns>
public async Task<AuthenticationSchemeResponse> QueryAvailableAuthenticationScheme()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please add this method to the ISession interface

// To test this, please enable one by one authentication scheme on the CDP4 COMET Server
public async Task VerifyCanAuthenticateWithMultipleSchemeAtDalLevel()
{
var authentitcatioCredentials = new Credentials(new Uri("http://localhost:5000/"));

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose a small typo

/// <exception cref="InvalidOperationException">If all required <see cref="Credentials"/> informations are not provided</exception>
public async Task RefreshAuthenticationInformation()
{
if (this.Credentials.IsFullyInitiliazed)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo IsFullyInitiliazed => IsFullyInitialized

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was removing WSPDal on purpose?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, agreed with @samatstariongroup

@@ -881,6 +887,11 @@ public override async Task<IEnumerable<Thing>> Open(Credentials credentials, Can
throw new ArgumentNullException(nameof(credentials.Uri), $"The Credentials URI may not be null");
}

if (!credentials.IsFullyInitiliazed)
{
throw new ArgumentException("The Credentials is not be fully initiliazed");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same typo on initiliazed

Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
5.3% Coverage on New Code (required ≥ 70%)

See analysis details on SonarQube Cloud

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement support for JWT authentication
4 participants