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
| "Kestrel": { | |
| "EndPoints": { | |
| "Http": { | |
| "Url": "http://localhost:5000" | |
| }, | |
| "HttpsInlineCertFile": { | |
| "Url": "https://localhost:5001", | |
| "Protocols": "Http1AndHttp2", | |
| "Certificate": { | |
| "Path": "./certificate.pfx", |
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) | |
| { | |
| // ... | |
| services.AddHsts(options => | |
| { | |
| options.Preload = true; | |
| options.IncludeSubDomains = true; | |
| options.MaxAge = TimeSpan.FromDays(365); | |
| }); |
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) | |
| { | |
| if (!_env.IsDevelopment()) | |
| { | |
| services.AddHttpsRedirection(opts => { | |
| opts.RedirectStatusCode = StatusCodes.Status308PermanentRedirect; | |
| opts.HttpsPort = 44300; | |
| }); | |
| } | |
| else |
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
| [ApiController] | |
| [Route("api/[controller]")] | |
| [Produces("application/json")] | |
| [AllowAnonymous] | |
| [EnableCors(CORSPolicies.PublicApi)] | |
| public class PublicApiControllerBase : ControllerBase | |
| { | |
| [DisableCors] | |
| [HttpGet] | |
| public ActionResult<IEnumerable<string>> Get() |
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
| if (env.IsDevelopment()) | |
| { | |
| app.UseCors(CORSPolicies.DevAPI); | |
| } | |
| else | |
| { | |
| app.UseCors(CORSPolicies.PublicAPI); | |
| } |
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
| readonly string CORSPolicies.PublicAPI = "corspolicy.public"; | |
| readonly string CORSPolicies.DevAPI = "corspolicy.dev"; | |
| services.AddCors(options => | |
| { | |
| options.AddPolicy(CORSPolicies.PublicAPI, | |
| builder => builder | |
| .AllowAnyHeader() | |
| .WithMethods("POST", "GET") | |
| .WithOrigins("https://domain1.com", "https://domain2.com")); |
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
| services.AddSwaggerGen(c => | |
| { | |
| var apiinfo = new OpenApiInfo | |
| { | |
| Title = "theta-CandidateAPI", | |
| Version = "v1", | |
| Description = "Candidate API for thetalentbot", | |
| Contact = new OpenApiContact | |
| { Name = "thetalentbot", Url = new Uri("https://thetalentbot.com/developers/contact") }, | |
| License = new OpenApiLicense() |
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
| OpenApiSecurityScheme securityScheme = new OpenApiSecurityScheme() | |
| { | |
| Type = SecuritySchemeType.OAuth2, | |
| Flows = new OpenApiOAuthFlows | |
| { | |
| AuthorizationCode = new OpenApiOAuthFlow | |
| { | |
| AuthorizationUrl = new Uri("/auth-server/connect/authorize", UriKind.Relative), | |
| TokenUrl = new Uri("/auth-server/connect/token", UriKind.Relative), | |
| Scopes = new Dictionary<string, string> |
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
| ffdsgsdgkj |
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
| services.AddSwaggerGen(options => | |
| { | |
| var apiinfo = new OpenApiInfo | |
| { | |
| Title = "theta-CandidateAPI", | |
| Version = "v1", | |
| Description = "Candidate API for thetalentbot", | |
| Contact = new OpenApiContact | |
| { Name = "thetalentbot", Url = new Uri("https://thetalentbot.com/developers/contact") }, | |
| License = new OpenApiLicense() |