0

在过去的几周内,我们使用 Google 的 Oauth2 身份验证系统和 Apache Oltu 库的一套应用程序已经停止工作。

所有通过 Google 注册或登录的尝试都会遇到相同的错误:

Login/registration action failed: java.io.IOException: Attempted read from closed stream.

最近一切正常,在此期间我们没有对代码或应用程序进行任何更改。

Google 端是否发生了一些变化,导致所有这些请求都失败了?

我的 Google 开发者控制台似乎没有任何日志记录或信息。在我的应用程序中,日志条目表明尝试进行身份验证但未成功。

现在失败的代码,曾经成功的代码是:

            // obtain a AuthRequest message to be sent to the OpenID provider
        OAuthClientRequest oauthRequest = OAuthClientRequest
                .authorizationLocation(discovery.getAuthzEndpoint())
                .setClientId(Oauth2Util.getClientId())
                .setRedirectURI(responseURL)
                .setResponseType(ResponseType.CODE.toString())
                .setScope(GOOGLE_SCOPE)
                .setState(state)
                .buildQueryMessage();

        response.sendRedirect(oauthRequest.getLocationUri());

触发异常:

java.io.IOException: Attempted read from closed stream.

感激地收到所有建议

4

2 回答 2

0

Google 于 4 月 20 日停用了 OpenID 2.0。请参阅http://googledevelopers.blogspot.co.uk/2015/03/reminder-to-migrate-to-oauth-20-or.html

于 2015-05-12T00:50:54.550 回答
0

好的,我想我已经明白发生了什么。它与 OpenID 退休有关,但有些倾斜

在我的代码中:

OAuthClientRequest oauthRequest = OAuthClientRequest
  .authorizationLocation(discovery.getAuthzEndpoint())

正在使用一个内部“发现”模块,该模块试图以一种在关闭 OpenID 时已被弃用的方式获取信息

首选的 Oltu 方式似乎是

OAuthClientRequest oauthRequest = OAuthClientRequest
    .authorizationProvider(OAuthProviderType.GOOGLE)

哪个效果更好

rtm:https ://cwiki.apache.org/confluence/display/OLTU/OAuth+2.0+Client+Quickstart

于 2015-05-12T12:03:41.710 回答