Base solution for your next web application

Activities of "elcinasyali"

Hi, I have tried it also but I got the same problem. Our keycloak server works on http, do you think it is a problem?

I have added the following code into AuthConfigure:

           authenticationBuilder.AddOpenIdConnect(options =>
            {
                options.ClientId = configuration["Authentication:OpenId:ClientId"];
                options.Authority = configuration["Authentication:OpenId:Authority"];
                options.SignedOutRedirectUri = configuration["App:ServerRootAddress"] + "Account/Logout";
                options.ResponseType = OpenIdConnectResponseType.IdToken;
                options.RequireHttpsMetadata = false;
                options.MetadataAddress = new Uri(new Uri(options.Authority), ".well-known/openid-configuration").ToString();

                options.TokenValidationParameters = new TokenValidationParameters()
                {
                    ValidateIssuer = bool.Parse(configuration["Authentication:OpenId:ValidateIssuer"])
               };

                options.Events.OnTokenValidated = context =>
                {
                    var jsonClaimMappings = new List<JsonClaimMap>();
                    configuration.GetSection("Authentication:OpenId:ClaimsMapping").Bind(jsonClaimMappings);

                    context.AddMappedClaims(jsonClaimMappings);

                    return Task.FromResult(0);
                };

               var clientSecret = configuration["Authentication:OpenId:ClientSecret"];
                if (!clientSecret.IsNullOrEmpty())
                {
                    options.ClientSecret = clientSecret;
                }
            });

Any advice ? Thanks.

Showing 1 to 1 of 1 entries