Browse Source

Update the MongoDB stores to use ImmutableList instead of ImmutableArray

pull/1126/head
Kévin Chalet 5 years ago
parent
commit
725265e04e
  1. 9
      samples/Mvc.Server/Worker.cs
  2. 8
      src/OpenIddict.MongoDb.Models/OpenIddictMongoDbApplication.cs
  3. 2
      src/OpenIddict.MongoDb.Models/OpenIddictMongoDbAuthorization.cs
  4. 2
      src/OpenIddict.MongoDb.Models/OpenIddictMongoDbScope.cs
  5. 16
      src/OpenIddict.MongoDb/Stores/OpenIddictMongoDbApplicationStore.cs
  6. 4
      src/OpenIddict.MongoDb/Stores/OpenIddictMongoDbAuthorizationStore.cs
  7. 4
      src/OpenIddict.MongoDb/Stores/OpenIddictMongoDbScopeStore.cs

9
samples/Mvc.Server/Worker.cs

@ -1,4 +1,5 @@
using System;
using System.Globalization;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.DependencyInjection;
@ -38,6 +39,10 @@ namespace Mvc.Server
ClientSecret = "901564A5-E7FE-42CB-B10D-61EF6A8F3654",
ConsentType = ConsentTypes.Explicit,
DisplayName = "MVC client application",
DisplayNames =
{
[CultureInfo.GetCultureInfo("fr-FR")] = "Application cliente MVC"
},
PostLogoutRedirectUris =
{
new Uri("http://localhost:53507/signout-callback-oidc")
@ -111,6 +116,10 @@ namespace Mvc.Server
await manager.CreateAsync(new OpenIddictScopeDescriptor
{
DisplayName = "Demo API access",
DisplayNames =
{
[CultureInfo.GetCultureInfo("fr-FR")] = "Accès à l'API de démo"
},
Name = "demo_api",
Resources =
{

8
src/OpenIddict.MongoDb.Models/OpenIddictMongoDbApplication.cs

@ -69,13 +69,13 @@ namespace OpenIddict.MongoDb.Models
/// Gets or sets the permissions associated with the current application.
/// </summary>
[BsonElement("permissions"), BsonIgnoreIfDefault]
public virtual IReadOnlyList<string> Permissions { get; set; } = ImmutableArray.Create<string>();
public virtual IReadOnlyList<string> Permissions { get; set; } = ImmutableList.Create<string>();
/// <summary>
/// Gets or sets the logout callback URLs associated with the current application.
/// </summary>
[BsonElement("post_logout_redirect_uris"), BsonIgnoreIfDefault]
public virtual IReadOnlyList<string> PostLogoutRedirectUris { get; set; } = ImmutableArray.Create<string>();
public virtual IReadOnlyList<string> PostLogoutRedirectUris { get; set; } = ImmutableList.Create<string>();
/// <summary>
/// Gets or sets the additional properties associated with the current application.
@ -87,13 +87,13 @@ namespace OpenIddict.MongoDb.Models
/// Gets or sets the callback URLs associated with the current application.
/// </summary>
[BsonElement("redirect_uris"), BsonIgnoreIfDefault]
public virtual IReadOnlyList<string> RedirectUris { get; set; } = ImmutableArray.Create<string>();
public virtual IReadOnlyList<string> RedirectUris { get; set; } = ImmutableList.Create<string>();
/// <summary>
/// Gets or sets the requirements associated with the current application.
/// </summary>
[BsonElement("requirements"), BsonIgnoreIfDefault]
public virtual IReadOnlyList<string> Requirements { get; set; } = ImmutableArray.Create<string>();
public virtual IReadOnlyList<string> Requirements { get; set; } = ImmutableList.Create<string>();
/// <summary>
/// Gets or sets the application type

2
src/OpenIddict.MongoDb.Models/OpenIddictMongoDbAuthorization.cs

@ -52,7 +52,7 @@ namespace OpenIddict.MongoDb.Models
/// Gets or sets the scopes associated with the current authorization.
/// </summary>
[BsonElement("scopes"), BsonIgnoreIfDefault]
public virtual IReadOnlyList<string> Scopes { get; set; } = ImmutableArray.Create<string>();
public virtual IReadOnlyList<string> Scopes { get; set; } = ImmutableList.Create<string>();
/// <summary>
/// Gets or sets the status of the current authorization.

2
src/OpenIddict.MongoDb.Models/OpenIddictMongoDbScope.cs

@ -74,6 +74,6 @@ namespace OpenIddict.MongoDb.Models
/// Gets or sets the resources associated with the current scope.
/// </summary>
[BsonElement("resources"), BsonIgnoreIfDefault]
public virtual IReadOnlyList<string> Resources { get; set; } = ImmutableArray.Create<string>();
public virtual IReadOnlyList<string> Resources { get; set; } = ImmutableList.Create<string>();
}
}

16
src/OpenIddict.MongoDb/Stores/OpenIddictMongoDbApplicationStore.cs

@ -540,12 +540,12 @@ namespace OpenIddict.MongoDb
if (permissions.IsDefaultOrEmpty)
{
application.Permissions = ImmutableArray.Create<string>();
application.Permissions = ImmutableList.Create<string>();
return default;
}
application.Permissions = permissions;
application.Permissions = permissions.ToImmutableList();
return default;
}
@ -561,12 +561,12 @@ namespace OpenIddict.MongoDb
if (addresses.IsDefaultOrEmpty)
{
application.PostLogoutRedirectUris = ImmutableArray.Create<string>();
application.PostLogoutRedirectUris = ImmutableList.Create<string>();
return default;
}
application.PostLogoutRedirectUris = addresses;
application.PostLogoutRedirectUris = addresses.ToImmutableList();
return default;
}
@ -621,12 +621,12 @@ namespace OpenIddict.MongoDb
if (addresses.IsDefaultOrEmpty)
{
application.RedirectUris = ImmutableArray.Create<string>();
application.RedirectUris = ImmutableList.Create<string>();
return default;
}
application.RedirectUris = addresses;
application.RedirectUris = addresses.ToImmutableList();
return default;
}
@ -642,12 +642,12 @@ namespace OpenIddict.MongoDb
if (requirements.IsDefaultOrEmpty)
{
application.Requirements = ImmutableArray.Create<string>();
application.Requirements = ImmutableList.Create<string>();
return default;
}
application.Requirements = requirements;
application.Requirements = requirements.ToImmutableList();
return default;
}

4
src/OpenIddict.MongoDb/Stores/OpenIddictMongoDbAuthorizationStore.cs

@ -664,12 +664,12 @@ namespace OpenIddict.MongoDb
if (scopes.IsDefaultOrEmpty)
{
authorization.Scopes = ImmutableArray.Create<string>();
authorization.Scopes = ImmutableList.Create<string>();
return default;
}
authorization.Scopes = scopes;
authorization.Scopes = scopes.ToImmutableList();
return default;
}

4
src/OpenIddict.MongoDb/Stores/OpenIddictMongoDbScopeStore.cs

@ -494,12 +494,12 @@ namespace OpenIddict.MongoDb
if (resources.IsDefaultOrEmpty)
{
scope.Resources = ImmutableArray.Create<string>();
scope.Resources = ImmutableList.Create<string>();
return default;
}
scope.Resources = resources;
scope.Resources = resources.ToImmutableList();
return default;
}

Loading…
Cancel
Save