File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed
test/AspNet.Security.OAuth.Providers.Tests Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change 23
23
using Microsoft . AspNetCore . Mvc . Testing ;
24
24
using Microsoft . Extensions . DependencyInjection ;
25
25
using Shouldly ;
26
+ using Xunit ;
26
27
using Xunit . Abstractions ;
27
28
28
29
namespace AspNet . Security . OAuth
@@ -133,6 +134,38 @@ protected HttpClient CreateBackchannel(AuthenticationBuilder builder)
133
134
134
135
public LoopbackRedirectHandler LoopbackRedirectHandler { get ; set ; }
135
136
137
+ [ Fact ]
138
+ public async Task OnCreatingTicket_Is_Raised_By_Handler ( )
139
+ {
140
+ // Arrange
141
+ bool onCreatingTicketEventRaised = false ;
142
+
143
+ void ConfigureServices ( IServiceCollection services )
144
+ {
145
+ services . PostConfigureAll < TOptions > ( ( options ) =>
146
+ {
147
+ options . Events . OnCreatingTicket = ( context ) =>
148
+ {
149
+ onCreatingTicketEventRaised = true ;
150
+ return Task . CompletedTask ;
151
+ } ;
152
+
153
+ if ( options is Apple . AppleAuthenticationOptions appleOptions )
154
+ {
155
+ appleOptions . ValidateTokens = false ; // Apple test token has expired
156
+ }
157
+ } ) ;
158
+ }
159
+
160
+ using var server = CreateTestServer ( ConfigureServices ) ;
161
+
162
+ // Act
163
+ var claims = await AuthenticateUserAsync ( server ) ;
164
+
165
+ // Assert
166
+ onCreatingTicketEventRaised . ShouldBeTrue ( ) ;
167
+ }
168
+
136
169
/// <summary>
137
170
/// Run the ChannelAsync for authentication
138
171
/// </summary>
You can’t perform that action at this time.
0 commit comments