In your scenario, yes you will need to update your Microsoft.IdentityModel.Tokens.Saml and Microsoft.IdentityModel.Xml assemblies to match your version 5.2.4
This of course means you need to ensure Sitecore.IdentityServer.Host.deps.json is synced to reflect your updated assembly versions.
Please test and verify this works. If not, there is probably more ...
You can access IdToken in SecurityTokenValidated or OnRedirectToIdentityProvider event within your ConfigureServices OWIN pipeline.
You may need to persist this IdToken in say Redis to access it elsewhere in your business logic.
We have examples of how this has been done, such as in this post and this one
Sample ConfigureServices snippet, original code on ...
In the AddOpenIdConnect function set options.SaveTokens = true; then you can retrieve the token in the OnRedirectToIdentityProviderForSignOut handler using the GetTokenAsync extension method from the Microsoft.AspNetCore.Authentication namespace.
options.Events.OnRedirectToIdentityProviderForSignOut += (Func<RedirectContext, Task>)(async context =>
I ran into the same issue and resolved it by storing the IdToken in a persistent storage so it can be retrieved later during logout. In our case it is in Redis and we used the same approach as my answer here, but this can obviously be different depending on your solution. I'm assuming you have access to IdToken in SecurityTokenValidated event?
I have working code I have used with IdentityServer4 that I believe should work with Okta.
The full solution is available on my repo here.
public void ConfigureServices(IServiceCollection services)
Ids4DemoIdentityProvider identityProvider = this._appSettings.Ids4DemoIdentityProvider;
Integrating the SusyemSys.Saml2 into the identity server has some challenges. I ran into these same issues, but eventually got around them with some pain. Of course, there is a chance I some of the changes I made below could use some improvement, especially with respect to the updated dependencies.
You do need to include updated versions of Microsoft....
I had the identity server disabled by breaking the url to the identity server in the config file Sitecore.Owin.Authentication.IdentityServer.config. My fix was to enable to config file Sitecore.Owin.Authentication.IdentityServer.Disabler.config.example (just remove the example). This completely disables the identity server and allow federated auth load right....