aspnet / AspNetKatana

Microsoft's OWIN implementation, the Katana project
Apache License 2.0
967 stars 334 forks source link

OpenIdConnect Get claims from user info endpoint #344

Closed laura-rodriguez closed 4 years ago

laura-rodriguez commented 4 years ago

Hi,

In ASP.NET Core, it's possible to configure GetClaimsFromUserInfoEndpoint to get additional claims from user info endpoint. Are you guys planning to implement this here?

Tratcher commented 4 years ago

No, we don't plan any additional feature expansion in this code base. You can fetch additional claims in the various events like SecurityTokenValidated.

analogrelay commented 4 years ago

Closing, as we don't plan to add this feature in Katana.

laura-rodriguez commented 4 years ago

Thanks for your prompt response @Tratcher . That was my intention, adding this logic in the SecurityTokenValidated event. However, I noticed this event is not being triggered after I changed my OIDC configuration to use the code flow. I can successfully subscribe to other events such as TokenResponseReceived or RedirectToIdentityProvider, but not SecurityTokenValidated. Am I missing something here? I'd appreciate any help. This is my configuration:

var oidcOptions = new OpenIdConnectAuthenticationOptions
            {
                ClientId = options.ClientId,
                ClientSecret = options.ClientSecret,
                Authority = issuer,
                RedirectUri = options.RedirectUri,
                ResponseType = OpenIdConnectResponseType.Code,
                RedeemCode = true,
                Scope = scopeString,
                PostLogoutRedirectUri = oktaMvcOptions.PostLogoutRedirectUri,
                TokenValidationParameters = tokenValidationParameters,
                SecurityTokenValidator = new StrictSecurityTokenValidator(),
                SaveTokens = true,
                Notifications = new OpenIdConnectAuthenticationNotifications
                {
                    SecurityTokenReceived = OnTokenReceivedAsync,
                    RedirectToIdentityProvider = notifications.RedirectToIdentityProvider,
                    TokenResponseReceived = OnTokenResponseReceivedAsync,
                    SecurityTokenValidated = OnTokenValidatedAsync,
                },
            };
laura-rodriguez commented 4 years ago

Disregard my previous question, I found the issue in my code. Thank you!