This file contains 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 Random random = new Random(); | |
public static string RandomString(int length) | |
{ | |
const string chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; | |
return new string(Enumerable.Repeat(chars, length) | |
.Select(s => s[random.Next(s.Length)]).ToArray()); | |
} |
This file contains 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
DECLARE @ApiResourceId INT; | |
DECLARE @ClientId INT = 6; -- here is your client api which will use local api | |
-- add api resource for your local api | |
INSERT [dbo].[ApiResources] ([Enabled], [Name], [DisplayName], [Created], [NonEditable]) | |
VALUES (1, 'apiAuth', 'Auth API', GETDATE(), 0) | |
SET @ApiResourceId = SCOPE_IDENTITY() | |
-- insert api scope |
This file contains 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
/// <summary> | |
/// Mostly Taken from https://docs.microsoft.com/en-us/dotnet/api/system.net.httprequestheader and wikipedia | |
/// </summary> | |
public static class HttpRequestHeaderNames | |
{ | |
/// <summary> | |
/// The Accept header, which specifies the MIME types that are acceptable for the response. | |
/// </summary> | |
public static string Accept => "Accept"; |