Skip to content

Commit

Permalink
PreAuthByUsernameAsync Exception (#5)
Browse files Browse the repository at this point in the history
Change IEnumerable<T> properties to ICollection<T> to resolve bug with Newtonsoft.Json on .NET 5.
  • Loading branch information
m33p authored Aug 23, 2021
1 parent 3f9b58b commit c087ac9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
7 changes: 3 additions & 4 deletions DuoSecurity.Auth.Http/JsonModels/DeviceModel.cs
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
using System.Collections.Generic;
using System.Linq;

namespace DuoSecurity.Auth.Http.JsonModels
{
internal class DeviceModel
{
private IEnumerable<string> _capabilities = Enumerable.Empty<string>();
private ICollection<string> _capabilities = new List<string>();

public IEnumerable<string> Capabilities
public ICollection<string> Capabilities
{
get => _capabilities;
set => _capabilities = value ?? Enumerable.Empty<string>();
set => _capabilities = value ?? new List<string>();
}

public string Device { get; set; }
Expand Down
7 changes: 3 additions & 4 deletions DuoSecurity.Auth.Http/JsonModels/PreAuthResultModel.cs
Original file line number Diff line number Diff line change
@@ -1,22 +1,21 @@
using DuoSecurity.Auth.Http.Abstraction;
using DuoSecurity.Auth.Http.Results;
using System.Collections.Generic;
using System.Linq;

namespace DuoSecurity.Auth.Http.JsonModels
{
internal class PreAuthResultModel : IJsonModel<PreAuthResult>
{
private IEnumerable<DeviceModel> _devices = Enumerable.Empty<DeviceModel>();
private ICollection<DeviceModel> _devices = new List<DeviceModel>();

public string Result { get; set; }

public string Status_Msg { get; set; }

public IEnumerable<DeviceModel> Devices
public ICollection<DeviceModel> Devices
{
get => _devices;
set => _devices = value ?? Enumerable.Empty<DeviceModel>();
set => _devices = value ?? new List<DeviceModel>();
}

public string Enroll_Portal_Url { get; set; }
Expand Down

0 comments on commit c087ac9

Please sign in to comment.