本文整理汇总了C#中AuthenticationSchemes类的典型用法代码示例。如果您正苦于以下问题:C# AuthenticationSchemes类的具体用法?C# AuthenticationSchemes怎么用?C# AuthenticationSchemes使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AuthenticationSchemes类属于命名空间,在下文中一共展示了AuthenticationSchemes类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: DoesAuthTypeMatch
public static bool DoesAuthTypeMatch(AuthenticationSchemes authScheme, string authType)
{
if ((authType == null) || (authType.Length == 0))
{
return authScheme.IsSet(AuthenticationSchemes.Anonymous);
}
if (authType.Equals("kerberos", StringComparison.OrdinalIgnoreCase) ||
authType.Equals("negotiate", StringComparison.OrdinalIgnoreCase))
{
return authScheme.IsSet(AuthenticationSchemes.Negotiate);
}
else if (authType.Equals("ntlm", StringComparison.OrdinalIgnoreCase))
{
return authScheme.IsSet(AuthenticationSchemes.Negotiate) ||
authScheme.IsSet(AuthenticationSchemes.Ntlm);
}
AuthenticationSchemes authTypeScheme;
if (!Enum.TryParse<AuthenticationSchemes>(authType, true, out authTypeScheme))
{
return false;
}
return authScheme.IsSet(authTypeScheme);
}
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:26,代码来源:AuthenticationSchemesHelper.cs
示例2: MapToClientCredentialType
internal static HttpClientCredentialType MapToClientCredentialType(AuthenticationSchemes authenticationSchemes)
{
HttpClientCredentialType result;
switch (authenticationSchemes)
{
case AuthenticationSchemes.Anonymous:
result = HttpClientCredentialType.None;
break;
case AuthenticationSchemes.Basic:
result = HttpClientCredentialType.Basic;
break;
case AuthenticationSchemes.Digest:
result = HttpClientCredentialType.Digest;
break;
case AuthenticationSchemes.Ntlm:
result = HttpClientCredentialType.Ntlm;
break;
case AuthenticationSchemes.Negotiate:
result = HttpClientCredentialType.Windows;
break;
default:
Fx.Assert("unsupported client AuthenticationScheme");
throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new NotSupportedException());
}
return result;
}
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:26,代码来源:HttpClientCredentialType.cs
示例3: HttpListener
public HttpListener(ILogger logger)
{
_logger = logger;
prefixes = new HttpListenerPrefixCollection(logger, this);
registry = new Hashtable();
connections = Hashtable.Synchronized(new Hashtable());
auth_schemes = AuthenticationSchemes.Anonymous;
}
开发者ID:WJ-GitHub,项目名称:SocketHttpListener,代码行数:8,代码来源:HttpListener.cs
示例4: ServiceAuthenticationBehavior
ServiceAuthenticationBehavior(ServiceAuthenticationBehavior other)
{
this.serviceAuthenticationManager = other.ServiceAuthenticationManager;
this.authenticationSchemes = other.authenticationSchemes;
this.isReadOnly = other.isReadOnly;
this.isAuthenticationManagerSet = other.isAuthenticationManagerSet;
this.isAuthenticationSchemesSet = other.isAuthenticationSchemesSet;
}
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:8,代码来源:ServiceAuthenticationBehavior.cs
示例5: CreateAndStartListener
public static HttpListener CreateAndStartListener (string prefix, AuthenticationSchemes authSchemes)
{
HttpListener listener = new HttpListener ();
listener.AuthenticationSchemes = authSchemes;
listener.Prefixes.Add (prefix);
listener.Start ();
return listener;
}
开发者ID:frje,项目名称:SharpLang,代码行数:8,代码来源:HttpListener2Test.cs
示例6: IsWindowsAuth
public static bool IsWindowsAuth(AuthenticationSchemes authScheme)
{
if (authScheme != AuthenticationSchemes.Negotiate)
{
return (authScheme == AuthenticationSchemes.Ntlm);
}
return true;
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:8,代码来源:AuthenticationSchemesHelper.cs
示例7: HttpListener
ArrayList wait_queue; // List<ListenerAsyncResult> wait_queue;
public HttpListener ()
{
prefixes = new HttpListenerPrefixCollection (this);
registry = new Hashtable ();
ctx_queue = new ArrayList ();
wait_queue = new ArrayList ();
auth_schemes = AuthenticationSchemes.Anonymous;
}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:10,代码来源:HttpListener.cs
示例8: HttpListener
/// <summary>
/// Initializes a new instance of the <see cref="HttpListener"/> class.
/// </summary>
public HttpListener ()
{
_authSchemes = AuthenticationSchemes.Anonymous;
_connections = new Dictionary<HttpConnection, HttpConnection> ();
_contextQueue = new List<HttpListenerContext> ();
_prefixes = new HttpListenerPrefixCollection (this);
_registry = new Dictionary<HttpListenerContext, HttpListenerContext> ();
_waitQueue = new List<ListenerAsyncResult> ();
}
开发者ID:songotony,项目名称:RType-Client,代码行数:12,代码来源:HttpListener.cs
示例9: HttpListenerContext
internal HttpListenerContext(HttpListener httpListener, RequestContextBase memoryBlob)
{
if (Logging.On) Logging.PrintInfo(Logging.HttpListener, this, ".ctor", "httpListener#" + ValidationHelper.HashString(httpListener) + " requestBlob=" + ValidationHelper.HashString((IntPtr) memoryBlob.RequestBlob));
m_Listener = httpListener;
m_Request = new HttpListenerRequest(this, memoryBlob);
m_AuthenticationSchemes = httpListener.AuthenticationSchemes;
m_ExtendedProtectionPolicy = httpListener.ExtendedProtectionPolicy;
GlobalLog.Print("HttpListenerContext#" + ValidationHelper.HashString(this) + "::.ctor() HttpListener#" + ValidationHelper.HashString(m_Listener) + " HttpListenerRequest#" + ValidationHelper.HashString(m_Request));
}
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:9,代码来源:HttpListenerContext.cs
示例10: HttpListener
/// <summary>
/// Initializes a new instance of the <see cref="HttpListener"/> class.
/// </summary>
public HttpListener()
{
prefixes = new HttpListenerPrefixCollection (this);
registry = new Dictionary<HttpListenerContext, HttpListenerContext> ();
connections = new Dictionary<HttpConnection, HttpConnection> ();
ctx_queue = new List<HttpListenerContext> ();
wait_queue = new List<ListenerAsyncResult> ();
auth_schemes = AuthenticationSchemes.Anonymous;
}
开发者ID:kallex,项目名称:websocket-sharp,代码行数:12,代码来源:HttpListener.cs
示例11: AuthenticationChallenge
internal AuthenticationChallenge(AuthenticationSchemes scheme, string realm)
: base(scheme, new NameValueCollection ())
{
Parameters["realm"] = realm;
if (scheme == AuthenticationSchemes.Digest) {
Parameters["nonce"] = CreateNonceValue ();
Parameters["algorithm"] = "MD5";
Parameters["qop"] = "auth";
}
}
开发者ID:pedro-ramirez-suarez,项目名称:DiPS,代码行数:10,代码来源:AuthenticationChallenge.cs
示例12: Create
public static WebhookServer Create(string url, Action<HttpListenerContext> handler, AuthenticationSchemes authenticationSchemes = AuthenticationSchemes.Anonymous)
{
var listener = new HttpListener
{
Prefixes = { url },
AuthenticationSchemes = authenticationSchemes
};
var server = new WebhookServer(listener, handler);
server.Start();
return server;
}
开发者ID:Sire,项目名称:neteller-rest-api,代码行数:11,代码来源:WebhookServer.cs
示例13: HttpListener
public HttpListener ()
{
prefixes = new HttpListenerPrefixCollection (this);
registry = new Hashtable ();
connections = Hashtable.Synchronized (new Hashtable ());
ctx_queue = new ArrayList ();
wait_queue = new ArrayList ();
auth_schemes = AuthenticationSchemes.Anonymous;
defaultServiceNames = new ServiceNameStore ();
extendedProtectionPolicy = new ExtendedProtectionPolicy (PolicyEnforcement.Never);
}
开发者ID:ItsVeryWindy,项目名称:mono,代码行数:11,代码来源:HttpListener.cs
示例14: RtspSource
public RtspSource(string name, string sourceLocation, NetworkCredential credential = null, AuthenticationSchemes authType = AuthenticationSchemes.None, Rtsp.RtspClient.ClientProtocolType? rtpProtocolType = null, int bufferSize = RtspClient.DefaultBufferSize, Sdp.MediaType? specificMedia = null, TimeSpan? startTime = null, TimeSpan? endTime = null)
: this(name, new Uri(sourceLocation), credential, authType, rtpProtocolType, bufferSize, specificMedia, startTime, endTime)
{
//Check for a null Credential and UserInfo in the Location given.
if (credential == null && !string.IsNullOrWhiteSpace(m_Source.UserInfo))
{
RtspClient.Credential = Media.Common.Extensions.Uri.UriExtensions.ParseUserInfo(m_Source);
//Remove the user info from the location
RtspClient.CurrentLocation = new Uri(RtspClient.CurrentLocation.AbsoluteUri.Replace(RtspClient.CurrentLocation.UserInfo + (char)Common.ASCII.AtSign, string.Empty).Replace(RtspClient.CurrentLocation.UserInfo, string.Empty));
}
}
开发者ID:qinpengit,项目名称:net7mma-111212,代码行数:12,代码来源:RtspSource.cs
示例15: TryExtract
public static bool TryExtract(BindingParameterCollection collection, out AuthenticationSchemes authenticationSchemes)
{
Fx.Assert(collection != null, "collection != null");
authenticationSchemes = AuthenticationSchemes.None;
AuthenticationSchemesBindingParameter instance = collection.Find<AuthenticationSchemesBindingParameter>();
if (instance != null)
{
authenticationSchemes = instance.AuthenticationSchemes;
return true;
}
return false;
}
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:12,代码来源:AuthenticationSchemesBindingParameter.cs
示例16: DoesAuthTypeMatch
public static bool DoesAuthTypeMatch(AuthenticationSchemes authScheme, string authType)
{
if ((authType == null) || (authType.Length == 0))
{
return (authScheme == AuthenticationSchemes.Anonymous);
}
if (authScheme == AuthenticationSchemes.Negotiate)
{
return ((authType.Equals("ntlm", StringComparison.OrdinalIgnoreCase) || authType.Equals("kerberos", StringComparison.OrdinalIgnoreCase)) || authType.Equals("negotiate", StringComparison.OrdinalIgnoreCase));
}
return authScheme.ToString().Equals(authType, StringComparison.OrdinalIgnoreCase);
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:12,代码来源:AuthenticationSchemesHelper.cs
示例17: IsSingleton
public static bool IsSingleton(AuthenticationSchemes v)
{
switch (v)
{
case AuthenticationSchemes.Digest:
case AuthenticationSchemes.Negotiate:
case AuthenticationSchemes.Ntlm:
case AuthenticationSchemes.Basic:
case AuthenticationSchemes.Anonymous:
return true;
}
return false;
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:13,代码来源:AuthenticationSchemesHelper.cs
示例18: AuthenticationResponse
internal AuthenticationResponse (
AuthenticationSchemes scheme,
NameValueCollection parameters,
NetworkCredential credentials,
uint nonceCount)
: base (scheme, parameters)
{
Parameters["username"] = credentials.UserName;
Parameters["password"] = credentials.Password;
Parameters["uri"] = credentials.Domain;
_nonceCount = nonceCount;
if (scheme == AuthenticationSchemes.Digest)
initAsDigest ();
}
开发者ID:JChan106,项目名称:HACKPOLY16,代码行数:14,代码来源:AuthenticationResponse.cs
示例19: GetCredentialAsync
public static Task<NetworkCredential> GetCredentialAsync(AuthenticationSchemes authenticationScheme, SecurityTokenProviderContainer credentialProvider,
OutWrapper<TokenImpersonationLevel> impersonationLevelWrapper, OutWrapper<AuthenticationLevel> authenticationLevelWrapper,
CancellationToken cancellationToken)
{
impersonationLevelWrapper.Value = TokenImpersonationLevel.None;
authenticationLevelWrapper.Value = AuthenticationLevel.None;
if (authenticationScheme == AuthenticationSchemes.Anonymous)
{
return Task.FromResult((NetworkCredential)null);
}
return GetCredentialCoreAsync(authenticationScheme, credentialProvider, impersonationLevelWrapper,
authenticationLevelWrapper, cancellationToken);
}
开发者ID:roncain,项目名称:wcf,代码行数:15,代码来源:HttpChannelHelpers.cs
示例20: ParseAuthentication
internal void ParseAuthentication (AuthenticationSchemes expectedSchemes) {
if (expectedSchemes == AuthenticationSchemes.Anonymous)
return;
// TODO: Handle NTLM/Digest modes
string header = request.Headers ["Authorization"];
if (header == null || header.Length < 2)
return;
string [] authenticationData = header.Split (new char [] {' '}, 2);
if (string.Compare (authenticationData [0], "basic", true) == 0) {
user = ParseBasicAuthentication (authenticationData [1]);
}
// TODO: throw if malformed -> 400 bad request
}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:15,代码来源:HttpListenerContext.cs
注:本文中的AuthenticationSchemes类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论