oauth2-cli-auth 1.3.0__tar.gz → 1.4.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {oauth2_cli_auth-1.3.0 → oauth2_cli_auth-1.4.0}/PKG-INFO +1 -1
- {oauth2_cli_auth-1.3.0 → oauth2_cli_auth-1.4.0}/oauth2_cli_auth/code_grant.py +8 -2
- {oauth2_cli_auth-1.3.0 → oauth2_cli_auth-1.4.0}/oauth2_cli_auth/http_server.py +9 -0
- {oauth2_cli_auth-1.3.0 → oauth2_cli_auth-1.4.0}/oauth2_cli_auth/simplified_flow.py +4 -0
- {oauth2_cli_auth-1.3.0 → oauth2_cli_auth-1.4.0}/pyproject.toml +22 -1
- {oauth2_cli_auth-1.3.0 → oauth2_cli_auth-1.4.0}/LICENSE +0 -0
- {oauth2_cli_auth-1.3.0 → oauth2_cli_auth-1.4.0}/README.md +0 -0
- {oauth2_cli_auth-1.3.0 → oauth2_cli_auth-1.4.0}/oauth2_cli_auth/__init__.py +0 -0
- {oauth2_cli_auth-1.3.0 → oauth2_cli_auth-1.4.0}/oauth2_cli_auth/_timeout.py +0 -0
- {oauth2_cli_auth-1.3.0 → oauth2_cli_auth-1.4.0}/oauth2_cli_auth/_urllib_util.py +0 -0
- {oauth2_cli_auth-1.3.0 → oauth2_cli_auth-1.4.0}/oauth2_cli_auth/conftest.py +0 -0
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Functionality to work with OAuth2 code grant
|
|
3
|
+
"""
|
|
1
4
|
import base64
|
|
2
5
|
import urllib.parse
|
|
3
6
|
import urllib.request
|
|
@@ -34,6 +37,11 @@ class OAuth2ClientInfo:
|
|
|
34
37
|
|
|
35
38
|
|
|
36
39
|
def load_oidc_config(odic_well_known_endpoint: str) -> dict:
|
|
40
|
+
"""
|
|
41
|
+
Load OIDC configuration from the well known configuration endpoint
|
|
42
|
+
|
|
43
|
+
:param odic_well_known_endpoint: Endpoint to load configuration from
|
|
44
|
+
"""
|
|
37
45
|
config = _load_json(odic_well_known_endpoint)
|
|
38
46
|
return config
|
|
39
47
|
|
|
@@ -76,8 +84,6 @@ def exchange_code_for_response(
|
|
|
76
84
|
:param client_info: Info about oauth2 client
|
|
77
85
|
:param redirect_uri: Callback URL
|
|
78
86
|
:param code: Code to redeem
|
|
79
|
-
:param access_token_field: Name of the field containing the access token to use. This might differ depending on
|
|
80
|
-
the provider you are using. For example for Auth0 you have to set this to id_token
|
|
81
87
|
:return: Response from OAuth2 endpoint
|
|
82
88
|
"""
|
|
83
89
|
headers = {
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Local HTTP server logic
|
|
3
|
+
"""
|
|
1
4
|
from http.server import BaseHTTPRequestHandler, HTTPServer
|
|
2
5
|
from string import Template
|
|
3
6
|
from typing import Optional
|
|
@@ -6,6 +9,9 @@ from oauth2_cli_auth._timeout import _method_with_timeout, TimeoutException
|
|
|
6
9
|
|
|
7
10
|
|
|
8
11
|
class CallbackPageTemplate:
|
|
12
|
+
"""
|
|
13
|
+
Holder for callback page assets and template
|
|
14
|
+
"""
|
|
9
15
|
SUCCESS_SVG = """
|
|
10
16
|
<svg xmlns="http://www.w3.org/2000/svg" width="154px" height="154px">
|
|
11
17
|
<g fill="none" stroke="#22AE73" stroke-width="2">
|
|
@@ -149,6 +155,9 @@ class CallbackPageTemplate:
|
|
|
149
155
|
|
|
150
156
|
|
|
151
157
|
class OAuthRedirectHandler(BaseHTTPRequestHandler):
|
|
158
|
+
"""
|
|
159
|
+
HTTPRequest Handler that is intended to be used as oauth2 callback page
|
|
160
|
+
"""
|
|
152
161
|
callback_template = CallbackPageTemplate()
|
|
153
162
|
|
|
154
163
|
def log_message(self, format, *args):
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Ready to use workflows
|
|
3
|
+
"""
|
|
1
4
|
from oauth2_cli_auth import OAuthCallbackHttpServer, get_auth_url, exchange_code_for_access_token, OAuth2ClientInfo, \
|
|
2
5
|
open_browser
|
|
3
6
|
|
|
@@ -10,6 +13,7 @@ def get_access_token_with_browser_open(client_info: OAuth2ClientInfo, server_por
|
|
|
10
13
|
- Open the browser with the authorization URL
|
|
11
14
|
- Wait for the code to arrive
|
|
12
15
|
- Get access token from code
|
|
16
|
+
|
|
13
17
|
:param client_info: Client Info for Oauth2 Interaction
|
|
14
18
|
:param server_port: Port of the local web server to spin up
|
|
15
19
|
:return: Access Token
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "oauth2-cli-auth"
|
|
3
|
-
version = "1.
|
|
3
|
+
version = "1.4.0"
|
|
4
4
|
description = "Authenticate against OAuth2 Provider in Python CLIs"
|
|
5
5
|
authors = ["Timo Reymann <mail@timo-reymann.de>"]
|
|
6
6
|
license = "MIT"
|
|
@@ -40,6 +40,8 @@ priority="explicit"
|
|
|
40
40
|
pytest = "^7.4.3"
|
|
41
41
|
coverage = "^7.3.2"
|
|
42
42
|
pdoc3 = "^0.10.0"
|
|
43
|
+
setuptools = "^69.5.1"
|
|
44
|
+
pydoctor = "^23.9.1"
|
|
43
45
|
|
|
44
46
|
[tool.coverage.run]
|
|
45
47
|
omit = [".*", "*/site-packages/*", "*/*_test.py"]
|
|
@@ -50,3 +52,22 @@ fail_under = 70
|
|
|
50
52
|
[build-system]
|
|
51
53
|
requires = ["poetry-core"]
|
|
52
54
|
build-backend = "poetry.core.masonry.api"
|
|
55
|
+
|
|
56
|
+
[tool.pydoctor]
|
|
57
|
+
verbose = 0
|
|
58
|
+
warnings-as-errors = true
|
|
59
|
+
|
|
60
|
+
intersphinx = ["https://docs.python.org/3/objects.inv"]
|
|
61
|
+
docformat = "restructuredtext"
|
|
62
|
+
html-output = "gh-pages"
|
|
63
|
+
|
|
64
|
+
add-package = ["oauth2_cli_auth"]
|
|
65
|
+
project-name = "oauth2_cli_auth"
|
|
66
|
+
project-url = "https://github.com/timo-reymann/python-oauth2-cli-auth"
|
|
67
|
+
privacy = [
|
|
68
|
+
"HIDDEN:oauth2_cli_auth.*_test",
|
|
69
|
+
"HIDDEN:oauth2_cli_auth.conftest"
|
|
70
|
+
]
|
|
71
|
+
|
|
72
|
+
theme = "base"
|
|
73
|
+
template-dir = "pydoctor-theme"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|