summaryrefslogtreecommitdiffabout
path: root/lib
authorMichael Krelin <hacker@klever.net>2007-12-02 23:06:54 (UTC)
committer Michael Krelin <hacker@klever.net>2007-12-02 23:06:54 (UTC)
commit60fdaff7888b455b4d07eadc905cefd20f1ddd3c (patch) (side-by-side diff)
treea7f7301abbc69401b8aa3b0f5f509552cb5e5ce9 /lib
parent262f1579f0a9138a01f06afea06d00155cefd4b5 (diff)
downloadlibopkele-60fdaff7888b455b4d07eadc905cefd20f1ddd3c.zip
libopkele-60fdaff7888b455b4d07eadc905cefd20f1ddd3c.tar.gz
libopkele-60fdaff7888b455b4d07eadc905cefd20f1ddd3c.tar.bz2
more robust discovery
if no service found in yadis document, but it is found in html, use html-discovered service. Signed-off-by: Michael Krelin <hacker@klever.net>
Diffstat (limited to 'lib') (more/less context) (ignore whitespace changes)
-rw-r--r--lib/openid_service_resolver.cc18
1 files changed, 11 insertions, 7 deletions
diff --git a/lib/openid_service_resolver.cc b/lib/openid_service_resolver.cc
index 5f82955..505e5b2 100644
--- a/lib/openid_service_resolver.cc
+++ b/lib/openid_service_resolver.cc
@@ -244,7 +244,6 @@ namespace opkele {
if(auth_info.canonical_id.empty()
|| auth_info.auth_SEP.xrd_Type.empty() )
throw opkele::failed_lookup(OPKELE_CP_ "no OpenID service for XRI found");
- return auth_info;
}else{
const char *np = nid.c_str();
if( (strncasecmp(np,"http",4) || strncmp(
@@ -271,7 +270,7 @@ namespace opkele {
if(xrds_location.empty()) {
if(auth_info.auth_SEP.xrd_Type.empty()) {
if(html_SEP.xrd_URI.empty())
- throw opkele::failed_lookup(OPKELE_CP_ "no OpenID service discovered");
+ throw opkele::failed_lookup(OPKELE_CP_ "no OpenID 1.0 service discovered");
auth_info.auth_SEP = html_SEP;
auth_info.auth_SEP.xrd_Type.clear(); auth_info.auth_SEP.xrd_Type.insert( STURI_OPENID10 );
auth_info.canonical_id = canonicalized_id;
@@ -279,16 +278,21 @@ namespace opkele {
if(auth_info.canonical_id.empty())
auth_info.canonical_id = canonicalized_id;
}
- return auth_info;
}else{
discover_service(xrds_location);
- if(auth_info.auth_SEP.xrd_Type.empty())
- throw opkele::failed_lookup(OPKELE_CP_ "no OpenID service found in Yadis document");
- if(auth_info.canonical_id.empty())
+ if(auth_info.auth_SEP.xrd_Type.empty()) {
+ if(html_SEP.xrd_URI.empty())
+ throw opkele::failed_lookup(OPKELE_CP_ "no OpenID 1.0 service discovered");
+ auth_info.auth_SEP = html_SEP;
+ auth_info.auth_SEP.xrd_Type.clear(); auth_info.auth_SEP.xrd_Type.insert( STURI_OPENID10 );
auth_info.canonical_id = canonicalized_id;
- return auth_info;
+ }else{
+ if(auth_info.canonical_id.empty())
+ auth_info.canonical_id = canonicalized_id;
+ }
}
}
+ return auth_info;
}
}