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.AddAuthorization(o => | |
{ | |
o.AddPolicy("GroupOfUsers", policy => policy.RequireClaim("groups", "3916f0cf-d728-48c4-b18b-e3a29e852c12", "5169a59e-a4c6-44c2-b6ec-dff6910fb2f4")); | |
}); | |
} |
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.AddAuthentication(AzureADDefaults.BearerAuthenticationScheme) | |
.AddAzureADBearer(options => Configuration.Bind("AzureAd", options)); | |
services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2); | |
services.AddCors(options => | |
{ | |
options.AddPolicy("AllowAllOrigins", builder => |
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
When you want to publish your app and using the Development configuration. | |
By default this loads Production. | |
Create an app service | |
Configure | |
- AppSettings | |
- Add | |
- Name = ASPNETCORE_ENVIRONMENT | |
- Value = Development |
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
When you use NodeServices for your project and need to install package make sure you add the following to your app service configuration. | |
Create an app service | |
Configure | |
- AppSettings | |
- Add | |
- Name = WEBSITE_NODE_DEFAULT_VERSION | |
- Value = 10.0.0 | |
- Save | |
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
[HttpGet] | |
[Route("/api/download/zip/{Code}")] | |
public async Task<IActionResult> Zip(string Code) | |
{ | |
byte[] bytes = null; | |
using (MemoryStream zipStream = new MemoryStream()) | |
{ | |
using (var zip = new ZipArchive(zipStream, ZipArchiveMode.Create, 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
private IAuthorizationService _AuthorizationService; | |
public HomeController(IAuthorizationService AuthorizationService) | |
{ | |
this._AuthorizationService = AuthorizationService; | |
} | |
[Authorize(Policy = "SecurityGroup")] | |
public async Task<IActionResult> About() | |
{ |
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
{ | |
"AzureAd": { | |
"Instance": "https://login.microsoftonline.com/", | |
"Domain": "Directory.onmicrosoft.com", | |
"TenantId": "Dictory ID", | |
"ClientId": "Application ID", | |
"CallbackPath": "/signin-oidc" | |
}, | |
// | |
} |
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
//https://docs.microsoft.com/en-us/aspnet/core/mvc/models/file-uploads | |
[HttpPost] | |
public void Post(int ItemId) | |
{ | |
var files = Request.Form.Files; | |
if (files.Count > 0) | |
{ | |
using (var client = new AmazonS3Client(_aws.AccessKey, _aws.SecretKey, Amazon.RegionEndpoint.EUWest2)) | |
{ |
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
// open ssh connection to your remote | |
ssh user@ip | |
// ssh tunnel for vnc | |
// screen share using 'localhost:15900' => 'remote:5900' | |
ssh -N -p 22 user@ip -L 127.0.0.1:15900:127.0.0.1:5900 -v | |
// ssh copy mac | |
// remote location eg. '~/desktop' | |
scp <local_file_location> user@ip:<remote_location> |
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
// load bash profile with permission | |
// write your lines and crtl+o to write - ctrl+x to exit | |
sudo nano ~/.bash_profile | |
// if bash profile does not exist | |
touch ~/.bash_profile | |
// refresh bash profile after adding alias, etc. | |
source ~/.bash_profile |