Skip to content

Commit ff62d77

Browse files
committed
extensions rename
1 parent 2ae70ed commit ff62d77

File tree

5 files changed

+9
-8
lines changed

5 files changed

+9
-8
lines changed

samples/ApiClient/Startup.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public void ConfigureServices(IServiceCollection services)
2929
options.SaveToken = true;
3030

3131
// API Authenticator Endpoint
32-
options.SetJwksOptions(new JwkOptions("https://localhost:5005/jwks"));
32+
options.SetJwksOptions(new JwkOptions(Configuration["JwksUri"]));
3333
});
3434
}
3535

samples/ApiClient/appsettings.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,6 @@
66
"Microsoft.Hosting.Lifetime": "Information"
77
}
88
},
9-
"AllowedHosts": "*"
9+
"AllowedHosts": "*",
10+
"JwksUri": "https://localhost:5005/jwks"
1011
}

src/NetDevPack.JwtExtensions/JwkOptions.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,24 +7,24 @@ public class JwkOptions
77
public JwkOptions(string jwksUri)
88
{
99
JwksUri = new Uri(jwksUri);
10-
Issuer = new Uri($"{JwksUri.Scheme}://{JwksUri.Authority}");
10+
Issuer = $"{JwksUri.Scheme}://{JwksUri.Authority}";
1111
KeepFor = TimeSpan.FromMinutes(15);
1212
}
1313

1414
public JwkOptions(string jwksUri, TimeSpan cacheTime)
1515
{
1616
JwksUri = new Uri(jwksUri);
17-
Issuer = new Uri($"{JwksUri.Scheme}://{JwksUri.Authority}");
17+
Issuer = $"{JwksUri.Scheme}://{JwksUri.Authority}";
1818
KeepFor = cacheTime;
1919
}
2020

2121
public JwkOptions(string jwksUri, string issuer, TimeSpan cacheTime)
2222
{
2323
JwksUri = new Uri(jwksUri);
24-
Issuer = new Uri(issuer);
24+
Issuer = issuer;
2525
KeepFor = cacheTime;
2626
}
27-
public Uri Issuer { get; private set; }
27+
public string Issuer { get; private set; }
2828
public Uri JwksUri { get; private set; }
2929
public TimeSpan KeepFor { get; private set; }
3030

src/NetDevPack.JwtExtensions/JwksExtension.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public static void SetJwksOptions(this JwtBearerOptions options, JwkOptions jwkO
1717
options.TokenValidationParameters.IssuerSigningKeyResolver = new JwkRetriever(jwkOptions).IssuerSigningKeyResolver;
1818

1919
options.TokenValidationParameters.ValidateAudience = false;
20-
options.TokenValidationParameters.ValidIssuer = jwkOptions.Issuer.OriginalString;
20+
options.TokenValidationParameters.ValidIssuer = jwkOptions.Issuer;
2121
}
2222
}
2323
}

tests/NetDevPack.JwtExtensions.Tests/Infra/Server.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public Server()
2727
.Configure(app =>
2828
{
2929
app.UseDeveloperExceptionPage();
30-
app.UseJwksManager();
30+
app.UseJwksDiscovery();
3131
app.Map(new PathString("/auth"), x => x.UseMiddleware<AuthMiddleware>());
3232

3333
})

0 commit comments

Comments
 (0)