forked from google/gdata-python-client
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathatom.token_store.html
More file actions
119 lines (107 loc) · 8.32 KB
/
atom.token_store.html
File metadata and controls
119 lines (107 loc) · 8.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><title>Python: module atom.token_store</title>
</head><body bgcolor="#f0f0f8">
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading">
<tr bgcolor="#7799ee">
<td valign=bottom> <br>
<font color="#ffffff" face="helvetica, arial"> <br><big><big><strong><a href="atom.html"><font color="#ffffff">atom</font></a>.token_store</strong></big></big></font></td
><td align=right valign=bottom
><font color="#ffffff" face="helvetica, arial"><a href=".">index</a><br><a href="file:/usr/local/google/home/afshar/src/external-gdata-release/google3/src/atom/token_store.py">/usr/local/google/home/afshar/src/external-gdata-release/google3/src/atom/token_store.py</a></font></td></tr></table>
<p><tt>This module provides a <a href="#TokenStore">TokenStore</a> class which is designed to manage<br>
auth tokens required for different services.<br>
<br>
Each token is valid for a set of scopes which is the start of a URL. An HTTP<br>
client will use a token store to find a valid Authorization header to send<br>
in requests to the specified URL. If the HTTP client determines that a token<br>
has expired or been revoked, it can remove the token from the store so that<br>
it will not be used in future requests.</tt></p>
<p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#aa55cc">
<td colspan=3 valign=bottom> <br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Modules</strong></big></font></td></tr>
<tr><td bgcolor="#aa55cc"><tt> </tt></td><td> </td>
<td width="100%"><table width="100%" summary="list"><tr><td width="25%" valign=top><a href="atom.html">atom</a><br>
</td><td width="25%" valign=top></td><td width="25%" valign=top></td><td width="25%" valign=top></td></tr></table></td></tr></table><p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ee77aa">
<td colspan=3 valign=bottom> <br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Classes</strong></big></font></td></tr>
<tr><td bgcolor="#ee77aa"><tt> </tt></td><td> </td>
<td width="100%"><dl>
<dt><font face="helvetica, arial"><a href="__builtin__.html#object">__builtin__.object</a>
</font></dt><dd>
<dl>
<dt><font face="helvetica, arial"><a href="atom.token_store.html#TokenStore">TokenStore</a>
</font></dt></dl>
</dd>
</dl>
<p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ffc8d8">
<td colspan=3 valign=bottom> <br>
<font color="#000000" face="helvetica, arial"><a name="TokenStore">class <strong>TokenStore</strong></a>(<a href="__builtin__.html#object">__builtin__.object</a>)</font></td></tr>
<tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td>
<td colspan=2><tt>Manages Authorization tokens which will be sent in HTTP headers.<br> </tt></td></tr>
<tr><td> </td>
<td width="100%">Methods defined here:<br>
<dl><dt><a name="TokenStore-__init__"><strong>__init__</strong></a>(self, scoped_tokens<font color="#909090">=None</font>)</dt></dl>
<dl><dt><a name="TokenStore-add_token"><strong>add_token</strong></a>(self, token)</dt><dd><tt>Adds a new token to the store (replaces tokens with the same scope).<br>
<br>
Args:<br>
token: A subclass of http_interface.GenericToken. The token <a href="__builtin__.html#object">object</a> is <br>
responsible for adding the Authorization header to the HTTP request.<br>
The scopes defined in the token are used to determine if the token<br>
is valid for a requested scope when find_token is called.<br>
<br>
Returns:<br>
True if the token was added, False if the token was not added becase<br>
no scopes were provided.</tt></dd></dl>
<dl><dt><a name="TokenStore-find_token"><strong>find_token</strong></a>(self, url)</dt><dd><tt>Selects an Authorization header token which can be used for the URL.<br>
<br>
Args:<br>
url: str or atom.url.Url or a list containing the same.<br>
The URL which is going to be requested. All<br>
tokens are examined to see if any scopes begin match the beginning<br>
of the URL. The first match found is returned.<br>
<br>
Returns:<br>
The token <a href="__builtin__.html#object">object</a> which should execute the HTTP request. If there was<br>
no token for the url (the url did not begin with any of the token<br>
scopes available), then the atom.http_interface.GenericToken will be <br>
returned because the GenericToken calls through to the http client<br>
without adding an Authorization header.</tt></dd></dl>
<dl><dt><a name="TokenStore-remove_all_tokens"><strong>remove_all_tokens</strong></a>(self)</dt></dl>
<dl><dt><a name="TokenStore-remove_token"><strong>remove_token</strong></a>(self, token)</dt><dd><tt>Removes the token from the token_store.<br>
<br>
This method is used when a token is determined to be invalid. If the<br>
token was found by find_token, but resulted in a 401 or 403 error stating<br>
that the token was invlid, then the token should be removed to prevent<br>
future use.<br>
<br>
Returns:<br>
True if a token was found and then removed from the token<br>
store. False if the token was not in the <a href="#TokenStore">TokenStore</a>.</tt></dd></dl>
<hr>
Data descriptors defined here:<br>
<dl><dt><strong>__dict__</strong></dt>
<dd><tt>dictionary for instance variables (if defined)</tt></dd>
</dl>
<dl><dt><strong>__weakref__</strong></dt>
<dd><tt>list of weak references to the object (if defined)</tt></dd>
</dl>
</td></tr></table></td></tr></table><p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#55aa55">
<td colspan=3 valign=bottom> <br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Data</strong></big></font></td></tr>
<tr><td bgcolor="#55aa55"><tt> </tt></td><td> </td>
<td width="100%"><strong>SCOPE_ALL</strong> = 'http'<br>
<strong>__author__</strong> = 'api.jscudder (Jeff Scudder)'</td></tr></table><p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#7799ee">
<td colspan=3 valign=bottom> <br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Author</strong></big></font></td></tr>
<tr><td bgcolor="#7799ee"><tt> </tt></td><td> </td>
<td width="100%">api.jscudder (Jeff Scudder)</td></tr></table>
</body></html>