Go to File -> New Project And create a Web Project:
Select Web API
| #!/bin/bash | |
| # My script for provisioning a minecraft server | |
| # | |
| # wget -O - https://git.io/vrQol | bash | |
| sudo yum -y update | |
| # Download the default config file, update the user ID, and also add the -server switch which the MSM guys omitted\ | |
| sudo wget http://git.io/6eiCSg -O /etc/msm.conf |
| using Owin; | |
| using System; | |
| using System.Collections.Generic; | |
| using System.Linq; | |
| using System.Text; | |
| using System.Text.RegularExpressions; | |
| using System.Threading.Tasks; | |
| namespace Whatevs | |
| { |
In order to communicate to a web service that has OAuth authentication, one may use the following procedures. Note that this is only for server to server communication on a service account. This is not for making calls on behalf of a client. So scopes and claims are typically not relevant in this context.
Authentication happens in two steps:
| using System; | |
| using System.Collections.Generic; | |
| using System.IO; | |
| using System.Linq; | |
| using System.Text.RegularExpressions; | |
| namespace DataProcessorTemplate | |
| { | |
| /// <summary> | |
| /// Program that counts the number of lines in which each word occurs. |
| /** | |
| * returns a base64url based digest of a PEM file | |
| * @param {*} key | |
| */ | |
| function digestKey(key) { | |
| let meat = key.match(/^-{5}[A-Z ]+-{5}[\r\n]{1,2}([a-zA-Z0-9/+\r\n]+={0,3})[\r\n]{1,2}-{5}[A-Z ]+-{5}/)[1]; | |
| if (!meat) throw "unrecognized format"; | |
| meat = meat.replace(/[\r\n]{1,2}/g, ''); | |
| var buf = Buffer.from(meat, 'base64'); |
| Copyright 2017 Cillié Malan | |
| Permission is hereby granted, free of charge, to any person obtaining | |
| a copy of this software and associated documentation files (the | |
| "Software"), to deal in the Software without restriction, including | |
| without limitation the rights to use, copy, modify, merge, publish, | |
| distribute, sublicense, and/or sell copies of the Software, and to | |
| permit persons to whom the Software is furnished to do so, subject to | |
| the following conditions: |
| public class MyBackgroundService : BackgroundService | |
| { | |
| protected override async Task ExecuteAsync(CancellationToken stoppingToken) | |
| { | |
| // run until stoppingToken is cancelled??? | |
| } | |
| } |
| public class MyBackgroundService : BackgroundService | |
| { | |
| protected override async Task ExecuteAsync(CancellationToken stoppingToken) | |
| { | |
| // run until stoppingToken is cancelled??? | |
| } | |
| } |