Skip to content

Commit a71adc1

Browse files
committed
Merge pull request #16 from latticework/kenbrubaker/ImplementValidationErrors
Implemented JWT-based security and Authentication extensibility.
2 parents 0c69ca1 + e520592 commit a71adc1

24 files changed

+1525
-111
lines changed

Jali.Pcl/src/Jali.Core.Pcl/Jali.Core.Pcl.csproj

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,21 +42,33 @@
4242
<Compile Include="..\..\..\src\Jali.Core\Core\InternalErrorException.cs">
4343
<Link>Core\InternalErrorException.cs</Link>
4444
</Compile>
45-
<Compile Include="..\..\..\src\Jali.Core\Core\JaliCoreExtensions.cs">
46-
<Link>Core\JaliCoreExtensions.cs</Link>
47-
</Compile>
4845
<Compile Include="..\..\..\src\Jali.Core\Core\JaliCoreMessageLibrary.cs">
4946
<Link>Core\JaliCoreMessageLibrary.cs</Link>
5047
</Compile>
5148
<Compile Include="..\..\..\src\Jali.Core\Core\JaliCoreMessages.cs">
5249
<Link>Core\JaliCoreMessages.cs</Link>
5350
</Compile>
51+
<Compile Include="..\..\..\src\Jali.Core\Core\JaliCoreSystemCollectionsGenericExtensions.cs">
52+
<Link>Core\JaliCoreSystemCollectionsGenericExtensions.cs</Link>
53+
</Compile>
54+
<Compile Include="..\..\..\src\Jali.Core\Core\JaliCoreSystemExtensions.cs">
55+
<Link>Core\JaliCoreSystemExtensions.cs</Link>
56+
</Compile>
5457
<Compile Include="..\..\..\src\Jali.Core\Core\NotificationMessageException.cs">
5558
<Link>Core\NotificationMessageException.cs</Link>
5659
</Compile>
5760
<Compile Include="..\..\..\src\Jali.Core\Core\TryGetResult.cs">
5861
<Link>Core\TryGetResult.cs</Link>
5962
</Compile>
63+
<Compile Include="..\..\..\src\Jali.Core\Decompiled\UrlPath.cs">
64+
<Link>Decompiled\UrlPath.cs</Link>
65+
</Compile>
66+
<Compile Include="..\..\..\src\Jali.Core\Decompiled\VirtualPath.cs">
67+
<Link>Decompiled\VirtualPath.cs</Link>
68+
</Compile>
69+
<Compile Include="..\..\..\src\Jali.Core\Decompiled\VirtualPathUtility.cs">
70+
<Link>Decompiled\VirtualPathUtility.cs</Link>
71+
</Compile>
6072
<Compile Include="..\..\..\src\Jali.Core\Note\Definition\MessageAuthority.cs">
6173
<Link>Note\Definition\MessageAuthority.cs</Link>
6274
</Compile>

Jali.Pcl/src/Jali.Serve.Pcl/Jali.Serve.Pcl.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,6 @@
4747
</ProjectReference>
4848
</ItemGroup>
4949
<ItemGroup>
50-
<Compile Include="..\..\..\src\Jali.Serve.Server\JaliHttpRequestMessageExtensions.cs">
51-
<Link>JaliHttpRequestMessageExtensions.cs</Link>
52-
</Compile>
5350
<Compile Include="..\..\..\src\Jali.Serve\Decompiled\Error.cs">
5451
<Link>Decompiled\Error.cs</Link>
5552
</Compile>
@@ -164,6 +161,9 @@
164161
<Compile Include="..\..\..\src\Jali.Serve\IStageContext.cs">
165162
<Link>IStageContext.cs</Link>
166163
</Compile>
164+
<Compile Include="..\..\..\src\Jali.Serve\JaliHttpRequestMessageExtensions.cs">
165+
<Link>JaliHttpRequestMessageExtensions.cs</Link>
166+
</Compile>
167167
<Compile Include="..\..\..\src\Jali.Serve\MessageConnection.cs">
168168
<Link>MessageConnection.cs</Link>
169169
</Compile>

Jali.Pcl/src/Jali.Serve.Pcl/LICENSE

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2014 dvsekhvalnov
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy of
6+
this software and associated documentation files (the "Software"), to deal in
7+
the Software without restriction, including without limitation the rights to
8+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9+
the Software, and to permit persons to whom the Software is furnished to do so,
10+
subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Jali.Pcl/src/Jali.Serve.Server.Pcl/Jali.Serve.Server.Pcl.csproj

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,12 @@
9494
<Compile Include="..\..\..\src\Jali.Serve.Server\StageManager.cs">
9595
<Link>StageManager.cs</Link>
9696
</Compile>
97+
<Compile Include="..\..\..\src\Jali.Serve.Server\User\GetUserRequest.cs">
98+
<Link>User\GetUserRequest.cs</Link>
99+
</Compile>
100+
<Compile Include="..\..\..\src\Jali.Serve.Server\User\GetUserResponse.cs">
101+
<Link>User\GetUserResponse.cs</Link>
102+
</Compile>
97103
<Compile Include="..\..\..\src\Jali.Serve.Server\User\GetUserRoutine.cs">
98104
<Link>User\GetUserRoutine.cs</Link>
99105
</Compile>

