update 0.0.14

This commit is contained in:
igeekfan
2023-07-20 01:15:12 +08:00
parent 76b34bc154
commit fb383e2c3c
10 changed files with 105 additions and 30 deletions

View File

@ -16,14 +16,16 @@ namespace OAuth2Integration.AuthServer
RedirectUris = new[] {
"http://localhost:55202/resource-server/swagger/oauth2-redirect.html", // IIS Express
"http://localhost:5000/resource-server/swagger/oauth2-redirect.html", // Kestrel
"http://localhost:5000/oauth/oauth2.html", // Kestrel
"http://localhost:8080/oauth/oauth2.html", // Kestrel
},
ClientSecrets = { new Secret("test-secret".Sha256()) },
RequireConsent = true,
AllowedGrantTypes = GrantTypes.Code,
RequirePkce = true,
AllowedScopes = new[] { "readAccess", "writeAccess" },
RequirePkce = false,
//AllowedScopes = new[] { "readAccess", "writeAccess" },
};
}

View File

@ -1,11 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="IdentityServer4" Version="4.1.2" />
<PackageReference Include="IdentityServer4" Version="3.0.1" />
<PackageReference Include="IdentityServer4.AccessTokenValidation" Version="3.0.1" />
<PackageReference Include="NCaptcha.AspNetCore.SessionImages" Version="0.1.0" />
<PackageReference Include="Swashbuckle.AspNetCore.Swagger" Version="6.4.0" />

View File

@ -60,24 +60,24 @@ namespace OAuth2Integration
{
c.SwaggerDoc("v1", new OpenApiInfo { Version = "v1", Title = "Test API V1" });
// Define the OAuth2.0 scheme that's in use (i.e. Implicit Flow)
c.AddSecurityDefinition("oauth2", new OpenApiSecurityScheme
{
Type = SecuritySchemeType.OAuth2,
Flows = new OpenApiOAuthFlows
{
AuthorizationCode = new OpenApiOAuthFlow
{
AuthorizationUrl = new Uri("/auth-server/connect/authorize", UriKind.Relative),
TokenUrl = new Uri("/auth-server/connect/token", UriKind.Relative),
Scopes = new Dictionary<string, string>
{
{ "readAccess", "Access read operations" },
{ "writeAccess", "Access write operations" }
}
}
}
});
//// Define the OAuth2.0 scheme that's in use (i.e. Implicit Flow)
//c.AddSecurityDefinition("oauth2", new OpenApiSecurityScheme
//{
// Type = SecuritySchemeType.OAuth2,
// Flows = new OpenApiOAuthFlows
// {
// AuthorizationCode = new OpenApiOAuthFlow
// {
// AuthorizationUrl = new Uri("/auth-server/connect/authorize", UriKind.Relative),
// TokenUrl = new Uri("/auth-server/connect/token", UriKind.Relative),
// Scopes = new Dictionary<string, string>
// {
// { "readAccess", "Access read operations" },
// { "writeAccess", "Access write operations" }
// }
// }
// }
//});
c.CustomOperationIds(apiDesc =>
{