-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #580 from akunzai/owin-logout
Support CAS logout for OWIN
- Loading branch information
Showing
16 changed files
with
299 additions
and
211 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
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
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 |
---|---|---|
@@ -1,12 +1,23 @@ | ||
using Microsoft.AspNetCore.Mvc; | ||
using Microsoft.AspNetCore.Authentication; | ||
using Microsoft.AspNetCore.Mvc.RazorPages; | ||
|
||
namespace AspNetCoreSample.Pages.Account; | ||
|
||
public class LogoutModel : PageModel | ||
{ | ||
public IActionResult OnGet() | ||
public async Task OnGet(string? redirectUrl) | ||
{ | ||
return SignOut(); | ||
if (string.IsNullOrWhiteSpace(redirectUrl)) | ||
{ | ||
redirectUrl = "/"; | ||
} | ||
|
||
var properties = new AuthenticationProperties { RedirectUri = redirectUrl }; | ||
await HttpContext.SignOutAsync(properties); | ||
var authScheme = User.Claims.FirstOrDefault(x => string.Equals(x.Type, "auth_scheme"))?.Value; | ||
if (!string.IsNullOrWhiteSpace(authScheme)) | ||
{ | ||
await HttpContext.SignOutAsync(authScheme, properties); | ||
} | ||
} | ||
} |
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
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 |
---|---|---|
@@ -1,12 +1,23 @@ | ||
using Microsoft.AspNetCore.Mvc; | ||
using Microsoft.AspNetCore.Authentication; | ||
using Microsoft.AspNetCore.Mvc.RazorPages; | ||
|
||
namespace BlazorSample.Pages.Account; | ||
|
||
public class Logout : PageModel | ||
{ | ||
public IActionResult OnGet() | ||
public async Task OnGet(string? redirectUrl) | ||
{ | ||
return SignOut(); | ||
if (string.IsNullOrWhiteSpace(redirectUrl)) | ||
{ | ||
redirectUrl = "/"; | ||
} | ||
|
||
var properties = new AuthenticationProperties { RedirectUri = redirectUrl }; | ||
await HttpContext.SignOutAsync(properties); | ||
var authScheme = User.Claims.FirstOrDefault(x => string.Equals(x.Type, "auth_scheme"))?.Value; | ||
if (!string.IsNullOrWhiteSpace(authScheme)) | ||
{ | ||
await HttpContext.SignOutAsync(authScheme, properties); | ||
} | ||
} | ||
} |
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
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
Oops, something went wrong.