Skip to content

Commit ce40d43

Browse files
Lorackevinchalet
authored andcommitted
Update the generator to use the ASP.NET Core/.NET Core RC2 templates
1 parent 6750989 commit ce40d43

File tree

8 files changed

+59
-43
lines changed

8 files changed

+59
-43
lines changed

generators/app/templates/AuthenticationDefaults.cs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44
* for more information concerning the license and the contributors participating to this project.
55
*/
66

7-
using Microsoft.AspNet.Authentication;
8-
using Microsoft.AspNet.Authentication.OAuth;
7+
using Microsoft.AspNetCore.Builder;
98

109
namespace AspNet.Security.OAuth.<%= name %> {
1110
/// <summary>
@@ -18,17 +17,17 @@ public static class <%= name %>AuthenticationDefaults {
1817
public const string AuthenticationScheme = "<%= name %>";
1918

2019
/// <summary>
21-
/// Default value for <see cref="OAuthOptions.DisplayName"/>.
20+
/// Default value for <see cref="RemoteAuthenticationOptions.DisplayName"/>.
2221
/// </summary>
2322
public const string DisplayName = "<%= name %>";
2423

2524
/// <summary>
26-
/// Default value for <see cref="OAuthOptions.ClaimsIssuer"/>.
25+
/// Default value for <see cref="AuthenticationOptions.ClaimsIssuer"/>.
2726
/// </summary>
2827
public const string Issuer = "<%= name %>";
2928

3029
/// <summary>
31-
/// Default value for <see cref="OAuthOptions.CallbackPath"/>.
30+
/// Default value for <see cref="RemoteAuthenticationOptions.CallbackPath"/>.
3231
/// </summary>
3332
public const string CallbackPath = "/signin-<%= name.toLowerCase() %>";
3433

generators/app/templates/AuthenticationHandler.cs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,11 @@
99
using System.Security.Claims;
1010
using System.Threading.Tasks;
1111
using AspNet.Security.OAuth.Extensions;
12-
using Microsoft.AspNet.Authentication;
13-
using Microsoft.AspNet.Authentication.OAuth;
14-
using Microsoft.AspNet.Http.Authentication;
15-
using Microsoft.Extensions.Internal;
12+
using JetBrains.Annotations;
13+
using Microsoft.AspNetCore.Authentication;
14+
using Microsoft.AspNetCore.Authentication.OAuth;
15+
using Microsoft.AspNetCore.Http.Authentication;
16+
using Microsoft.Extensions.Logging;
1617
using Newtonsoft.Json.Linq;
1718

1819
namespace AspNet.Security.OAuth.<%= name %> {
@@ -31,7 +32,7 @@ protected override async Task<AuthenticationTicket> CreateTicketAsync([NotNull]
3132
response.EnsureSuccessStatusCode();
3233

3334
var payload = JObject.Parse(await response.Content.ReadAsStringAsync());
34-
35+
3536
identity.AddOptionalClaim(ClaimTypes.NameIdentifier, <%= name %>AuthenticationHelper.GetIdentifier(payload), Options.ClaimsIssuer);
3637

3738
// TODO: Add any optional claims, eg
@@ -47,7 +48,7 @@ protected override async Task<AuthenticationTicket> CreateTicketAsync([NotNull]
4748
if (context.Principal?.Identity == null) {
4849
return null;
4950
}
50-
51+
5152
return new AuthenticationTicket(context.Principal, context.Properties, context.Options.AuthenticationScheme);
5253
}
5354
}

generators/app/templates/AuthenticationHelper.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* for more information concerning the license and the contributors participating to this project.
55
*/
66

7-
using Microsoft.Extensions.Internal;
7+
using JetBrains.Annotations;
88
using Newtonsoft.Json.Linq;
99

1010
namespace AspNet.Security.OAuth.<%= name %> {

generators/app/templates/AuthenticationMiddleware.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@
55
*/
66

77
using System.Text.Encodings.Web;
8-
using Microsoft.AspNet.Authentication;
9-
using Microsoft.AspNet.Authentication.OAuth;
10-
using Microsoft.AspNet.DataProtection;
11-
using Microsoft.AspNet.Http;
12-
using Microsoft.Extensions.Internal;
8+
using Microsoft.AspNetCore.Authentication;
9+
using Microsoft.AspNetCore.Authentication.OAuth;
10+
using Microsoft.AspNetCore.DataProtection;
11+
using Microsoft.AspNetCore.Http;
1312
using Microsoft.Extensions.Logging;
14-
using Microsoft.Extensions.OptionsModel;
13+
using Microsoft.Extensions.Options;
14+
using JetBrains.Annotations;
1515

1616
namespace AspNet.Security.OAuth.<%= name %> {
1717
public class <%= name %>AuthenticationMiddleware : OAuthMiddleware<<%= name %>AuthenticationOptions> {

generators/app/templates/AuthenticationOptions.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
* for more information concerning the license and the contributors participating to this project.
55
*/
66

7-
using Microsoft.AspNet.Authentication.OAuth;
8-
using Microsoft.AspNet.Http;
7+
using Microsoft.AspNetCore.Builder;
8+
using Microsoft.AspNetCore.Http;
99

1010
namespace AspNet.Security.OAuth.<%= name %> {
1111
/// <summary>

generators/app/templates/Project.xproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,16 @@
55
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
66
</PropertyGroup>
77

8-
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.Props" Condition="'$(VSToolsPath)' != ''" />
8+
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.Props" Condition="'$(VSToolsPath)' != ''" />
99
<PropertyGroup Label="Globals">
1010
<ProjectGuid>9dfee19e-c170-4f20-93f3-ec952b1532f2</ProjectGuid>
1111
<RootNamespace>AspNet.Security.OAuth.<%= name %></RootNamespace>
12-
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">..\..\artifacts\obj\$(MSBuildProjectName)</BaseIntermediateOutputPath>
13-
<OutputPath Condition="'$(OutputPath)'=='' ">..\..\artifacts\bin\$(MSBuildProjectName)\</OutputPath>
12+
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">.\obj</BaseIntermediateOutputPath>
13+
<OutputPath Condition="'$(OutputPath)'=='' ">.\bin\</OutputPath>
1414
</PropertyGroup>
1515

1616
<PropertyGroup>
1717
<SchemaVersion>2.0</SchemaVersion>
1818
</PropertyGroup>
19-
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.targets" Condition="'$(VSToolsPath)' != ''" />
19+
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.targets" Condition="'$(VSToolsPath)' != ''" />
2020
</Project>

generators/app/templates/project.json

Lines changed: 34 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,32 +2,48 @@
22
"version": "1.0.0-*",
33
"description": "ASP.NET 5 security middleware enabling <%= name %> authentication.",
44
"authors": [ "<%= authorname %>" ],
5+
6+
"packOptions": {
57
"owners": [ "Kévin Chalet", "Jerrie Pelser" ],
68

79
"projectUrl": "https://github.com/aspnet-contrib/AspNet.Security.OAuth.Providers",
10+
"iconUrl": "https://avatars3.githubusercontent.com/u/7998081?s=64",
811
"licenseUrl": "http://www.apache.org/licenses/LICENSE-2.0.html",
912

10-
"dependencies": {
11-
"AspNet.Security.OAuth.Extensions": {
12-
"type": "build",
13-
"version": "1.0.0-*"
14-
},
13+
"repository": {
14+
"type": "git",
15+
"url": "git://github.com/aspnet-contrib/AspNet.Security.OAuth.Providers"
16+
},
17+
18+
"tags": [
19+
"aspnetcore",
20+
"authentication",
21+
"<%= name.toLowerCase() %>",
22+
"oauth",
23+
"security"
24+
]
25+
},
1526

16-
"Microsoft.AspNet.Authentication.OAuth": "1.0.0-*",
27+
"buildOptions": {
28+
"warningsAsErrors": true,
29+
"nowarn": [ "CS1591" ],
30+
"xmlDoc": true
31+
},
1732

18-
"Microsoft.Extensions.NotNullAttribute.Sources": {
19-
"type": "build",
20-
"version": "1.0.0-*"
21-
}
22-
},
33+
"dependencies": {
34+
"AspNet.Security.OAuth.Extensions": { "target": "project", "type": "build" },
35+
"JetBrains.Annotations": { "type": "build", "version": "10.1.4" },
36+
"Microsoft.AspNetCore.Authentication.OAuth": "1.0.0-*"
37+
},
2338

24-
"frameworks": {
25-
"dnx451": { },
39+
"frameworks": {
40+
"net451": { },
2641

27-
"dnxcore50": {
28-
"dependencies": {
29-
"System.Security.Claims": "4.0.1-*"
30-
}
31-
}
42+
"netstandard1.3": {
43+
"imports": [
44+
"dotnet5.4",
45+
"portable-net451+win8"
46+
]
3247
}
48+
}
3349
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "generator-aspnet-oauth",
3-
"version": "1.0.7",
3+
"version": "1.0.8",
44
"description": "Yeoman generator for OAuth Providers for ASP.NET 5",
55
"license": "MIT",
66
"main": "app/index.js",

0 commit comments

Comments
 (0)