将 Apache Oltu 与 Google OpenID Connect 结合使用时如何检索 OpenID 2.0 标识符 (openid_id)

How do I retrieve OpenID 2.0 identifier (openid_id) when using Apache Oltu with Google OpenID Connect

将 Apache Oltu 与 Google OpenID Connect 结合使用时,如何检索 OpenID 2.0 标识符 (openid_id)。

这是我正在使用的授权请求:

OAuthClientRequest oltu_request = OAuthClientRequest.authorizationProvider(OAuthProviderType.GOOGLE)
                                        .setClientId(CLIENT_ID)
                                        .setResponseType(OAuth.OAUTH_CODE)
                                        .setParameter("access_type", "offline")
                                        .setScope("https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email")
                                        .setRedirectURI("https://app.com/sso_return")
                                        .buildQueryMessage();

使用额外的:

.setParameter("openid.realm", "<realm>")

并且 OpenID 2.0 标识符将在 ID 令牌的 openid_id 声明中返回。参见:https://developers.google.com/accounts/docs/OpenID#openid-connect