2

私の URL @ 開発: http://192.168.0.1:8888/com.company.MyEntryPoint/MyEntrypoint.html 私の URL @ ライブ環境: http://www.example.com/com.company.MyEntryPoint/MyEntrypoint.html

オープン ID を使用してユーザーを認証する必要があります。これが自分のレルムを次のようにする方法です: *.company.MyEntryPoint

レルムを指定する簡単なコードを書きました。

AuthRequest authReq = 
    manager.authenticate(
        discovered,
        returnToUrl,
        "*.company.MyEntryPoint"
    );

それは動作しません。例外:

org.openid4java.message.MessageException: 0x301: Realm verification failed (2) for: *.company.MyEntryPoint
    at org.openid4java.message.AuthRequest.validate(AuthRequest.java:354)
    at org.openid4java.message.AuthRequest.createAuthRequest(AuthRequest.java:101)
    at org.openid4java.consumer.ConsumerManager.authenticate(ConsumerManager.java:1073)

私が試したすべての組み合わせのうち、不思議なことに、次のものが機能しました。

AuthRequest authReq = 
    manager.authenticate(
        discovered,
        returnToUrl,
        "http://localhost:8888/com.capgent.MyEntryPoint"
    );

これは私の問題を解決しませんが、むしろ複雑にします:)

グーグルオープンID仕様によると、それはうまくいったはずです

完全なコード スニペット:

List discoveries = manager.discover(clientUrl);
DiscoveryInformation discovered = manager.associate(discoveries);
AuthRequest authReq = manager.authenticate(discovered, returnToUrl,"*.company.MyEntryPoint");
FetchRequest fetch = FetchRequest.createFetchRequest();
fetch.addAttribute("email", "http://schema.openid.net/contact/email", true);
fetch.addAttribute("country", "http://axschema.org/contact/country/home", true);
fetch.addAttribute("firstname", "http://axschema.org/namePerson/first", true);
fetch.addAttribute("lastname", "http://axschema.org/namePerson/last", true);
fetch.addAttribute("language", "http://axschema.org/pref/language", true);
authReq.addExtension(fetch);
String returnStr;
if (!discovered.isVersion2())
{
    returnStr = authReq.getDestinationUrl(true);
}
else
{
    returnStr = authReq.getDestinationUrl(false);
}

ここで何が間違っているのですか?

4

1 に答える 1

0

returnStr = authReq.getDestinationUrl(false); => returnStr = authReq.getDestinationUrl( true );

于 2010-04-25T01:28:07.587 に答える