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

Commit fb9ffdd

Browse files
committed
Fix the incorrect jti handling in the introspection middleware
1 parent add08fb commit fb9ffdd

File tree

4 files changed

+10
-2
lines changed

4 files changed

+10
-2
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ protected virtual async Task<AuthenticationTicket> CreateTicketAsync(string toke
288288

289289
// Add the token identifier as a property on the authentication ticket.
290290
case OAuthIntrospectionConstants.Claims.JwtId: {
291-
properties.Items[OAuthIntrospectionConstants.Properties.TicketId] = property.Value<string>();
291+
properties.Items[OAuthIntrospectionConstants.Properties.TicketId] = (string) property;
292292

293293
continue;
294294
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ protected virtual async Task<AuthenticationTicket> CreateTicketAsync(string toke
278278

279279
// Add the token identifier as a property on the authentication ticket.
280280
case OAuthIntrospectionConstants.Claims.JwtId: {
281-
properties.Dictionary[OAuthIntrospectionConstants.Properties.TicketId] = property.Value<string>();
281+
properties.Dictionary[OAuthIntrospectionConstants.Properties.TicketId] = (string) property;
282282

283283
continue;
284284
}

test/AspNet.Security.OAuth.Introspection.Tests/OAuthIntrospectionMiddlewareTests.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -708,13 +708,15 @@ private static TestServer CreateAuthorizationServer() {
708708

709709
case "valid-token": {
710710
payload[OAuthIntrospectionConstants.Claims.Active] = true;
711+
payload[OAuthIntrospectionConstants.Claims.JwtId] = "jwt-token-identifier";
711712
payload[OAuthIntrospectionConstants.Claims.Subject] = "Fabrikam";
712713

713714
break;
714715
}
715716

716717
case "valid-token-with-scopes": {
717718
payload[OAuthIntrospectionConstants.Claims.Active] = true;
719+
payload[OAuthIntrospectionConstants.Claims.JwtId] = "jwt-token-identifier";
718720
payload[OAuthIntrospectionConstants.Claims.Subject] = "Fabrikam";
719721
payload[OAuthIntrospectionConstants.Claims.Scope] =
720722
"C54A8F5E-0387-43F4-BA43-FD4B50DC190D 5C57E3BD-9EFB-4224-9AB8-C8C5E009FFD7";
@@ -724,6 +726,7 @@ private static TestServer CreateAuthorizationServer() {
724726

725727
case "valid-token-with-single-audience": {
726728
payload[OAuthIntrospectionConstants.Claims.Active] = true;
729+
payload[OAuthIntrospectionConstants.Claims.JwtId] = "jwt-token-identifier";
727730
payload[OAuthIntrospectionConstants.Claims.Subject] = "Fabrikam";
728731
payload[OAuthIntrospectionConstants.Claims.Audience] = "http://www.google.com/";
729732

@@ -732,6 +735,7 @@ private static TestServer CreateAuthorizationServer() {
732735

733736
case "valid-token-with-multiple-audiences": {
734737
payload[OAuthIntrospectionConstants.Claims.Active] = true;
738+
payload[OAuthIntrospectionConstants.Claims.JwtId] = "jwt-token-identifier";
735739
payload[OAuthIntrospectionConstants.Claims.Subject] = "Fabrikam";
736740
payload[OAuthIntrospectionConstants.Claims.Audience] = JArray.FromObject(new[] {
737741
"http://www.google.com/", "http://www.fabrikam.com/"

test/Owin.Security.OAuth.Introspection.Tests/OAuthIntrospectionMiddlewareTests.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -670,13 +670,15 @@ private static TestServer CreateAuthorizationServer() {
670670

671671
case "valid-token": {
672672
payload[OAuthIntrospectionConstants.Claims.Active] = true;
673+
payload[OAuthIntrospectionConstants.Claims.JwtId] = "jwt-token-identifier";
673674
payload[OAuthIntrospectionConstants.Claims.Subject] = "Fabrikam";
674675

675676
break;
676677
}
677678

678679
case "valid-token-with-scopes": {
679680
payload[OAuthIntrospectionConstants.Claims.Active] = true;
681+
payload[OAuthIntrospectionConstants.Claims.JwtId] = "jwt-token-identifier";
680682
payload[OAuthIntrospectionConstants.Claims.Subject] = "Fabrikam";
681683
payload[OAuthIntrospectionConstants.Claims.Scope] =
682684
"C54A8F5E-0387-43F4-BA43-FD4B50DC190D 5C57E3BD-9EFB-4224-9AB8-C8C5E009FFD7";
@@ -686,6 +688,7 @@ private static TestServer CreateAuthorizationServer() {
686688

687689
case "valid-token-with-single-audience": {
688690
payload[OAuthIntrospectionConstants.Claims.Active] = true;
691+
payload[OAuthIntrospectionConstants.Claims.JwtId] = "jwt-token-identifier";
689692
payload[OAuthIntrospectionConstants.Claims.Subject] = "Fabrikam";
690693
payload[OAuthIntrospectionConstants.Claims.Audience] = "http://www.google.com/";
691694

@@ -694,6 +697,7 @@ private static TestServer CreateAuthorizationServer() {
694697

695698
case "valid-token-with-multiple-audiences": {
696699
payload[OAuthIntrospectionConstants.Claims.Active] = true;
700+
payload[OAuthIntrospectionConstants.Claims.JwtId] = "jwt-token-identifier";
697701
payload[OAuthIntrospectionConstants.Claims.Subject] = "Fabrikam";
698702
payload[OAuthIntrospectionConstants.Claims.Audience] = JArray.FromObject(new[] {
699703
"http://www.google.com/", "http://www.fabrikam.com/"

0 commit comments

Comments
 (0)