ConcreteCloud.IdentityServer4.AccessTokenValidation 0.3.0

IdentityServer4.AccessTokenValidation

Important

This library is deprecated and not being maintained anymore.

Read this blog post about the reasoning and recommedations for a superior and more flexible approach:

https://leastprivilege.com/2020/07/06/flexible-access-token-validation-in-asp-net-core/

Description

Authentication handler for ASP.NET Core 2 that allows accepting both JWTs and reference tokens in the same API.

Technically this handler is a decorator over both the Microsoft JWT handler as well as our OAuth 2 introspection handler. If you only need to support one token type only, we recommend using the underlying handlers directly.

JWT Usage

Simply specify authority and API name (aka audience):

services.AddAuthentication(IdentityServerAuthenticationDefaults.AuthenticationScheme)
    .AddIdentityServerAuthentication(options =>
    {
        options.Authority = "https://demo.identityserver.io";
        options.ApiName = "api1";
    });

Enable reference tokens

Additionally specify the API secret for the introspection endpoint:

services.AddAuthentication(IdentityServerAuthenticationDefaults.AuthenticationScheme)
    .AddIdentityServerAuthentication(options =>
    {
        options.Authority = "https://demo.identityserver.io";
        options.ApiName = "api1";
        options.ApiSecret = "secret";
    });

Specifying the underlying handler options directly

In case you need access to a setting that the combined options don't expose, you can fallback to configuring the underlying handler directly.

services.AddAuthentication(IdentityServerAuthenticationDefaults.AuthenticationScheme)
    .AddIdentityServerAuthentication(IdentityServerAuthenticationDefaults.AuthenticationScheme,
        jwtOptions =>
        {
            // jwt bearer options
        },
        referenceOptions =>
        {
            // oauth2 introspection options
        });

Scope validation

In addition to API name checking, you can do more fine-grained scope checks. This package includes some convenience helpers to do that.

Create a global authorization policy

services
    .AddMvcCore(options =>
    {
        // require scope1 or scope2
        var policy = ScopePolicy.Create("scope1", "scope2");
        options.Filters.Add(new AuthorizeFilter(policy));
    })
    .AddJsonFormatters()
    .AddAuthorization();

Composing a scope policy

services.AddAuthorization(options =>
{
    options.AddPolicy("myPolicy", builder =>
    {
        // require scope1
        builder.RequireScope("scope1");
        // and require scope2 or scope3
        builder.RequireScope("scope2", "scope3");
    });
});

Showing the top 20 packages that depend on ConcreteCloud.IdentityServer4.AccessTokenValidation.

Packages Downloads
ConcreteCloud.IdentityServer4.Extension
ConcreteCloud.IdentityServer4.Extension 基础类库项目
14
ConcreteCloud.IdentityServer4.Extension
ConcreteCloud.IdentityServer4.Extension 基础类库项目
13
ConcreteCloud.IdentityServer4.Extension
ConcreteCloud.IdentityServer4.Extension 基础类库项目
10
ConcreteCloud.IdentityServer4.Extension
ConcreteCloud.IdentityServer4.Extension 基础类库项目
8
ConcreteCloud.IdentityServer4.Extension
ConcreteCloud.IdentityServer4.Extension 基础类库项目
7
ConcreteCloud.IdentityServer4.Extension
ConcreteCloud.IdentityServer4.Extension 基础类库项目
6
ConcreteCloud.IdentityServer4.Extension
ConcreteCloud.IdentityServer4.Extension 基础类库项目
5
ConcreteCloud.IdentityServer4.Extension
ConcreteCloud.IdentityServer4.Extension 基础类库项目
4
ConcreteCloud.IdentityServer4.Extension
ConcreteCloud.IdentityServer4.Extension 基础类库项目
3
ConcreteCloud.IdentityServer4.Extension
ConcreteCloud.IdentityServer4.Extension 基础类库项目
2
ConcreteCloud.IdentityServer4.Extension
ConcreteCloud.IdentityServer4.Extension 基础类库项目
1

Version Downloads Last updated
0.3.0 2 11/02/2026
0.2.9 5 10/15/2026
0.2.8 6 09/24/2026
0.2.7 3 09/23/2026
0.2.6 1 09/23/2026
0.2.5 1 09/23/2026
0.2.4 5 07/20/2026
0.2.3 13 01/19/2026
0.2.2 1 01/19/2026
0.2.1 3 10/16/2025
0.2.0 12 06/19/2025
0.1.9 0 06/18/2025
0.1.8 1 06/17/2025
0.1.7 8 03/13/2025
0.1.6 9 12/13/2024
0.1.5 0 12/12/2024
0.1.4 1 12/12/2024
0.1.3 2 12/03/2024
0.1.2 9 11/11/2024
0.1.1 6 10/18/2024
0.1.0 6 10/12/2024
0.0.9 8 09/24/2024
0.0.8 7 09/24/2024
0.0.7 6 09/12/2024
0.0.6 1 09/12/2024
0.0.5 1 09/10/2024
0.0.4 2 09/04/2024
0.0.3 2 09/04/2024
0.0.2 1 09/03/2024
0.0.1 1 09/02/2024