1- using IdentityModel ;
1+ using System ;
2+ using System . Linq ;
3+ using System . Security . Claims ;
4+ using System . Text . Encodings . Web ;
5+ using System . Threading . Tasks ;
6+ using IdentityModel ;
27using IdentityServer4 ;
38using IdentityServer4 . Models ;
49using IdentityServer4 . Services ;
1116using Microsoft . eShopOnContainers . Services . Identity . API . Models . AccountViewModels ;
1217using Microsoft . eShopOnContainers . Services . Identity . API . Services ;
1318using Microsoft . Extensions . Logging ;
14- using System ;
15- using System . Linq ;
16- using System . Security . Claims ;
17- using System . Text . Encodings . Web ;
18- using System . Threading . Tasks ;
1919
2020namespace Microsoft . eShopOnContainers . Services . Identity . API . Controllers
2121{
@@ -92,7 +92,7 @@ public async Task<IActionResult> Login(LoginViewModel model)
9292 } ;
9393
9494 await _loginService . SignIn ( user ) ;
95-
95+
9696 // make sure the returnUrl is still valid, and if yes - redirect back to authorize endpoint
9797 if ( _interaction . IsValidReturnUrl ( model . ReturnUrl ) )
9898 {
@@ -113,7 +113,7 @@ public async Task<IActionResult> Login(LoginViewModel model)
113113 return View ( vm ) ;
114114 }
115115
116- async Task < LoginViewModel > BuildLoginViewModelAsync ( string returnUrl , AuthorizationRequest context )
116+ private async Task < LoginViewModel > BuildLoginViewModelAsync ( string returnUrl , AuthorizationRequest context )
117117 {
118118 var allowLocal = true ;
119119 if ( context ? . ClientId != null )
@@ -132,7 +132,7 @@ async Task<LoginViewModel> BuildLoginViewModelAsync(string returnUrl, Authorizat
132132 } ;
133133 }
134134
135- async Task < LoginViewModel > BuildLoginViewModelAsync ( LoginViewModel model )
135+ private async Task < LoginViewModel > BuildLoginViewModelAsync ( LoginViewModel model )
136136 {
137137 var context = await _interaction . GetAuthorizationContextAsync ( model . ReturnUrl ) ;
138138 var vm = await BuildLoginViewModelAsync ( model . ReturnUrl , context ) ;
@@ -193,7 +193,7 @@ public async Task<IActionResult> Logout(LogoutViewModel model)
193193
194194 try
195195 {
196-
196+
197197 // hack: try/catch to handle social providers that throw
198198 await HttpContext . SignOutAsync ( idp , new AuthenticationProperties
199199 {
@@ -209,6 +209,8 @@ public async Task<IActionResult> Logout(LogoutViewModel model)
209209 // delete authentication cookie
210210 await HttpContext . SignOutAsync ( ) ;
211211
212+ await HttpContext . SignOutAsync ( IdentityConstants . ApplicationScheme ) ;
213+
212214 // set this so UI rendering sees an anonymous user
213215 HttpContext . User = new ClaimsPrincipal ( new ClaimsIdentity ( ) ) ;
214216
0 commit comments