MCPcopy
hub / github.com/tornadoweb/tornado / _openid_args

Method _openid_args

tornado/auth.py:163–215  ·  view source on GitHub ↗
(
        self,
        callback_uri: str,
        ax_attrs: Iterable[str] = [],
        oauth_scope: Optional[str] = None,
    )

Source from the content-addressed store, hash-verified

161 return self._on_authentication_verified(resp)
162
163 def _openid_args(
164 self,
165 callback_uri: str,
166 ax_attrs: Iterable[str] = [],
167 oauth_scope: Optional[str] = None,
168 ) -> Dict[str, str]:
169 handler = cast(RequestHandler, self)
170 url = urllib.parse.urljoin(handler.request.full_url(), callback_uri)
171 args = {
172 "openid.ns": "http://specs.openid.net/auth/2.0",
173 "openid.claimed_id": "http://specs.openid.net/auth/2.0/identifier_select",
174 "openid.identity": "http://specs.openid.net/auth/2.0/identifier_select",
175 "openid.return_to": url,
176 "openid.realm": urllib.parse.urljoin(url, "/"),
177 "openid.mode": "checkid_setup",
178 }
179 if ax_attrs:
180 args.update(
181 {
182 "openid.ns.ax": "http://openid.net/srv/ax/1.0",
183 "openid.ax.mode": "fetch_request",
184 }
185 )
186 ax_attrs = set(ax_attrs)
187 required = [] # type: List[str]
188 if "name" in ax_attrs:
189 ax_attrs -= {"name", "firstname", "fullname", "lastname"}
190 required += ["firstname", "fullname", "lastname"]
191 args.update(
192 {
193 "openid.ax.type.firstname": "http://axschema.org/namePerson/first",
194 "openid.ax.type.fullname": "http://axschema.org/namePerson",
195 "openid.ax.type.lastname": "http://axschema.org/namePerson/last",
196 }
197 )
198 known_attrs = {
199 "email": "http://axschema.org/contact/email",
200 "language": "http://axschema.org/pref/language",
201 "username": "http://axschema.org/namePerson/friendly",
202 }
203 for name in ax_attrs:
204 args["openid.ax.type." + name] = known_attrs[name]
205 required.append(name)
206 args["openid.ax.required"] = ",".join(required)
207 if oauth_scope:
208 args.update(
209 {
210 "openid.ns.oauth": "http://specs.openid.net/extensions/oauth/1.0",
211 "openid.oauth.consumer": handler.request.host.split(":")[0],
212 "openid.oauth.scope": oauth_scope,
213 }
214 )
215 return args
216
217 def _on_authentication_verified(
218 self, response: httpclient.HTTPResponse

Callers 1

authenticate_redirectMethod · 0.95

Calls 4

full_urlMethod · 0.80
appendMethod · 0.80
joinMethod · 0.80
splitMethod · 0.80

Tested by

no test coverage detected