This commit is contained in:
parent
46f5c107b8
commit
fa34ed249b
233 changed files with 4000 additions and 1396 deletions
|
|
@ -1,29 +0,0 @@
|
|||
using System;
|
||||
using System.Linq;
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.AspNet.Http;
|
||||
using Microsoft.AspNet.Http.Authentication;
|
||||
|
||||
namespace Yavsc.Extensions {
|
||||
public static class HttpContextExtensions {
|
||||
public static IEnumerable<AuthenticationDescription> GetExternalProviders(this HttpContext context) {
|
||||
if (context == null) {
|
||||
throw new ArgumentNullException(nameof(context));
|
||||
}
|
||||
|
||||
return from description in context.Authentication.GetAuthenticationSchemes()
|
||||
where !string.IsNullOrEmpty(description.DisplayName)
|
||||
select description;
|
||||
}
|
||||
|
||||
public static bool IsProviderSupported(this HttpContext context, string provider) {
|
||||
if (context == null) {
|
||||
throw new ArgumentNullException(nameof(context));
|
||||
}
|
||||
|
||||
return (from description in context.GetExternalProviders()
|
||||
where string.Equals(description.AuthenticationScheme, provider, StringComparison.OrdinalIgnoreCase)
|
||||
select description).Any();
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue