forked from Soluto/oidc-server-mock
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add usecors to allow setting of allowed origins
Add correct auth header on revocation request
- Loading branch information
nielses
committed
Mar 21, 2023
1 parent
9b6f2f9
commit f5016b5
Showing
2 changed files
with
38 additions
and
1 deletion.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
using Duende.IdentityServer.Extensions; | ||
using Duende.IdentityServer.Configuration; | ||
|
||
#pragma warning disable 1591 | ||
|
||
namespace OpenIdConnectServer.Middlewares | ||
{ | ||
public class BaseAuthMiddleWare | ||
{ | ||
private readonly RequestDelegate _next; | ||
private readonly IdentityServerOptions _options; | ||
|
||
public BaseAuthMiddleWare(RequestDelegate next, IdentityServerOptions options) | ||
{ | ||
_next = next; | ||
_options = options; | ||
} | ||
|
||
public async Task Invoke(HttpContext context) | ||
{ | ||
if(context.Request.Path.Value.Contains("revocation")){ | ||
var plainTextBytes = System.Text.Encoding.UTF8.GetBytes("mock-client-id:mock-client-secret"); | ||
var base64Encoded = System.Convert.ToBase64String(plainTextBytes); | ||
context.Response.Headers.Add("Authorization", "Basic " + base64Encoded); | ||
context.Request.Headers["Authorization"] = "Basic " + base64Encoded; | ||
} | ||
await _next(context); | ||
} | ||
} | ||
} |
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