ax.pl -- Attribute Exchange library
This library can be used to create HTTP request parameters and analyse form-data for attribute exchange. Attribute exchange (AX) is used by OpenID and OAuth to fetch attributes for accounts, such as the real username or e-mail address.
- http_ax_attributes(+Spec, -HTTPAttributes) is det
- True when HTTPAttributes is a list of Name=Value pairs that can
be used with an HTTP request to query for the attributes Spec.
Spec is a list of elements
Alias(Value[, Options])
. Options include:- required
- The attribute is required. This is mutually exclusive
with
if_available
. - if_available
- Only provide the attribute if it is available. This is
mutually exclusive with
required
. This is the default. - url(+URL)
- Can be used to ovcerrule or extend the ax_alias/2.
- count(+Count)
- Maximum number of values to provide
For example:
?- http_ax_attributes([ nickname(Nick), email(Email, [required]) ], Params). Params = [ 'openid.ax.mode' = fetch_request, 'openid.ax.type.nickname' = 'http://axschema.org/namePerson/friendly', 'openid.ax.type.email' = 'http://axschema.org/contact/email', 'openid.ax.required' = email, 'openid.ax.if_available' = nickname ].
- ax_alias(?Alias, ?URL) is nondet[multifile]
- True when Alias is an alias name for the AX schema URL. This
predicate is defined as multifile.
Note that Google federated login only supports
email
,country
,language
,firstname
andlastname
. - ax_form_attributes(+Form, -Values) is det
- True if Values is a list Alias(Value) for each exchanged
attribute.
Note that we assume we get the same alias names as we used for requesting the data. Not sure whether this is true.