psakefile.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ properties {
33
$zipFileName = "Jali00r1.zip"
44
$majorVersion = "0.0"
55
$majorWithReleaseVersion = "0.0.1"
6-
$nugetPrelease = "prealpha506"
6+
$nugetPrelease = "prealpha6"
77
$version = GetVersion $majorWithReleaseVersion
88
$signAssemblies = $false
99
# $signKeyPath = "C:\Development\Releases\newtonsoft.snk"

src/Jali.Core/Core/JaliCoreMessages.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ static InternalError()
142142
""type"": ""object"",
143143
""description"": ""The description of the internal error.""
144144
}
145+
}
145146
}"),
146147
};
147148
}

src/Jali.Core/Core/JaliCoreExtensions.cs renamed to src/Jali.Core/Core/JaliCoreSystemCollectionsGenericExtensions.cs

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
using System;
2-
using System.Collections.Generic;
31
using System.Threading.Tasks;
2+
using Jali.Core;
43

5-
namespace Jali.Core
4+
namespace System.Collections.Generic
65
{
7-
public static class JaliCoreExtensions
6+
public static class JaliCoreSystemCollectionsGenericExtensions
87
{
98
public static void AddRange<T>(this ICollection<T> sequence, IEnumerable<T> range)
109
{
@@ -90,21 +89,6 @@ public static TryGetResult<TValue> GetOrCreateValue<TKey, TValue>(this IDictiona
9089
{
9190
return reference.GetOrCreateValue(key, () => default(TValue));
9291
}
93-
94-
public static bool EqualsOrdinal(this string receiver, string other)
95-
{
96-
return string.Equals(receiver, other, StringComparison.Ordinal);
97-
}
98-
99-
public static bool EqualsOrdinalIgnoreCase(this string receiver, string other)
100-
{
101-
return string.Equals(receiver, other, StringComparison.OrdinalIgnoreCase);
102-
}
103-
104-
public static string GetBaseUrl(this Uri receiver)
105-
{
106-
// TODO: JaliCoreExtensions.GetBaseUrl: Use GetLeftPart(UriPartial.Authority) when available.
107-
return receiver.Scheme + "://" + receiver.Authority;
108-
}
10992
}
110-
}
93+
94+
}
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
using Jali.Core.Decompiled.System.Web;
2+
using Jali.Core.Decompiled.System.Web.Util;
3+
4+
namespace System
5+
{
6+
public static class JaliCoreSystemExtensions
7+
{
8+
public static bool EqualsOrdinal(this string receiver, string other)
9+
{
10+
return string.Equals(receiver, other, StringComparison.Ordinal);
11+
}
12+
13+
public static bool EqualsOrdinalIgnoreCase(this string receiver, string other)
14+
{
15+
return string.Equals(receiver, other, StringComparison.OrdinalIgnoreCase);
16+
}
17+
18+
public static string GetBaseUrl(this Uri receiver)
19+
{
20+
// TODO: JaliCoreExtensions.GetBaseUrl: Use GetLeftPart(UriPartial.Authority) when available.
21+
return receiver.Scheme + "://" + receiver.Authority;
22+
}
23+
24+
/// <summary>
25+
/// Combines two <see cref="Uri"/>s even if they are both relative.
26+
/// </summary>
27+
/// <param name="baseUri">
28+
/// Relative or absolute base uri.
29+
/// </param>
30+
/// <param name="relativeUri">
31+
/// Uri to be appended.
32+
/// </param>
33+
public static Uri Combine(this Uri baseUri, string relativeUri)
34+
{
35+
return baseUri.Combine(new Uri(relativeUri, UriKind.Relative));
36+
}
37+
38+
/// <summary>
39+
/// Combines two <see cref="Uri"/>s even if they are both relative.
40+
/// </summary>
41+
/// <param name="baseUri">
42+
/// Relative or absolute base uri.
43+
/// </param>
44+
/// <param name="relativeUri">
45+
/// Uri to be appended.
46+
/// </param>
47+
public static Uri Combine(this Uri baseUri, Uri relativeUri)
48+
{
49+
if (baseUri == null) throw new ArgumentNullException(nameof(baseUri));
50+
if (relativeUri == null) throw new ArgumentNullException(nameof(relativeUri));
51+
52+
// From http://stackoverflow.com/a/33651894
53+
var baseUrl = UrlPath.AppendSlashToPathIfNeeded(baseUri.ToString());
54+
var combinedUrl = VirtualPathUtility.Combine(baseUrl, relativeUri.ToString());
55+
56+
return new Uri(combinedUrl, baseUri.IsAbsoluteUri ? UriKind.Absolute : UriKind.Relative);
57+
}
58+
}
59+
60+
}

0 commit comments

Comments
 (0)