PostgreSQL Source Code git master
|
Public Member Functions | |
def | do_GET (self) |
str | client_id (self) |
def | do_POST (self) |
JsonObject | config (self) |
JsonObject | authorization (self) |
JsonObject | token (self) |
Data Fields | |
path | |
Static Public Attributes | |
JsonObject = dict[str, object] | |
Private Member Functions | |
def | _check_issuer (self) |
def | _check_authn (self) |
dict[str, str] | _parse_params (self) |
bool | _should_modify (self) |
def | _get_param (self, name, default) |
str | _content_type (self) |
int | _interval (self) |
str | _retry_code (self) |
str | _uri_spelling (self) |
def | _response_padding (self) |
def | _access_token (self) |
None | _send_json (self, JsonObject js) |
def | _token_state (self) |
def | _remove_token_state (self) |
Private Attributes | |
_alt_issuer | |
_parameterized | |
_response_code | |
_params | |
_test_params | |
Core implementation of the authorization server. The API is inheritance-based, with entry points at do_GET() and do_POST(). See the documentation for BaseHTTPRequestHandler.
Definition at line 19 of file oauth_server.py.
|
private |
The actual Bearer token sent back to the client on success. Tests may override this with the "token" test parameter.
Definition at line 221 of file oauth_server.py.
References oauth_server.OAuthHandler._alt_issuer, and oauth_server.OAuthHandler._get_param().
Referenced by oauth_server.OAuthHandler.token().
|
private |
Checks the expected value of the Authorization header, if any.
Definition at line 47 of file oauth_server.py.
References oauth_server.OAuthHandler._get_param(), oauth_server.OAuthHandler.client_id(), printTableContent.headers, and async_ctx.headers.
|
private |
Switches the behavior of the provider depending on the issuer URI.
Definition at line 28 of file oauth_server.py.
Referenced by oauth_server.OAuthHandler.do_POST().
|
private |
Returns "application/json" unless the test has requested something different.
Definition at line 178 of file oauth_server.py.
References oauth_server.OAuthHandler._get_param().
Referenced by oauth_server.OAuthHandler._send_json().
|
private |
If the client has requested a modification to this stage (see _should_modify()), this method searches the provided test parameters for a key of the given name, and returns it if found. Otherwise the provided default is returned.
Definition at line 165 of file oauth_server.py.
References oauth_server.OAuthHandler._should_modify(), and oauth_server.OAuthHandler._test_params.
Referenced by oauth_server.OAuthHandler._access_token(), oauth_server.OAuthHandler._check_authn(), oauth_server.OAuthHandler._content_type(), oauth_server.OAuthHandler._interval(), oauth_server.OAuthHandler._response_padding(), oauth_server.OAuthHandler._retry_code(), oauth_server.OAuthHandler._uri_spelling(), and oauth_server.OAuthHandler.token().
|
private |
Returns 0 unless the test has requested something different.
Definition at line 186 of file oauth_server.py.
References oauth_server.OAuthHandler._get_param().
Referenced by oauth_server.OAuthHandler.authorization().
Parses apart the form-urlencoded request body and returns the resulting dict. For use by do_POST().
Definition at line 86 of file oauth_server.py.
References oauth_server.OAuthHandler.do_POST(), printTableContent.headers, async_ctx.headers, and read.
Referenced by oauth_server.OAuthHandler.client_id().
|
private |
Removes any cached _TokenState for the current client_id. Call this after the token exchange ends to get rid of unnecessary state.
Definition at line 284 of file oauth_server.py.
References oauth_server.OAuthHandler.client_id(), and PgFdwRelationInfo.server.
Referenced by oauth_server.OAuthHandler.token().
|
private |
If the huge_response test parameter is set to True, returns a dict containing a gigantic string value, which can then be folded into a JSON response.
Definition at line 209 of file oauth_server.py.
References oauth_server.OAuthHandler._get_param().
Referenced by oauth_server.OAuthHandler.authorization(), and oauth_server.OAuthHandler.token().
|
private |
Returns "authorization_pending" unless the test has requested something different.
Definition at line 193 of file oauth_server.py.
References oauth_server.OAuthHandler._get_param().
Referenced by oauth_server.OAuthHandler.token().
|
private |
Sends the provided JSON dict as an application/json response. self._response_code can be modified to send JSON error responses.
Definition at line 236 of file oauth_server.py.
References oauth_server.OAuthHandler._content_type(), oauth_server.OAuthHandler._response_code, len, str, and write.
|
private |
Returns True if the client has requested a modification to this stage of the exchange.
Definition at line 145 of file oauth_server.py.
References oauth_server.OAuthHandler._test_params, RewriteMappingFile.path, backup_file_entry.path, PathClauseUsage.path, JsonTablePlanState.path, keepwal_entry.path, file_entry_t.path, fetch_range_request.path, UpgradeTaskReport.path, tablespaceinfo.path, IndexPath.path, BitmapHeapPath.path, BitmapAndPath.path, BitmapOrPath.path, TidPath.path, TidRangePath.path, SubqueryScanPath.path, ForeignPath.path, CustomPath.path, AppendPath.path, MergeAppendPath.path, GroupResultPath.path, MaterialPath.path, MemoizePath.path, UniquePath.path, GatherPath.path, GatherMergePath.path, ProjectionPath.path, ProjectSetPath.path, SortPath.path, GroupPath.path, UpperUniquePath.path, AggPath.path, GroupingSetsPath.path, MinMaxAggPath.path, WindowAggPath.path, SetOpPath.path, RecursiveUnionPath.path, LockRowsPath.path, ModifyTablePath.path, LimitPath.path, MinMaxAggInfo.path, JsonTablePathScan.path, _include_path.path, and oauth_server.OAuthHandler.path.
Referenced by oauth_server.OAuthHandler._get_param(), and oauth_server.OAuthHandler.token().
|
private |
A cached _TokenState object for the connected client (as determined by the request's client_id), or a new one if it doesn't already exist. This relies on the existence of a defaultdict attached to the server; see main() below.
Definition at line 274 of file oauth_server.py.
References oauth_server.OAuthHandler.client_id(), oauth_server.main(), and PgFdwRelationInfo.server.
Referenced by oauth_server.OAuthHandler.authorization(), and oauth_server.OAuthHandler.token().
|
private |
Returns "verification_uri" unless the test has requested something different.
Definition at line 201 of file oauth_server.py.
References oauth_server.OAuthHandler._get_param().
Referenced by oauth_server.OAuthHandler.authorization().
JsonObject oauth_server.OAuthHandler.authorization | ( | self | ) |
Definition at line 292 of file oauth_server.py.
References oauth_server.OAuthHandler._alt_issuer, oauth_server.OAuthHandler._interval(), oauth_server.OAuthHandler._params, oauth_server.OAuthHandler._response_padding(), oauth_server.OAuthHandler._token_state(), and oauth_server.OAuthHandler._uri_spelling().
str oauth_server.OAuthHandler.client_id | ( | self | ) |
Returns the client_id sent in the POST body or the Authorization header. self._parse_params() must have been called first.
Definition at line 104 of file oauth_server.py.
References oauth_server.OAuthHandler._params, oauth_server.OAuthHandler._parse_params(), printTableContent.headers, and async_ctx.headers.
Referenced by oauth_server.OAuthHandler._check_authn(), oauth_server.OAuthHandler._remove_token_state(), and oauth_server.OAuthHandler._token_state().
JsonObject oauth_server.OAuthHandler.config | ( | self | ) |
Definition at line 251 of file oauth_server.py.
References oauth_server.OAuthHandler._alt_issuer, oauth_server.OAuthHandler._parameterized, and PgFdwRelationInfo.server.
def oauth_server.OAuthHandler.do_GET | ( | self | ) |
Definition at line 70 of file oauth_server.py.
def oauth_server.OAuthHandler.do_POST | ( | self | ) |
Definition at line 122 of file oauth_server.py.
References oauth_server.OAuthHandler._check_issuer(), and oauth_server.OAuthHandler._response_code.
Referenced by oauth_server.OAuthHandler._parse_params().
JsonObject oauth_server.OAuthHandler.token | ( | self | ) |
Definition at line 318 of file oauth_server.py.
References oauth_server.OAuthHandler._access_token(), oauth_server.OAuthHandler._get_param(), oauth_server.OAuthHandler._remove_token_state(), oauth_server.OAuthHandler._response_code, oauth_server.OAuthHandler._response_padding(), oauth_server.OAuthHandler._retry_code(), oauth_server.OAuthHandler._should_modify(), oauth_server.OAuthHandler._test_params, and oauth_server.OAuthHandler._token_state().
|
private |
Definition at line 32 of file oauth_server.py.
Referenced by oauth_server.OAuthHandler._access_token(), oauth_server.OAuthHandler.authorization(), and oauth_server.OAuthHandler.config().
|
private |
Definition at line 36 of file oauth_server.py.
Referenced by oauth_server.OAuthHandler.config().
|
private |
Definition at line 126 of file oauth_server.py.
Referenced by oauth_server.OAuthHandler.authorization(), and oauth_server.OAuthHandler.client_id().
|
private |
Definition at line 71 of file oauth_server.py.
Referenced by oauth_server.OAuthHandler._send_json(), oauth_server.OAuthHandler.do_POST(), and oauth_server.OAuthHandler.token().
|
private |
Definition at line 131 of file oauth_server.py.
Referenced by oauth_server.OAuthHandler._get_param(), oauth_server.OAuthHandler._should_modify(), and oauth_server.OAuthHandler.token().
|
static |
Definition at line 26 of file oauth_server.py.
oauth_server.OAuthHandler.path |
Definition at line 34 of file oauth_server.py.
Referenced by oauth_server.OAuthHandler._should_modify().