2011-11-29 2 views
2

OpenID와 OAuth를 별도로 사용하여 성공했지만 함께 사용할 수는 없습니다.왜 Google 응답에 openid4java를 사용하는 OAuth request_token이 누락 되었습니까?

나는 잘못된 것을하고 있습니까 :

String userSuppliedString = "https://www.google.com/accounts/o8/id"; 
ConsumerManager manager = new ConsumerManager(); 
String returnToUrl = "http://example.com:8080/app-test-1.0-SNAPSHOT/GAuthorize"; 
List<DiscoveryInformation> discoveries = manager.discover(userSuppliedString);   
DiscoveryInformation discovered = manager.associate(discoveries);    
AuthRequest authReq = manager.authenticate(discovered, returnToUrl); 
session.put("openID-discoveries", discovered); 
FetchRequest fetch = FetchRequest.createFetchRequest(); 
fetch.addAttribute("email","http://schema.openid.net/contact/email",true);                 
fetch.addAttribute("oauth", "http://specs.openid.net/extensions/oauth/1.0",true); 
fetch.addAttribute("consumer","example.com" ,true); 
fetch.addAttribute("scope","http://www.google.com/calendar/feeds/" ,true); 
authReq.addExtension(fetch);    
destinationUrl = authReq.getDestinationUrl(true); 

다음 DESTINATIONURL이

https://www.google.com/accounts/o8/ud?openid.ns=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0&openid.claimed_id=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0%2Fidentifier_select&openid.identity=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0%2Fidentifier_select&openid.return_to=http%3A%2F%2Fexample.com%3A8080%2FgoogleTest%2Fauthorize&openid.realm=http%3A%2F%2Fexample.com%3A8080%2FgoogleTest%2Fauthorize&openid.assoc_handle=AMlYA9WVkS_oVNWtczp3zr3sS8lxR4DlnDS0fe-zMIhmepQsByLqvGnc8qeJwypiRQAuQvdw&openid.mode=checkid_setup&openid.ns.ext1=http%3A%2F%2Fopenid.net%2Fsrv%2Fax%2F1.0&openid.ext1.mode=fetch_request&openid.ext1.type.email=http%3A%2F%2Fschema.openid.net%2Fcontact%2Femail&openid.ext1.type.oauth=http%3A%2F%2Fspecs.openid.net%2Fextensions%2Foauth%2F1.0&openid.ext1.type.consumer=example.com&openid.ext1.type.scope=http%3A%2F%2Fwww.google.com%2Fcalendar%2Ffeeds%2F&openid.ext1.required=email%2Coauth%2Cconsumer%2Cscope "

입니다하지만 구글 request_token에서 응답이 없습니다

http://example.com:8080/googleTest/authorize?openid.ns=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0&openid.mode=id_res&openid.op_endpoint=https%3A%2F%2Fwww.google.com%2Faccounts%2Fo8%2Fud&openid.response_nonce=2011-11-29T17%3A38%3A39ZEU2iBVXr_zQG5Q&openid.return_to=http%3A%2F%2Fexample.com%3A8080%2FgoogleTest%2Fauthorize&openid.assoc_handle=AMlYA9WVkS_oVNWtczp3zr3sS8lxR4DlnDS0fe-zMIhmepQsByLqvGnc8qeJwypiRQAuQvdw&openid.signed=op_endpoint%2Cclaimed_id%2Cidentity%2Creturn_to%2Cresponse_nonce%2Cassoc_handle%2Cns.ext1%2Cext1.mode%2Cext1.type.email%2Cext1.value.email&openid.sig=5jUnS1jT16hIDCAjv%2BwAL1jopo6YHgfZ3nUUgFpeXlw%3D&openid.identity=https%3A%2F%2Fwww.google.com%2Faccounts%2Fo8%2Fid%3Fid%3DAItOawk8YPjBcnQrqXW8tzK3aFVop63E7q-JrCE&openid.claimed_id=https%3A%2F%2Fwww.google.com%2Faccounts%2Fo8%2Fid%3Fid%3DAItOawk8YPjBcnQrqXW8tzK3aFVop63E7q-JrCE&openid.ns.ext1=http%3A%2F%2Fopenid.net%2Fsrv%2Fax%2F1.0&openid.ext1.mode=fetch_response&openid.ext1.type.email=http%3A%2F%2Fschema.openid.net%2Fcontact%2Femail&openid.ext1.value.email=example%40gmail.com

왜?

답변

1

위의 코드에서 OAuth 확장 매개 변수에 특성 Exchange 확장 매개 변수를 추가했습니다. 하지만 OAuth와 Attribute Exchange는 서로 다른 확장이므로 OAuth 매개 변수에 대해 다른 확장 메시지를 만든 다음 인증 요청 메시지에 추가해야합니다.

그러나 OAuth 매개 변수를 인증 메시지에 추가 할 수있는 메커니즘이 없으므로 이러한 메커니즘을 만들어야합니다. 다음 링크에 대한 정보를 얻을 수 있습니다 http://code.google.com/p/openid4java/wiki/ExtensionHowTo

, 내가 찾으려고 것이다 그런 다음이 메커니즘 http://code.google.com/p/openid4java/issues/detail?id=110&q=oauth

+0

당신에게 그가 대답을 주셔서 감사 하드 코드는 아래의 링크에서 제공하는 코드를 사용할 수 있습니다 내가 사용하고 있던 코드가 당신의 제안에 한 발을 내 웠습니다. – user454322

관련 문제