My project overrides the built-in OidcLogoutActionBuilder with a custom implementation. Specifically, we override the getLogoutAction method for getting a RedirectionAction.
In the base method, the idToken JWT is retrieved in this line. It checks that currentProfile is an instance of OidcProfile before casting it.
val idToken = ((OidcProfile) currentProfile).getIdToken();
In our implementation, currentProfile is a CiviFormProfileData, which does not contain an ID token. We would now like to add the ID token to the LogoutRequest's params.
To do so, I tried using ProfileManager.getProfile(OidcProfile.class), but that turns out to return an empty Optional. I believe this indicates that the user isn't logged in.
Questions:
Is it really possible that the user isn't logged in at the moment that
OidcLogoutActionBuilder.getLogoutActionbegins executing? If so, how? That method appears to be initiating a logout, not called after a logout, though I might have misunderstood.Where is the currentProfile parameter coming from in
getLogoutAction? I alluded to the fact we useCiviFormProfileDataoverOidcProfilein our codebase, but I don't know how the framework is deciding what exactly to pass to this method.Is there a better, more robust way to get the ID token in our case than what I suggested earlier with
ProfileManager.getProfile?