Skip to content

Commit 8c367a9

Browse files
committed
Update get token response to include auth info
1 parent 27ec801 commit 8c367a9

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

src/Nest/XPack/Security/User/GetUserAccessToken/GetUserAccessTokenResponse.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,8 @@ public class GetUserAccessTokenResponse : ResponseBase
1919

2020
[DataMember(Name ="type")]
2121
public string Type { get; set; }
22+
23+
[DataMember(Name = "authentication")]
24+
public AuthenticateResponse Authentication { get; set; }
2225
}
2326
}

tests/Tests/XPack/Security/User/GetUserAccessToken/GetUserAccessTokenApiTests.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
using Elasticsearch.Net;
88
using FluentAssertions;
99
using Nest;
10+
using Tests.Configuration;
11+
using Tests.Core.Extensions;
1012
using Tests.Framework.EndpointTests;
1113
using Tests.Framework.EndpointTests.TestState;
1214
using static Elastic.Elasticsearch.Ephemeral.ClusterAuthentication;
@@ -63,6 +65,13 @@ protected override void ExpectResponse(GetUserAccessTokenResponse response)
6365
response.Type.Should().NotBeNullOrEmpty().And.Be("Bearer");
6466
response.ExpiresIn.Should().BeGreaterThan(0);
6567
response.Scope.Should().Be("full");
68+
69+
if (TestConfiguration.Instance.InRange(">=7.11.0"))
70+
{
71+
response.Authentication.Should().NotBeNull();
72+
response.Authentication.Username.Should().NotBeNullOrEmpty();
73+
response.Authentication.Roles.Count.Should().BeGreaterThan(0);
74+
}
6675
}
6776
}
6877

0 commit comments

Comments
 (0)