2
NGP VAN's `ActionID` Provider
4
http://developers.ngpvan.com/action-id
6
from openid.extensions import ax
8
from .open_id import OpenIdAuth
11
class ActionIDOpenID(OpenIdAuth):
13
NGP VAN's ActionID OpenID 1.1 authentication backend
15
name = 'actionid-openid'
16
URL = 'https://accounts.ngpvan.com/Home/Xrds'
17
USERNAME_KEY = 'email'
19
def get_ax_attributes(self):
21
Return the AX attributes that ActionID responds with, as well as the
22
user data result that it must map to.
25
('http://openid.net/schema/contact/internet/email', 'email'),
26
('http://openid.net/schema/contact/phone/business', 'phone'),
27
('http://openid.net/schema/namePerson/first', 'first_name'),
28
('http://openid.net/schema/namePerson/last', 'last_name'),
29
('http://openid.net/schema/namePerson', 'fullname'),
32
def setup_request(self, params=None):
34
Setup the OpenID request
36
Because ActionID does not advertise the availiability of AX attributes
37
nor use standard attribute aliases, we need to setup the attributes
38
manually instead of rely on the parent OpenIdAuth.setup_request()
40
request = self.openid_request(params)
42
fetch_request = ax.FetchRequest()
43
fetch_request.add(ax.AttrInfo(
44
'http://openid.net/schema/contact/internet/email',
49
fetch_request.add(ax.AttrInfo(
50
'http://openid.net/schema/contact/phone/business',
54
fetch_request.add(ax.AttrInfo(
55
'http://openid.net/schema/namePerson/first',
56
alias='ngpvanfirstname',
59
fetch_request.add(ax.AttrInfo(
60
'http://openid.net/schema/namePerson/last',
61
alias='ngpvanlastname',
64
request.addExtension(fetch_request)