Authentication Alpha
parent
0be67ce4a1
commit
1b7030e45c
|
@ -13,6 +13,8 @@ using ln.types.rpc;
|
||||||
using ln.application.slots;
|
using ln.application.slots;
|
||||||
using ln.identities;
|
using ln.identities;
|
||||||
using ln.http.session;
|
using ln.http.session;
|
||||||
|
using ln.json.mapping;
|
||||||
|
using ln.application.json;
|
||||||
|
|
||||||
namespace ln.application
|
namespace ln.application
|
||||||
{
|
{
|
||||||
|
@ -203,6 +205,9 @@ namespace ln.application
|
||||||
return pluginInstances[pluginType];
|
return pluginInstances[pluginType];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static Application()
|
||||||
|
{
|
||||||
|
JSONMapper.DefaultMapper.Add(new JSONIdentityMapping());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,17 +60,13 @@ namespace ln.application
|
||||||
if (secureAttribute.Authenticate(authenticationProve.Challenge, authenticationProve.Prove))
|
if (secureAttribute.Authenticate(authenticationProve.Challenge, authenticationProve.Prove))
|
||||||
{
|
{
|
||||||
SessionIdentity = identity;
|
SessionIdentity = identity;
|
||||||
JSONObject r = new JSONObject();
|
return SessionIdentity;
|
||||||
r.Add("UniqueID", JSONMapper.DefaultMapper.ToJson(identity.UniqueID));
|
|
||||||
r.Add("IdentityName", JSONMapper.DefaultMapper.ToJson(identity.IdentityName));
|
|
||||||
return r;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
SessionIdentity = null;
|
||||||
throw new ArgumentException();
|
throw new ArgumentException();
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new KeyNotFoundException();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -0,0 +1,36 @@
|
||||||
|
// /**
|
||||||
|
// * File: JSONIdentityMapping.cs
|
||||||
|
// * Author: haraldwolff
|
||||||
|
// *
|
||||||
|
// * This file and it's content is copyrighted by the Author and / or copyright holder.
|
||||||
|
// * Any use wihtout proper permission is illegal and may lead to legal actions.
|
||||||
|
// *
|
||||||
|
// *
|
||||||
|
// **/
|
||||||
|
using System;
|
||||||
|
using ln.json.mapping;
|
||||||
|
using ln.identities;
|
||||||
|
using ln.json;
|
||||||
|
|
||||||
|
namespace ln.application.json
|
||||||
|
{
|
||||||
|
public class JSONIdentityMapping : JSONMapping
|
||||||
|
{
|
||||||
|
public JSONIdentityMapping()
|
||||||
|
:base(typeof(Identity))
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public override object FromJson(JSONMapper mapper, JSONValue json) => throw new NotSupportedException();
|
||||||
|
public override JSONValue ToJson(JSONMapper mapper, object value)
|
||||||
|
{
|
||||||
|
Identity identity = value as Identity;
|
||||||
|
|
||||||
|
JSONObject jidentity = new JSONObject();
|
||||||
|
jidentity.Add("UniqueID", identity.UniqueID);
|
||||||
|
jidentity.Add("IdentityName", identity.IdentityName);
|
||||||
|
|
||||||
|
return jidentity;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -42,6 +42,7 @@
|
||||||
<Compile Include="slots\SlotRequest.cs" />
|
<Compile Include="slots\SlotRequest.cs" />
|
||||||
<Compile Include="slots\BinarySlotContainer.cs" />
|
<Compile Include="slots\BinarySlotContainer.cs" />
|
||||||
<Compile Include="slots\SlotAllocation.cs" />
|
<Compile Include="slots\SlotAllocation.cs" />
|
||||||
|
<Compile Include="json\JSONIdentityMapping.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\ln.types\ln.types.csproj">
|
<ProjectReference Include="..\ln.types\ln.types.csproj">
|
||||||
|
@ -73,6 +74,7 @@
|
||||||
<Folder Include="service\" />
|
<Folder Include="service\" />
|
||||||
<Folder Include="www\" />
|
<Folder Include="www\" />
|
||||||
<Folder Include="slots\" />
|
<Folder Include="slots\" />
|
||||||
|
<Folder Include="json\" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="www\ln.application.js">
|
<None Include="www\ln.application.js">
|
||||||
|
|
2
www
2
www
|
@ -1 +1 @@
|
||||||
Subproject commit 6815c42b253152f120fd74a1f0cdc0bebf071547
|
Subproject commit caff9e19d57c1a2d940fbaee97cf42d679a1f16b
|
Loading…
Reference in New Issue