моего URL @ разработка: http://192.168.0.1:8888/com.company.MyEntryPoint/MyEntrypoint.html моего URL @ жить окр: http://www.example.com/com.company.MyEntryPoint/MyEntrypoint.htmlкак задать открытую область ID в openid4java 0.9.5
мне нужно пользователи проверки подлинности с помощью Open 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"
);
Это не решает мою проблему, а скорее усложняет его :)
Согласно google и open id spec он должен был работать
полный код фрагмента:
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);
}
Что я здесь делаю неправильно?
http://code.google.com/p/openid4java/source/browse/trunk/src/org/openid4java/server/RealmVerifier.java?r=631#164 update, если (realmUrl.getAuthority(). startsWith ("*.")) realm = realm.replaceFirst ("\\ * \\.", "www."); –