This repository has been archived by the owner on Jul 31, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
return id_token on refresh token request (see #690)
- Loading branch information
1 parent
c28967e
commit 9c940d3
Showing
2 changed files
with
77 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
test/IdentityServer.IntegrationTests/Clients/RefreshTokenClient.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
// Copyright (c) Brock Allen & Dominick Baier. All rights reserved. | ||
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information. | ||
|
||
|
||
using FluentAssertions; | ||
using IdentityModel.Client; | ||
using Microsoft.AspNetCore.Hosting; | ||
using Microsoft.AspNetCore.TestHost; | ||
using System.Net.Http; | ||
using System.Threading.Tasks; | ||
using Xunit; | ||
|
||
namespace IdentityServer4.IntegrationTests.Clients | ||
{ | ||
public class RefreshTokenClient | ||
{ | ||
const string TokenEndpoint = "https://server/connect/token"; | ||
|
||
private readonly HttpClient _client; | ||
private readonly HttpMessageHandler _handler; | ||
|
||
public RefreshTokenClient() | ||
{ | ||
var builder = new WebHostBuilder() | ||
.UseStartup<Startup>(); | ||
var server = new TestServer(builder); | ||
|
||
_handler = server.CreateHandler(); | ||
_client = server.CreateClient(); | ||
} | ||
|
||
[Fact] | ||
public async Task requesting_a_refresh_token_should_return_expected_results() | ||
{ | ||
var client = new TokenClient( | ||
TokenEndpoint, | ||
"roclient", | ||
"secret", | ||
innerHttpMessageHandler: _handler); | ||
|
||
var response = await client.RequestResourceOwnerPasswordAsync("bob", "bob", "api1 offline_access"); | ||
|
||
response.IsError.Should().BeFalse(); | ||
response.ExpiresIn.Should().Be(3600); | ||
response.TokenType.Should().Be("Bearer"); | ||
response.IdentityToken.Should().BeNull(); | ||
response.RefreshToken.Should().NotBeNull(); | ||
|
||
response = await client.RequestRefreshTokenAsync(response.RefreshToken); | ||
|
||
response.IsError.Should().BeFalse(); | ||
response.ExpiresIn.Should().Be(3600); | ||
response.TokenType.Should().Be("Bearer"); | ||
response.IdentityToken.Should().NotBeNull(); | ||
response.RefreshToken.Should().NotBeNull(); | ||
} | ||
} | ||
} |