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 static string[] GetCanonicalizedHeaders(HttpRequestHeaders headers) | |
{ | |
return headers | |
.Where(p => p.Key.StartsWith("x-ms-", StringComparison.InvariantCultureIgnoreCase)) | |
.Select(p => new { Name = p.Key.ToLower(), Value = p.Value.First() }) | |
.OrderBy(p => p.Name) | |
.Select(p => string.Format("{0}:{1}", p.Name, p.Value)) | |
.ToArray(); | |
} |
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
(function(){ | |
var querystring = require('querystring'); | |
var url = require('url'); | |
var request = require('request'); | |
var http = require('http'); | |
var util = require('util'); | |
var child_process = require('child_process'); | |
var config = { |
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
[Fact] | |
public void First() | |
{ | |
var tokenHandler = new JWTSecurityTokenHandler(); | |
var symmetricKey = GetRandomBytes(256/8); | |
var now = DateTime.UtcNow; | |
var tokenDescriptor = new SecurityTokenDescriptor | |
{ | |
Subject = new ClaimsIdentity(new Claim[] |
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
using System; | |
using System.Collections.Generic; | |
using System.IO; | |
using System.Linq; | |
using System.Net; | |
using System.Text; | |
using System.Threading.Tasks; | |
namespace DownloadSslCert | |
{ |
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
using System; | |
using System.Collections.Concurrent; | |
using System.Collections.Generic; | |
using System.Diagnostics; | |
using System.IO; | |
using System.Linq; | |
using System.Net; | |
using System.Net.Http; | |
using System.Net.Http.Headers; | |
using System.ServiceModel; |
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
using System; | |
using System.Collections.Concurrent; | |
using System.Collections.Generic; | |
using System.Diagnostics; | |
using System.IO; | |
using System.Linq; | |
using System.Net; | |
using System.Net.Http; | |
using System.Net.Http.Headers; | |
using System.ServiceModel; |
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
[Fact] | |
public async Task Fact() | |
{ | |
var res = await Tester.Run( | |
config => | |
{ | |
config.Filters.Add(new BasicAuthenticationFilter("myrealm", _validator)); | |
}, | |
() => | |
{ |
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 class BasicAuthenticationFilterTests | |
{ | |
private Func<string, string, Task<IPrincipal>> _validator = (username, password) => | |
{ | |
var princ = username == password ? new ClaimsPrincipal(new GenericIdentity(username)) : null; | |
return Task.FromResult(princ as IPrincipal); | |
}; | |
[Fact] | |
public async Task Correctly_authenticated_request_has_a_valid_User() |
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
[Fact] | |
public async Task Fact() | |
{ | |
await OwinTester.Run( | |
useConfiguration: app => | |
{ | |
app.UseBasicAuthentication(Options); | |
}, | |
useRequest: () => | |
{ |
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
using System; | |
using System.Collections.Generic; | |
using System.IO; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
using Microsoft.Owin; | |
using Microsoft.Owin.Security; | |
using Microsoft.Owin.Security.Infrastructure; | |
using Owin; |