ICustomAuthorizeRequestValidator is not called?

I am trying to use a method AddCustomAuthorizeRequestValidatorto validate user claims. I can't even get a breakpoint in the implementation ICustomAuthorizeRequestValidator. Am I missing something? My breakpoint

ConfigureServices Method Code:

services.AddMvc();

services.AddOptions();

services.AddTransient<ICustomAuthorizeRequestValidator, Saml2BearerValidator>();

services.AddIdentityServer()
    .AddTestUsers(Config.GetUsers())
    .AddConfigurationStore(builder =>
        builder.UseSqlServer(_settings.Value.ConnectionString, options =>
                options.MigrationsAssembly(migrationsAssembly)))
    .AddOperationalStore(builder =>
        builder.UseSqlServer(_settings.Value.ConnectionString, options =>
                options.MigrationsAssembly(migrationsAssembly)))
    .AddCustomAuthorizeRequestValidator<Saml2BearerValidator>()
    .AddSigningCredential(CertificateManager.GetFromStorage(
                _settings.Value.ServerCertificateThumb, _settings.Value.ServerCertificatePass));

    return services.ConfigureAutofacServicesProvider(_settings.Value.Abc_xacml_n3_diagnostic);
+11
source share
3 answers

Depending on how IdentityServer structures things, is it possible that this is related to where you add this call?

If IdentityServer creates a middleware pipeline directly from what you add, it may be processed before it reaches that point in the pipeline.

, .

0

GitHub IdentityServer4. DefaultCustomAuthorizeRequestValidator ( ICustomAuthorizeRequestValidator) ValidateAsync :

public Task ValidateAsync(CustomAuthorizeRequestValidationContext context)

:

public async Task ValidateAsync(CustomAuthorizeRequestValidationContext context)

, async?

, : D

0

. . CustomValidationGrant, : IExtensionGrantValidator where TUser : IdentityUser, new(), GrantType, "custom" startUp.cs services.AddIdentityServer() .AddExtensionGrantValidator<CustomValidationGrant >()

grantType .

- :

var discoveryClient = new DiscoveryClient("http://localhost:5000");
discoveryClient.Policy.RequireHttps = false;

var doc = await discoveryClient.GetAsync();

var parameters = new Dictionary<string, string>();

parameters.Add("scope", "MyScope");

parameters.Add("client_secret", "SomeSecret");

parameters.Add("UserName", "UserName");

parameters.Add("Password", "Password");


var tokenResponse = await client.RequestTokenAsync(new TokenRequest
{
       Address = tokenEndpoint,
       ClientId = "your client",
       GrantType = "custom",
       Parameters = parameters
});
0

All Articles