::: mermaid flowchart LR subgraph aca[Azure Container Apps] subgraph app[Value Wire App] blazorApp[Blazor App] end subgraph api[Value Wire Api] webApi[dotnet Web Api] end end
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://github.com/Azure/api-management-policy-snippets/blob/master/README.md |
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
<fragment> | |
<set-variable name="audClaim" value="@{ | |
var authHeader = context.Request.Headers.GetValueOrDefault("Authorization"); | |
if (!string.IsNullOrEmpty(authHeader)) { | |
var jwtToken = authHeader.AsJwt(); | |
if (jwtToken != null) { | |
var claim = jwtToken.Claims.GetValueOrDefault("aud"); | |
if (claim != null) { | |
return 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
<!-- | |
IMPORTANT: | |
- Policy fragment are included as-is whenever they are referenced. | |
- If using variables. Ensure they are setup before use. | |
- Copy and paste your code here or simply start coding | |
Commenting out the verify logic as it doesn't work with self-signed certificates | |
--> | |
<fragment> | |
<choose> |
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
<!-- | |
IMPORTANT: | |
- Policy fragment are included as-is whenever they are referenced. | |
- If using variables. Ensure they are setup before use. | |
- Copy and paste your code here or simply start coding | |
--> | |
<fragment> | |
<validate-jwt header-name="Authorization" failed-validation-httpcode="401" failed-validation-error-message="Unauthorized. AADB2C Access token is missing or invalid."> | |
<openid-config url="https://{{aadb2c-tenant-name}}.b2clogin.com/{{aadb2c-tenant-name}}.onmicrosoft.com/{{aadb2c-signin-signup-name}}/v2.0/.well-known/openid-configuration" /> | |
<audiences> |
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
<!-- | |
IMPORTANT: | |
- Policy fragment are included as-is whenever they are referenced. | |
- If using variables. Ensure they are setup before use. | |
- Copy and paste your code here or simply start coding | |
--> | |
<fragment> | |
<send-request mode="new" response-variable-name="introspectResponse" timeout="20" ignore-error="false"> | |
<set-url>{{PingAuthURI}}as/introspect</set-url> | |
<set-method>POST</set-method> |
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
<policies> | |
<inbound> | |
<base /> | |
<rewrite-uri template="/" /> | |
<cache-lookup-value key="sbToken" variable-name="cachedSasToken" /> | |
<choose> | |
<when condition="@(context.Variables.GetValueOrDefault<string>("cachedSasToken") == null)"> | |
<cache-store-value key="sbToken" value="@{ | |
string resourceUri = "<service-bus-url>"; | |
string keyName = "<access-policy-name>"; |
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
.parent { | |
position: relative; | |
} | |
.child { | |
width: 300px; | |
height: 100px; | |
padding: 20px; | |
position: absolute; |
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://stackoverflow.com/questions/506034/converting-user-entered-search-query-to-where-clause-for-use-in-sql-server-full/30409654#30409654 |
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
PdfDocument documentInput; | |
using (var stream = new MemoryStream(new WebClient().DownloadData(pdfUrl))) | |
{ | |
try | |
{ | |
documentInput = PdfReader.Open(stream, PdfDocumentOpenMode.Import); | |
} | |
catch (PdfReaderException ex) | |
{ | |
try |
NewerOlder