mirror of https://github.com/icedream/npsharp.git
				
				
				
			NPv2 auth support bits
							parent
							
								
									7f9cc54c54
								
							
						
					
					
						commit
						58a5e8049d
					
				|  | @ -187,9 +187,9 @@ namespace NPSharp.NP | |||
|         ///     Authenticates a server ticket. | ||||
|         /// </summary> | ||||
|         /// <returns>True if the ticket validation succeeded, otherwise false.</returns> | ||||
|         public async Task<bool> ValidateTicket(IPAddress clientIP, ulong guid, Ticket ticket) | ||||
|         public async Task<TicketValidationResult> ValidateTicket(IPAddress clientIP, ulong guid, Ticket ticket) | ||||
|         { | ||||
|             var tcs = new TaskCompletionSource<bool>(); | ||||
|             var tcs = new TaskCompletionSource<TicketValidationResult>(); | ||||
| 
 | ||||
|             RPC.AttachHandlerForNextMessage(packet => | ||||
|             { | ||||
|  | @ -197,7 +197,7 @@ namespace NPSharp.NP | |||
|                 if (result == null) | ||||
|                     return; | ||||
| 
 | ||||
|                 tcs.SetResult(result.Result == 0); | ||||
|                 tcs.SetResult(new TicketValidationResult(result)); | ||||
|             }); | ||||
| 
 | ||||
|             RPC.Send(new AuthenticateValidateTicketMessage | ||||
|  |  | |||
|  | @ -1,127 +1,130 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||||
|   <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> | ||||
|   <PropertyGroup> | ||||
|     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||||
|     <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||||
|     <ProjectGuid>{C6F941A5-82AF-456A-9B3A-752E5B001035}</ProjectGuid> | ||||
|     <OutputType>Library</OutputType> | ||||
|     <AppDesignerFolder>Properties</AppDesignerFolder> | ||||
|     <RootNamespace>NPSharp</RootNamespace> | ||||
|     <AssemblyName>npsharp_client</AssemblyName> | ||||
|     <TargetFrameworkVersion>v4.5</TargetFrameworkVersion> | ||||
|     <FileAlignment>512</FileAlignment> | ||||
|     <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> | ||||
|     <RestorePackages>true</RestorePackages> | ||||
|   </PropertyGroup> | ||||
|   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||||
|     <DebugSymbols>true</DebugSymbols> | ||||
|     <DebugType>full</DebugType> | ||||
|     <Optimize>false</Optimize> | ||||
|     <OutputPath>bin\Debug\</OutputPath> | ||||
|     <DefineConstants>TRACE;DEBUG;COMPILE_RPC,COMPILE_NP,COMPILE_AUTH</DefineConstants> | ||||
|     <ErrorReport>prompt</ErrorReport> | ||||
|     <WarningLevel>4</WarningLevel> | ||||
|   </PropertyGroup> | ||||
|   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | ||||
|     <DebugType>pdbonly</DebugType> | ||||
|     <Optimize>true</Optimize> | ||||
|     <OutputPath>bin\Release\</OutputPath> | ||||
|     <DefineConstants>TRACE;COMPILE_RPC,COMPILE_NP,COMPILE_AUTH</DefineConstants> | ||||
|     <ErrorReport>prompt</ErrorReport> | ||||
|     <WarningLevel>4</WarningLevel> | ||||
|   </PropertyGroup> | ||||
|   <ItemGroup> | ||||
|     <Reference Include="log4net"> | ||||
|       <HintPath>$(SolutionDir)\packages\log4net.2.0.3\lib\net40-full\log4net.dll</HintPath> | ||||
|     </Reference> | ||||
|     <Reference Include="protobuf-net"> | ||||
|       <HintPath>$(SolutionDir)\packages\protobuf-net.2.0.0.668\lib\net40\protobuf-net.dll</HintPath> | ||||
|     </Reference> | ||||
|     <Reference Include="System" /> | ||||
|     <Reference Include="System.Core" /> | ||||
|     <Reference Include="System.Xml" /> | ||||
|   </ItemGroup> | ||||
|   <ItemGroup> | ||||
|     <Compile Include="Authentication\SessionAuthenticationClient.cs" /> | ||||
|     <Compile Include="Authentication\SessionAuthenticationResult.cs" /> | ||||
|     <Compile Include="Master\Data\MasterGetServersEntry.cs" /> | ||||
|     <Compile Include="Master\Data\MasterGetServersKeywords.cs" /> | ||||
|     <Compile Include="Master\Messages\Client\MasterGetServersMessage.cs" /> | ||||
|     <Compile Include="Master\DedicatedServerEntry.cs" /> | ||||
|     <Compile Include="Master\Messages\MasterClientMessage.cs" /> | ||||
|     <Compile Include="Master\Messages\MasterClientMessageAttribute.cs" /> | ||||
|     <Compile Include="Master\Messages\MasterServerMessage.cs" /> | ||||
|     <Compile Include="Master\Messages\MasterServerMessageAttribute.cs" /> | ||||
|     <Compile Include="NP\NPAuthenticationResult.cs" /> | ||||
|     <Compile Include="NP\NPClient.cs" /> | ||||
|     <Compile Include="NP\NPFileException.cs" /> | ||||
|     <Compile Include="Properties\AssemblyInfo.cs" /> | ||||
|     <Compile Include="RPC\Messages\Client\AuthenticateRegisterServerMessage.cs" /> | ||||
|     <Compile Include="RPC\Messages\Client\AuthenticateValidateTicketMessage.cs" /> | ||||
|     <Compile Include="RPC\Messages\Client\AuthenticateWithDetailsMessage.cs" /> | ||||
|     <Compile Include="RPC\Messages\Client\AuthenticateWithKeyMessage.cs" /> | ||||
|     <Compile Include="RPC\Messages\Client\AuthenticateWithTokenMessage.cs" /> | ||||
|     <Compile Include="RPC\Messages\Client\FriendsGetProfileDataMessage.cs" /> | ||||
|     <Compile Include="RPC\Messages\Client\FriendsGetUserAvatarMessage.cs" /> | ||||
|     <Compile Include="RPC\Messages\Client\FriendsSetPresenceMessage.cs" /> | ||||
|     <Compile Include="RPC\Messages\Client\FriendsSetSteamIDMessage.cs" /> | ||||
|     <Compile Include="RPC\Messages\Client\MessagingSendDataMessage.cs" /> | ||||
|     <Compile Include="RPC\Messages\Client\StorageGetPublisherFileMessage.cs" /> | ||||
|     <Compile Include="RPC\Messages\Client\StorageGetUserFileMessage.cs" /> | ||||
|     <Compile Include="RPC\Messages\Client\StorageSendRandomStringMessage.cs" /> | ||||
|     <Compile Include="RPC\Messages\Client\StorageWriteUserFileMessage.cs" /> | ||||
|     <Compile Include="RPC\Messages\Data\FriendDetails.cs" /> | ||||
|     <Compile Include="RPC\Messages\Data\FriendsPresence.cs" /> | ||||
|     <Compile Include="RPC\Messages\Data\PresenceState.cs" /> | ||||
|     <Compile Include="RPC\Messages\Data\ProfileData.cs" /> | ||||
|     <Compile Include="RPC\Messages\Data\Ticket.cs" /> | ||||
|     <Compile Include="RPC\Messages\Data\TicketValidationResult.cs" /> | ||||
|     <Compile Include="RPC\Messages\PacketAttribute.cs" /> | ||||
|     <Compile Include="RPC\Messages\RPCClientMessage.cs" /> | ||||
|     <Compile Include="RPC\Messages\RPCMessage.cs" /> | ||||
|     <Compile Include="RPC\Messages\RPCServerMessage.cs" /> | ||||
|     <Compile Include="RPC\Messages\Server\AuthenticateExternalStatusMessage.cs" /> | ||||
|     <Compile Include="RPC\Messages\Server\AuthenticateRegisterServerResultMessage.cs" /> | ||||
|     <Compile Include="RPC\Messages\Server\AuthenticateResultMessage.cs" /> | ||||
|     <Compile Include="RPC\Messages\Server\AuthenticateUserGroupMessage.cs" /> | ||||
|     <Compile Include="RPC\Messages\Server\AuthenticateValidateTicketResultMessage.cs" /> | ||||
|     <Compile Include="RPC\Messages\Server\CloseAppMessage.cs" /> | ||||
|     <Compile Include="RPC\Messages\Server\FriendsGetProfileDataResultMessage.cs" /> | ||||
|     <Compile Include="RPC\Messages\Server\FriendsGetUserAvatarResultMessage.cs" /> | ||||
|     <Compile Include="RPC\Messages\Server\FriendsPresenceMessage.cs" /> | ||||
|     <Compile Include="RPC\Messages\Server\FriendsRosterMessage.cs" /> | ||||
|     <Compile Include="RPC\Messages\Server\HelloMessage.cs" /> | ||||
|     <Compile Include="RPC\Messages\Server\StoragePublisherFileMessage.cs" /> | ||||
|     <Compile Include="RPC\Messages\Server\StorageUserFileMessage.cs" /> | ||||
|     <Compile Include="RPC\Messages\Server\StorageWriteUserFileResultMessage.cs" /> | ||||
|     <Compile Include="RPC\RPCClientStream.cs" /> | ||||
|     <Compile Include="RPC\RPCStream.cs" /> | ||||
|     <Compile Include="Steam\CSteamID.cs" /> | ||||
|     <Compile Include="Steam\EAccountType.cs" /> | ||||
|     <Compile Include="Steam\EUniverse.cs" /> | ||||
|     <Compile Include="Steam\InteropHelp.cs" /> | ||||
|     <Compile Include="Steam\SteamID_t.cs" /> | ||||
|   </ItemGroup> | ||||
|   <ItemGroup> | ||||
|     <None Include="packages.config" /> | ||||
|   </ItemGroup> | ||||
|   <ItemGroup> | ||||
|     <Content Include="Steam\README.txt" /> | ||||
|   </ItemGroup> | ||||
|   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> | ||||
|   <Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" /> | ||||
|   <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild"> | ||||
|     <PropertyGroup> | ||||
|       <ErrorText>Dieses Projekt verweist auf mindestens ein NuGet-Paket, das auf diesem Computer fehlt. Aktivieren Sie die Wiederherstellung von NuGet-Paketen, um die fehlende Datei herunterzuladen. Weitere Informationen finden Sie unter "http://go.microsoft.com/fwlink/?LinkID=322105". Die fehlende Datei ist "{0}".</ErrorText> | ||||
|     </PropertyGroup> | ||||
|     <Error Condition="!Exists('$(SolutionDir)\.nuget\NuGet.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\.nuget\NuGet.targets'))" /> | ||||
|   </Target> | ||||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||||
|   <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> | ||||
|   <PropertyGroup> | ||||
|     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||||
|     <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||||
|     <ProjectGuid>{C6F941A5-82AF-456A-9B3A-752E5B001035}</ProjectGuid> | ||||
|     <OutputType>Library</OutputType> | ||||
|     <AppDesignerFolder>Properties</AppDesignerFolder> | ||||
|     <RootNamespace>NPSharp</RootNamespace> | ||||
|     <AssemblyName>npsharp_client</AssemblyName> | ||||
|     <TargetFrameworkVersion>v4.5</TargetFrameworkVersion> | ||||
|     <FileAlignment>512</FileAlignment> | ||||
|     <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> | ||||
|     <RestorePackages>true</RestorePackages> | ||||
|   </PropertyGroup> | ||||
|   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||||
|     <DebugSymbols>true</DebugSymbols> | ||||
|     <DebugType>full</DebugType> | ||||
|     <Optimize>false</Optimize> | ||||
|     <OutputPath>bin\Debug\</OutputPath> | ||||
|     <DefineConstants>TRACE;DEBUG;COMPILE_RPC,COMPILE_NP,COMPILE_AUTH</DefineConstants> | ||||
|     <ErrorReport>prompt</ErrorReport> | ||||
|     <WarningLevel>4</WarningLevel> | ||||
|   </PropertyGroup> | ||||
|   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | ||||
|     <DebugType>pdbonly</DebugType> | ||||
|     <Optimize>true</Optimize> | ||||
|     <OutputPath>bin\Release\</OutputPath> | ||||
|     <DefineConstants>TRACE;COMPILE_RPC,COMPILE_NP,COMPILE_AUTH</DefineConstants> | ||||
|     <ErrorReport>prompt</ErrorReport> | ||||
|     <WarningLevel>4</WarningLevel> | ||||
|   </PropertyGroup> | ||||
|   <ItemGroup> | ||||
|     <Reference Include="log4net"> | ||||
|       <HintPath>$(SolutionDir)\packages\log4net.2.0.3\lib\net40-full\log4net.dll</HintPath> | ||||
|     </Reference> | ||||
|     <Reference Include="Newtonsoft.Json"> | ||||
|       <HintPath>..\..\..\..\packages\Newtonsoft.Json.7.0.1-beta1\lib\net45\Newtonsoft.Json.dll</HintPath> | ||||
|     </Reference> | ||||
|     <Reference Include="protobuf-net"> | ||||
|       <HintPath>$(SolutionDir)\packages\protobuf-net.2.0.0.668\lib\net40\protobuf-net.dll</HintPath> | ||||
|     </Reference> | ||||
|     <Reference Include="System" /> | ||||
|     <Reference Include="System.Core" /> | ||||
|     <Reference Include="System.Xml" /> | ||||
|   </ItemGroup> | ||||
|   <ItemGroup> | ||||
|     <Compile Include="Authentication\SessionAuthenticationClient.cs" /> | ||||
|     <Compile Include="Authentication\SessionAuthenticationResult.cs" /> | ||||
|     <Compile Include="Master\Data\MasterGetServersEntry.cs" /> | ||||
|     <Compile Include="Master\Data\MasterGetServersKeywords.cs" /> | ||||
|     <Compile Include="Master\Messages\Client\MasterGetServersMessage.cs" /> | ||||
|     <Compile Include="Master\DedicatedServerEntry.cs" /> | ||||
|     <Compile Include="Master\Messages\MasterClientMessage.cs" /> | ||||
|     <Compile Include="Master\Messages\MasterClientMessageAttribute.cs" /> | ||||
|     <Compile Include="Master\Messages\MasterServerMessage.cs" /> | ||||
|     <Compile Include="Master\Messages\MasterServerMessageAttribute.cs" /> | ||||
|     <Compile Include="NP\NPAuthenticationResult.cs" /> | ||||
|     <Compile Include="NP\NPClient.cs" /> | ||||
|     <Compile Include="NP\NPFileException.cs" /> | ||||
|     <Compile Include="Properties\AssemblyInfo.cs" /> | ||||
|     <Compile Include="RPC\Messages\Client\AuthenticateRegisterServerMessage.cs" /> | ||||
|     <Compile Include="RPC\Messages\Client\AuthenticateValidateTicketMessage.cs" /> | ||||
|     <Compile Include="RPC\Messages\Client\AuthenticateWithDetailsMessage.cs" /> | ||||
|     <Compile Include="RPC\Messages\Client\AuthenticateWithKeyMessage.cs" /> | ||||
|     <Compile Include="RPC\Messages\Client\AuthenticateWithTokenMessage.cs" /> | ||||
|     <Compile Include="RPC\Messages\Client\FriendsGetProfileDataMessage.cs" /> | ||||
|     <Compile Include="RPC\Messages\Client\FriendsGetUserAvatarMessage.cs" /> | ||||
|     <Compile Include="RPC\Messages\Client\FriendsSetPresenceMessage.cs" /> | ||||
|     <Compile Include="RPC\Messages\Client\FriendsSetSteamIDMessage.cs" /> | ||||
|     <Compile Include="RPC\Messages\Client\MessagingSendDataMessage.cs" /> | ||||
|     <Compile Include="RPC\Messages\Client\StorageGetPublisherFileMessage.cs" /> | ||||
|     <Compile Include="RPC\Messages\Client\StorageGetUserFileMessage.cs" /> | ||||
|     <Compile Include="RPC\Messages\Client\StorageSendRandomStringMessage.cs" /> | ||||
|     <Compile Include="RPC\Messages\Client\StorageWriteUserFileMessage.cs" /> | ||||
|     <Compile Include="RPC\Messages\Data\FriendDetails.cs" /> | ||||
|     <Compile Include="RPC\Messages\Data\FriendsPresence.cs" /> | ||||
|     <Compile Include="RPC\Messages\Data\PresenceState.cs" /> | ||||
|     <Compile Include="RPC\Messages\Data\ProfileData.cs" /> | ||||
|     <Compile Include="RPC\Messages\Data\Ticket.cs" /> | ||||
|     <Compile Include="RPC\Messages\Data\TicketValidationResult.cs" /> | ||||
|     <Compile Include="RPC\Messages\PacketAttribute.cs" /> | ||||
|     <Compile Include="RPC\Messages\RPCClientMessage.cs" /> | ||||
|     <Compile Include="RPC\Messages\RPCMessage.cs" /> | ||||
|     <Compile Include="RPC\Messages\RPCServerMessage.cs" /> | ||||
|     <Compile Include="RPC\Messages\Server\AuthenticateExternalStatusMessage.cs" /> | ||||
|     <Compile Include="RPC\Messages\Server\AuthenticateRegisterServerResultMessage.cs" /> | ||||
|     <Compile Include="RPC\Messages\Server\AuthenticateResultMessage.cs" /> | ||||
|     <Compile Include="RPC\Messages\Server\AuthenticateUserGroupMessage.cs" /> | ||||
|     <Compile Include="RPC\Messages\Server\AuthenticateValidateTicketResultMessage.cs" /> | ||||
|     <Compile Include="RPC\Messages\Server\CloseAppMessage.cs" /> | ||||
|     <Compile Include="RPC\Messages\Server\FriendsGetProfileDataResultMessage.cs" /> | ||||
|     <Compile Include="RPC\Messages\Server\FriendsGetUserAvatarResultMessage.cs" /> | ||||
|     <Compile Include="RPC\Messages\Server\FriendsPresenceMessage.cs" /> | ||||
|     <Compile Include="RPC\Messages\Server\FriendsRosterMessage.cs" /> | ||||
|     <Compile Include="RPC\Messages\Server\HelloMessage.cs" /> | ||||
|     <Compile Include="RPC\Messages\Server\StoragePublisherFileMessage.cs" /> | ||||
|     <Compile Include="RPC\Messages\Server\StorageUserFileMessage.cs" /> | ||||
|     <Compile Include="RPC\Messages\Server\StorageWriteUserFileResultMessage.cs" /> | ||||
|     <Compile Include="RPC\RPCClientStream.cs" /> | ||||
|     <Compile Include="RPC\RPCStream.cs" /> | ||||
|     <Compile Include="Steam\CSteamID.cs" /> | ||||
|     <Compile Include="Steam\EAccountType.cs" /> | ||||
|     <Compile Include="Steam\EUniverse.cs" /> | ||||
|     <Compile Include="Steam\InteropHelp.cs" /> | ||||
|     <Compile Include="Steam\SteamID_t.cs" /> | ||||
|   </ItemGroup> | ||||
|   <ItemGroup> | ||||
|     <None Include="packages.config" /> | ||||
|   </ItemGroup> | ||||
|   <ItemGroup> | ||||
|     <Content Include="Steam\README.txt" /> | ||||
|   </ItemGroup> | ||||
|   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> | ||||
|   <Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" /> | ||||
|   <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild"> | ||||
|     <PropertyGroup> | ||||
|       <ErrorText>Dieses Projekt verweist auf mindestens ein NuGet-Paket, das auf diesem Computer fehlt. Aktivieren Sie die Wiederherstellung von NuGet-Paketen, um die fehlende Datei herunterzuladen. Weitere Informationen finden Sie unter "http://go.microsoft.com/fwlink/?LinkID=322105". Die fehlende Datei ist "{0}".</ErrorText> | ||||
|     </PropertyGroup> | ||||
|     <Error Condition="!Exists('$(SolutionDir)\.nuget\NuGet.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\.nuget\NuGet.targets'))" /> | ||||
|   </Target> | ||||
|   <!-- To modify your build process, add your task inside one of the targets below and uncomment it.  | ||||
|        Other similar extension points exist, see Microsoft.Common.targets. | ||||
|   <Target Name="BeforeBuild"> | ||||
|   </Target> | ||||
|   <Target Name="AfterBuild"> | ||||
|   </Target> | ||||
|   --> | ||||
| </Project> | ||||
|   --> | ||||
| </Project> | ||||
|  | @ -1,11 +1,65 @@ | |||
| using System.Collections.Generic; | ||||
| using System.IO; | ||||
| 
 | ||||
| using Newtonsoft.Json.Linq; | ||||
| 
 | ||||
| namespace NPSharp.RPC.Messages.Data | ||||
| { | ||||
|     /// <summary> | ||||
|     ///     Represents the outcome of a ticket validation attempt. | ||||
|     ///     Represents the outcome of a ticket validation attempt, including eventual NPv2 authentication identifiers passed by the server. | ||||
|     /// </summary> | ||||
|     public enum TicketValidationResult | ||||
|     { | ||||
|         Valid = 0, | ||||
|         Invalid = 1 | ||||
|     public class TicketValidationResult | ||||
|     { | ||||
|         internal TicketValidationResult(Server.AuthenticateValidateTicketResultMessage message) | ||||
|         { | ||||
|             IsValid = message.Result == 0; | ||||
| 
 | ||||
|             Identifiers = ParseIdentifierList(message.Identifiers); | ||||
|         } | ||||
| 
 | ||||
|         internal IEnumerable<string> ParseIdentifierList(string serializedList) | ||||
|         { | ||||
|             // current layer1 implementation uses JSON, formatted as `[ [ <type>, <value> ]... ]` - we'll concatenate these as strings to prevent this implementation detail | ||||
|             // this is consistent with the external API for `profiles` in Citizen itself | ||||
|             JToken jsonValue; | ||||
| 
 | ||||
|             try | ||||
|             { | ||||
|                 jsonValue = JToken.Parse(serializedList); | ||||
|             } | ||||
|             catch (FileLoadException) | ||||
|             { | ||||
|                 return new string[0]; | ||||
|             } | ||||
| 
 | ||||
|             var identifiers = new List<string>(); | ||||
| 
 | ||||
|             if (jsonValue.Type == JTokenType.Array) | ||||
|             { | ||||
|                 var array = (JArray)jsonValue; | ||||
| 
 | ||||
|                 foreach (var identifierToken in array.Children()) | ||||
|                 { | ||||
|                     if (identifierToken.Type == JTokenType.Array) | ||||
|                     { | ||||
|                         var identifierArray = (JArray)identifierToken; | ||||
| 
 | ||||
|                         identifiers.Add(string.Format("{0}:{1}", identifierArray[0], identifierArray[1])); | ||||
|                     } | ||||
|                 } | ||||
|             } | ||||
| 
 | ||||
|             return identifiers; | ||||
|         } | ||||
| 
 | ||||
|         /// <summary> | ||||
|         /// Whether the ticket is valid or not. | ||||
|         /// </summary> | ||||
|         public bool IsValid { get; private set; } | ||||
| 
 | ||||
|         /// <summary> | ||||
|         /// A list of NPv2 authentication identifiers belonging to the ticket session. | ||||
|         /// </summary> | ||||
|         public IEnumerable<string> Identifiers { get; private set; } | ||||
|     } | ||||
| } | ||||
|  | @ -14,6 +14,9 @@ namespace NPSharp.RPC.Messages.Server | |||
|         public UInt64 NPID { get; set; } | ||||
| 
 | ||||
|         [ProtoMember(3)] | ||||
|         public int GroupID { get; set; } | ||||
|         public int GroupID { get; set; } | ||||
| 
 | ||||
|         [ProtoMember(4, IsRequired = false)] | ||||
|         public string Identifiers { get; set; } | ||||
|     } | ||||
| } | ||||
|  | @ -1,6 +1,7 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| 
 | ||||
| <packages> | ||||
|   <package id="log4net" version="2.0.3" targetFramework="net45" /> | ||||
|   <package id="protobuf-net" version="2.0.0.668" targetFramework="net45" /> | ||||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| 
 | ||||
| <packages> | ||||
|   <package id="log4net" version="2.0.3" targetFramework="net45" /> | ||||
|   <package id="Newtonsoft.Json" version="7.0.1-beta1" targetFramework="net45" /> | ||||
|   <package id="protobuf-net" version="2.0.0.668" targetFramework="net45" /> | ||||
| </packages> | ||||
		Loading…
	
		Reference in New Issue