Skip to content

Commit

Permalink
Merge pull request #40 from digirati-co-uk/feature/access_token_error
Browse files Browse the repository at this point in the history
Add missing AuthAccessTokenError2.MessageId field
  • Loading branch information
donaldgray committed Jul 31, 2023
2 parents 75d5a95 + d7e9796 commit 4250624
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/IIIF/IIIF.Tests/Auth/V2/TokenServiceTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,19 @@ public void Token_Service_Error_Response()
// Arrange
var tokenResp = new AuthAccessTokenError2(
AuthAccessTokenError2.InvalidAspect,
new LanguageMap("en", "Your credentials are wrong"));
new LanguageMap("en", "Your credentials are wrong"))
{
MessageId = "1010"
};

// Act
var json = tokenResp.AsJson().Replace("\r\n", "\n");
var expected = @"{
""@context"": ""http://iiif.io/api/auth/2/context.json"",
""type"": ""AuthAccessTokenError2"",
""profile"": ""invalidAspect"",
""note"": {""en"":[""Your credentials are wrong""]}
""note"": {""en"":[""Your credentials are wrong""]},
""messageId"": ""1010""
}";
// Assert
json.Should().BeEquivalentTo(expected);
Expand Down
6 changes: 6 additions & 0 deletions src/IIIF/IIIF/Auth/V2/AuthAccessTokenError2.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@ public class AuthAccessTokenError2 : ResourceBase, IService

[JsonProperty(Order = 102, PropertyName = "note")]
public LanguageMap? Note { get; set; }

/// <summary>
/// The message identifier supplied by the client.
/// </summary>
[JsonProperty(Order = 103, PropertyName = "messageId")]
public string MessageId { get; set; }

public AuthAccessTokenError2(string profile, LanguageMap? note = null)

Check warning on line 53 in src/IIIF/IIIF/Auth/V2/AuthAccessTokenError2.cs

View workflow job for this annotation

GitHub Actions / build-push-nuget

Non-nullable property 'MessageId' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.

Check warning on line 53 in src/IIIF/IIIF/Auth/V2/AuthAccessTokenError2.cs

View workflow job for this annotation

GitHub Actions / build-push-nuget

Non-nullable property 'MessageId' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.
{
Expand Down

0 comments on commit 4250624

Please sign in to comment.