Skip to content

Commit d7c9e55

Browse files
committed
amazon and stack exchange logins
1 parent 5bbe675 commit d7c9e55

File tree

6 files changed

+42
-6
lines changed

6 files changed

+42
-6
lines changed

AspNetCoreSpa.csproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111

1212

1313
<ItemGroup>
14+
<PackageReference Include="AspNet.Security.OAuth.Amazon" Version="2.0.0-*" />
15+
<PackageReference Include="AspNet.Security.OAuth.StackExchange" Version="2.0.0-*" />
1416
<PackageReference Include="AspNet.Security.OAuth.Yahoo" Version="2.0.0-*" />
1517
<PackageReference Include="AspNet.Security.OAuth.Paypal" Version="2.0.0-*" />
1618
<PackageReference Include="AspNet.Security.OAuth.GitHub" Version="2.0.0-*" />

ClientApp/app/shared/components/social-login/social-login.component.scss

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,16 @@ a.fa {
4949
color: white;
5050
}
5151

52+
&.fa-stack-exchange {
53+
background: #1f5296;
54+
color: white;
55+
}
56+
57+
&.fa-amazon {
58+
background: #f5d993;
59+
color: white;
60+
}
61+
5262
&.active {
5363
border: 5px solid #b4dab4;
5464
}

ClientApp/app/shared/components/social-login/social-login.component.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ export class SocialLoginComponent {
2727
return 'fa-windows';
2828
}
2929

30+
if (login.toLowerCase() === 'stackexchange') {
31+
return 'fa-stack-exchange';
32+
}
33+
3034
return `fa-${login.toLowerCase()}`;
3135
}
3236
public redirect(provider: string): void {

Server/Extensions/ApplicationBuilderExtensions.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,9 @@ public static IApplicationBuilder UseCustomisedCsp(this IApplicationBuilder app)
8989
csp.AllowAudioAndVideo
9090
.FromNowhere();
9191

92-
// Contained iframes can be sourced from:
93-
csp.AllowChildren
94-
.FromNowhere(); //Nowhere, no iframes allowed
92+
// Contained iframes can be sourced from:
93+
csp.AllowFrames
94+
.FromNowhere(); //Nowhere, no iframes allowed
9595

9696
// Allow AJAX, WebSocket and EventSource connections to:
9797
csp.AllowConnections

Server/Extensions/ServiceCollectionExtensions.cs

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -202,11 +202,23 @@ public static IServiceCollection AddCustomOpenIddict(this IServiceCollection ser
202202
options.ClientId = Startup.Configuration["Authentication:Paypal:ClientId"];
203203
options.ClientSecret = Startup.Configuration["Authentication:Paypal:ClientSecret"];
204204
})
205-
// https://developer.yahoo.com/app
205+
// https://developer.yahoo.com
206206
.AddYahoo(options =>
207207
{
208-
options.ClientId = Startup.Configuration["Authentication:Paypal:ClientId"];
209-
options.ClientSecret = Startup.Configuration["Authentication:Paypal:ClientSecret"];
208+
options.ClientId = Startup.Configuration["Authentication:Yahoo:ClientId"];
209+
options.ClientSecret = Startup.Configuration["Authentication:Yahoo:ClientSecret"];
210+
})
211+
// https://stackapps.com/apps/oauth/
212+
.AddStackExchange(options =>
213+
{
214+
options.ClientId = Startup.Configuration["Authentication:StackExchange:ClientId"];
215+
options.ClientSecret = Startup.Configuration["Authentication:StackExchange:ClientSecret"];
216+
})
217+
// https://stackapps.com/apps/oauth/
218+
.AddAmazon(options =>
219+
{
220+
options.ClientId = Startup.Configuration["Authentication:Amazon:ClientId"];
221+
options.ClientSecret = Startup.Configuration["Authentication:Amazon:ClientSecret"];
210222
});
211223

212224
return services;

appsettings.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,14 @@
6767
"Yahoo": {
6868
"ClientId": "ChangeMe",
6969
"ClientSecret": "ChangeMe"
70+
},
71+
"StackExchange": {
72+
"ClientId": "ChangeMe",
73+
"ClientSecret": "ChangeMe"
74+
},
75+
"Amazon": {
76+
"ClientId": "ChangeMe",
77+
"ClientSecret": "ChangeMe"
7078
}
7179
}
7280
}

0 commit comments

Comments
 (0)