本文整理汇总了C#中Services.Authenticate方法的典型用法代码示例。如果您正苦于以下问题:C# Services.Authenticate方法的具体用法?C# Services.Authenticate怎么用?C# Services.Authenticate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Services
的用法示例。
在下文中一共展示了Services.Authenticate方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ValidateLegacyCallsignUsage
public static CheckAliasResult ValidateLegacyCallsignUsage(string callsign, string legacyPassword)
{
if (Settings.Default.UseAsgsForLegacyCallsignCheck == false)
return CheckAliasResult.Available;
Services services = new Services();
services.Url = Settings.Default.AsgsServiceURL;
string playerRankString = services.GetPlayerRank(callsign);
Regex rankFinder = new Regex(
"(?<isInvalid>\\d+)\\|(?<rank>\\d+)\\|.*?",
RegexOptions.Multiline
| RegexOptions.Singleline
| RegexOptions.ExplicitCapture
| RegexOptions.CultureInvariant
| RegexOptions.Compiled
);
Match rankMatch = rankFinder.Match(playerRankString);
if (rankMatch.Success == false || Int32.Parse(rankMatch.Groups["rank"].Value) < 0 || Int32.Parse(rankMatch.Groups["isInvalid"].Value) > 0)
return CheckAliasResult.Available;
if(String.IsNullOrEmpty(legacyPassword) == true)
return CheckAliasResult.LegacyExists;
string asgsEncryptedPassword = ASGS.Encryption.EncryptAsgsPassword(legacyPassword, callsign);
int authenticationStatus = services.Authenticate(callsign, asgsEncryptedPassword);
if (authenticationStatus != 0)
return CheckAliasResult.InvalidLegacyPassword;
return CheckAliasResult.Available;
}