This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "iisSettings": { | |
| "windowsAuthentication": false, | |
| "anonymousAuthentication": true, | |
| "iis": { | |
| "applicationUrl": "https://localhost:44301", | |
| "sslPort": 0 | |
| }, | |
| "iisExpress": { | |
| "applicationUrl": "http://localhost:44357/", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // This method gets called by the runtime. Use this method to add services to the container. | |
| public void ConfigureServices(IServiceCollection services) | |
| { | |
| // add facebook login | |
| services.AddAuthentication() | |
| .AddFacebook(facebookOptions => | |
| { | |
| facebookOptions.AppId = Configuration["Authentication:Facebook:AppId"]; | |
| facebookOptions.AppSecret = Configuration["Authentication:Facebook:AppSecret"]; | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public Startup(IConfiguration configuration, IHostingEnvironment env) | |
| { | |
| var builder = new ConfigurationBuilder() | |
| .SetBasePath(env.ContentRootPath) | |
| .AddJsonFile("appsettings.json", optional: false, reloadOnChange: true) | |
| .AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true); | |
| if (env.IsDevelopment()) | |
| { | |
| // For more details on using the user secret store |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # run one line at a time | |
| dotnet user-secrets set Authentication:Facebook:AppId blah | |
| dotnet user-secrets set Authentication:Facebook:AppSecret bleh |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <Project Sdk="Microsoft.NET.Sdk.Web"> | |
| <!-- | |
| the tools for console usage & powershell | |
| --> | |
| <ItemGroup> | |
| <DotNetCliToolReference Include="Microsoft.Extensions.SecretManager.Tools" Version="2.0.0" /> | |
| </ItemGroup> | |
| </Project> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "iisSettings": { | |
| "windowsAuthentication": false, | |
| "anonymousAuthentication": true, | |
| "iis": { | |
| "applicationUrl": "https://localhost:44301", | |
| "sslPort": 0 | |
| }, | |
| "iisExpress": { | |
| "applicationUrl": "http://localhost:44357/", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. | |
| public void Configure(IApplicationBuilder app, IHostingEnvironment env) | |
| { | |
| /* | |
| * to ensure redirection for HTTPS | |
| */ | |
| var options = new RewriteOptions() | |
| .AddRedirect("redirect-rule/(.*)", "redirected/$1") | |
| .AddRewrite(@"^rewrite-rule/(\d+)/(\d+)", | |
| "rewritten?var1=$1&var2=$2", skipRemainingRules: true); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public void ConfigureServices(IServiceCollection services) | |
| { | |
| // use HTTPS for everything, we've gone secure like a bank (allegedly) | |
| services.Configure<MvcOptions>(options => | |
| { | |
| options.Filters.Add(new RequireHttpsAttribute()); | |
| }); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| "Certificates": { | |
| "HTTPS": { | |
| "Source": "Store", | |
| "StoreLocation": "LocalMachine", | |
| "StoreName": "My", | |
| "Subject": "CN=localhost", | |
| "AllowInvalid": true | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $cert = New-SelfSignedCertificate -Subject localhost -DnsName localhost -FriendlyName "ASP.NET Core Development" -KeyUsage DigitalSignature -TextExtension @("2.5.29.37={text}1.3.6.1.5.5.7.3.1") | |
| Export-Certificate -Cert $cert -FilePath cert.cer | |
| Import-Certificate -FilePath cert.cer -CertStoreLocation cert:/CurrentUser/Root |
NewerOlder