Skip to content
This repository was archived by the owner on Dec 24, 2020. It is now read-only.

Commit fe9d69e

Browse files
committed
Update the Data Protection purposes to force the validation middleware to reject access tokens serialized using the old properties format
1 parent fb3929b commit fe9d69e

4 files changed

Lines changed: 7 additions & 7 deletions

File tree

src/AspNet.Security.OAuth.Introspection/OAuthIntrospectionMiddleware.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public OAuthIntrospectionMiddleware(
4848
{
4949
var protector = Options.DataProtectionProvider.CreateProtector(
5050
nameof(OAuthIntrospectionMiddleware),
51-
Options.AuthenticationScheme, "Access_Token", "v1");
51+
nameof(Options.AccessTokenFormat), Options.AuthenticationScheme);
5252

5353
Options.AccessTokenFormat = new TicketDataFormat(protector);
5454
}

src/AspNet.Security.OAuth.Validation/OAuthValidationMiddleware.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ public OAuthValidationMiddleware(
3636

3737
if (Options.AccessTokenFormat == null)
3838
{
39-
// Note: the following purposes must match the values used by ASOS.
39+
// Note: the following purposes must match the ones used by the OpenID Connect server middleware.
4040
var protector = Options.DataProtectionProvider.CreateProtector(
41-
"OpenIdConnectServerMiddleware", "ASOS", "Access_Token", "v1");
41+
"OpenIdConnectServerMiddleware", nameof(Options.AccessTokenFormat), "ASOS");
4242

4343
Options.AccessTokenFormat = new TicketDataFormat(protector);
4444
}

src/Owin.Security.OAuth.Introspection/OAuthIntrospectionMiddleware.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public OAuthIntrospectionMiddleware(
5757
{
5858
var protector = Options.DataProtectionProvider.CreateProtector(
5959
nameof(OAuthIntrospectionMiddleware),
60-
Options.AuthenticationType, "Access_Token", "v1");
60+
nameof(Options.AccessTokenFormat), Options.AuthenticationType);
6161

6262
options.AccessTokenFormat = new AspNetTicketDataFormat(new DataProtectorShim(protector));
6363
}

src/Owin.Security.OAuth.Validation/OAuthValidationMiddleware.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@ public OAuthValidationMiddleware(
4646

4747
if (options.AccessTokenFormat == null)
4848
{
49-
// Note: the following purposes must match the ones used by ASOS.
50-
var protector = options.DataProtectionProvider.CreateProtector(
51-
"OpenIdConnectServerMiddleware", "ASOS", "Access_Token", "v1");
49+
// Note: the following purposes must match the ones used by the OpenID Connect server middleware.
50+
var protector = Options.DataProtectionProvider.CreateProtector(
51+
"OpenIdConnectServerMiddleware", nameof(Options.AccessTokenFormat), "ASOS");
5252

5353
options.AccessTokenFormat = new AspNetTicketDataFormat(new DataProtectorShim(protector));
5454
}

0 commit comments

Comments
 (0)