1Net::OpenID::Yadis(3) User Contributed Perl DocumentationNet::OpenID::Yadis(3)
2
3
4

NAME

6       Net::OpenID::Yadis - Perform Yadis discovery on URLs
7

VERSION

9       version 1.20
10

SYNOPSIS

12         use Net::OpenID::Yadis;
13
14         my $disc = Net::OpenID::Yadis->new(
15             consumer => $consumer, # Net::OpenID::Consumer object
16         );
17
18         my $xrd = $disc->discover("http://id.example.com/") or Carp::croak($disc->err);
19
20         print $disc->identity_url;       # Yadis URL (Final URL if redirected)
21         print $disc->xrd_url;            # Yadis Resourse Descriptor URL
22
23         foreach my $srv (@$xrd) {        # Loop for Each Service in Yadis Resourse Descriptor
24           print $srv->priority;          # Service priority (sorted)
25           print $srv->Type;              # Identifier of some version of some service (scalar, array or array ref)
26           print $srv->URI;               # URI that resolves to a resource providing the service (scalar, array or array ref)
27           print $srv->extra_field("Delegate","http://openid.net/xmlns/1.0");
28                                          # Extra field of some service
29         }
30
31         # If you are interested only in OpenID. (either 1.1 or 2.0)
32         my $xrd = $self->services(
33           'http://specs.openid.net/auth/2.0/signon',
34           'http://specs.openid.net/auth/2.0/server',
35           'http://openid.net/signon/1.1',
36         );
37
38         # If you want to choose random server by code-ref.
39         my $xrd = $self->services(sub{($_[int(rand(@_))])});
40

DESCRIPTION

42       This module provides an implementation of the Yadis protocol, which
43       does XRDS-based service discovery on URLs.
44
45       This module was originally developed by OHTSUKA Ko-hei as
46       Net::Yadis::Discovery, but was forked and simplified for inclusion in
47       the core OpenID Consumer package.
48
49       This simplified version is tailored for the needs of
50       Net::OpenID::Consumer; for other uses, Net::Yadis::Discovery is
51       probably a better choice.
52

CONSTRUCTOR

54       "new"
55           my $disc = Net::OpenID::Yadis->new([ %opts ]);
56
57           You can set the "consumer" in the constructor.  See the
58           corresponding method description below.
59

EXPORT

61       This module exports three constant values to use with discover method.
62
63       "YR_GET"
64           If you set this, module check Yadis URL start from HTTP GET
65           request. This is the default.
66
67       "YR_XRDS"
68           If you set this, this module consider Yadis URL as Yadis Resource
69           Descriptor URL.  If not so, an error is returned.
70

METHODS

72       $disc->consumer($consumer)
73       $disc->consumer
74           Get or set the Net::OpenID::Consumer object that this object is
75           associated with.
76
77       $disc->discover($url,[$request_method])
78           Given a user-entered $url (which could be missing http://, or have
79           extra whitespace, etc), returns either array/array ref of
80           Net::OpenID::Yadis::Service objects, or undef on failure.
81
82           $request_method is optional, and if set this, you can change the
83           HTTP request method of fetching Yadis URL.  See EXPORT to know the
84           value you can set, and default is YR_HEAD.
85
86           If this method returns undef, you can rely on the following errors
87           codes (from $csr->errcode) to decide what to present to the user:
88
89           xrd_parse_error
90           xrd_format_error
91           too_many_hops
92           no_yadis_document
93           url_fetch_err
94           empty_url
95           url_gone
96       $disc->xrd_objects
97           Returns array/array ref of Net::OpenID::Yadis objects.  It is same
98           what could be got by discover method.
99
100       $disc->identity_url
101           Returns Yadis URL.  If not redirected, it is same with the argument
102           of discover method.
103
104       $disc->xrd_url
105           Returns Yadis Resource Descriptor URL.
106
107       $disc->servers($protocol,$protocol,...)
108       $disc->servers($protocol=>[$version1,$version2],...)
109       $disc->servers($protocol,....,$code_ref);
110           Filter method of xrd_objects.
111
112           If no option is defined, returns same result with xrd_objects
113           method.
114
115           protocol names or Type URLs are given, filter only given protocol.
116           Two or more protocols are given, return and results of filtering.
117
118           Sample:
119             $disc->servers("openid","http://lid.netmesh.org/sso/1.0");
120
121           If reference of version numbers array is given after protocol
122           names, filter only given version of protocol.
123
124           Sample:
125             $disc->servers("openid"=>['1.0','1.1'],"lid"=>['1.0']);
126
127           If you want to use version numbers limitation with type URL, you
128           can use \ver as place holder of version number.
129
130           Sample:
131             $disc->servers("http://lid.netmesh.org/sso/\ver"=>['1.0','2.0']);
132
133           If code reference is given as argument , you can make your own
134           filter rule.  code reference is executed at the last of filtering
135           logic, like this:
136
137             @results = $code_ref->(@temporary_results)
138
139           Sample: If you want to filter OpenID server and get only first one:
140             ($openid_server) = $disc->servers("openid",sub{$_[0]});
141
142       $disc->err
143           Returns the last error, in form "errcode: errtext"
144
145       $disc->errcode
146           Returns the last error code.
147
148       $disc->errtext
149           Returns the last error text.
150
152       This module is Copyright (c) 2006 OHTSUKA Ko-hei.  All rights reserved.
153
154       You may distribute under the terms of either the GNU General Public
155       License or the Artistic License, as specified in the Perl README file.
156

WARRANTY

158       This is free software. IT COMES WITHOUT WARRANTY OF ANY KIND.
159

SEE ALSO

161       Yadis website:  <http://yadis.org/>
162
163       Net::OpenID::Yadis::Service
164
165       Net::OpenID::Consumer
166

AUTHORS

168       Based on Net::Yadis::Discovery by OHTSUKA Ko-hei <nene@kokogiko.net>
169
170       Martin Atkins <mart@degeneration.co.uk>
171
172
173
174perl v5.28.0                      2016-02-08             Net::OpenID::Yadis(3)
Impressum