azauthlib 1.0.0b1__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.
@@ -0,0 +1,248 @@
1
+ Metadata-Version: 2.1
2
+ Name: azauthlib
3
+ Version: 1.0.0b1
4
+ Summary: A Python library simplifying Azure Microsoft Graph authentication. Provides an intuitive interface for acquiring access tokens through interactive login, silent authentication, device code flow, and client credentials flow. Includes utilities for seamless token storage and refresh management.
5
+ Home-page: https://github.com/cedricmoorejr/azauthlib/tree/v1.0.0b1
6
+ Author: Cedric Moore Jr.
7
+ Author-email: cedricmoorejunior5@gmail.com
8
+ License: Apache Software License
9
+ Project-URL: Source Code, https://github.com/cedricmoorejr/azauthlib/releases/tag/v1.0.0-beta.1
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: License :: OSI Approved :: Apache Software License
12
+ Classifier: Operating System :: Microsoft :: Windows
13
+ Classifier: Operating System :: POSIX :: Linux
14
+ Classifier: Operating System :: MacOS :: MacOS X
15
+ Classifier: Development Status :: 4 - Beta
16
+ Classifier: Intended Audience :: Developers
17
+ Classifier: Natural Language :: English
18
+ Classifier: Programming Language :: Python :: 3.8
19
+ Classifier: Programming Language :: Python :: 3.9
20
+ Classifier: Programming Language :: Python :: 3.10
21
+ Requires-Python: >=3.7
22
+ Description-Content-Type: text/markdown
23
+
24
+
25
+
26
+ ---
27
+
28
+ <div align="center">
29
+
30
+ # 🌟 **azauthlib** 🌟
31
+
32
+ > **Your Simplified Authentication Companion for Azure Microsoft Graph**
33
+
34
+ </div>
35
+
36
+
37
+ `azauthlib` is a Python library that **streamlines the authentication process** with Azure Microsoft Graph. From interactive logins to client credentials flow, `azauthlib` provides an intuitive interface, robust token management, and a GUI for seamless configuration.
38
+
39
+ πŸ” Whether you're building applications that interact with Microsoft Graph APIs or automating workflows, `azauthlib` has you covered.
40
+
41
+ ![Microsoft REST API](https://img.shields.io/badge/Powered%20by-Microsoft%20REST%20APIs-blue)
42
+ ![Release Date](https://img.shields.io/github/release-date/cedricmoorejr/azauthlib)
43
+ ![Azure](https://img.shields.io/badge/Cloud-Azure-blue?logo=microsoft-azure)
44
+ ![Language](https://img.shields.io/badge/language-python-blue)
45
+ ![License](https://img.shields.io/github/license/cedricmoorejr/azauthlib)
46
+ ![PyPI](https://img.shields.io/pypi/v/azauthlib)
47
+ ![Static Badge](https://img.shields.io/badge/status-beta-yellow)
48
+ ![OAuth 2.0](https://img.shields.io/badge/OAuth-2.0-blue)
49
+ ![Version](https://img.shields.io/github/v/release/cedricmoorejr/azauthlib)
50
+ ![Azure AD](https://img.shields.io/badge/Azure%20Active%20Directory-Integration-blue?logo=microsoft)
51
+ ![OpenID Connect](https://img.shields.io/badge/OpenID%20Connect-Supported-green)
52
+ ![Azure DevOps](https://img.shields.io/badge/DevOps-Azure-blue?logo=azure-devops)
53
+ ![Docs](https://img.shields.io/badge/docs-complete-brightgreen)
54
+ ![Microsoft Graph](https://img.shields.io/badge/Microsoft%20Graph-API-blue?logo=microsoft)
55
+ ![Code Style](https://img.shields.io/badge/code%20style-pep8-green)
56
+ ---
57
+
58
+ ## ✨ **Features** ✨
59
+
60
+ βœ… **Multiple Authentication Flows**
61
+ - Silent Authentication
62
+ - Interactive Authentication
63
+ - Device Code Flow
64
+ - Client Credentials
65
+
66
+ βœ… **Graphical User Interface (GUI)**
67
+ - Configure credentials with an easy-to-use GUI.
68
+
69
+ βœ… **Token Management**
70
+ - Automatic refresh for access tokens
71
+ - Secure token storage
72
+
73
+ βœ… **Flexible Environment Configuration**
74
+ - Use `.env` files, OS variables, or direct input.
75
+
76
+ βœ… **Customizable Permissions**
77
+ - Specify Microsoft Graph API scopes effortlessly.
78
+
79
+ ---
80
+
81
+ ## πŸš€ **Installation**
82
+
83
+ ### Install from PyPI
84
+
85
+ ```bash
86
+ pip install azauthlib
87
+ ```
88
+
89
+ ### Install from Source
90
+
91
+ ```bash
92
+ git clone https://github.com/cedricmoorejr/azauthlib.git
93
+ cd azauthlib
94
+ pip install .
95
+ ```
96
+
97
+ ### πŸ“‹ **Requirements**
98
+ - Python 3.7+
99
+ - `msal`
100
+ - `portalocker`
101
+ - `python-dotenv`
102
+
103
+ Install dependencies manually if needed:
104
+
105
+ ```bash
106
+ pip install -r requirements.txt
107
+ ```
108
+
109
+ ---
110
+
111
+ ## πŸ›  **Getting Started**
112
+
113
+ ### 1️⃣ **Prerequisites**
114
+ - Register an app in **Azure Active Directory** via the [Azure Portal](https://portal.azure.com/).
115
+ - Collect the following:
116
+ - `CLIENT_ID`
117
+ - `TENANT_ID`
118
+ - (Optional) `CLIENT_SECRET`
119
+
120
+ - Assign the appropriate Microsoft Graph API permissions.
121
+
122
+ ### 2️⃣ **Configuration Options**
123
+ #### 🌐 **Option A: GUI Mode**
124
+
125
+ Launch the GUI for intuitive configuration:
126
+
127
+ ```bash
128
+ python config_app.py
129
+ ```
130
+
131
+ > πŸ’‘ **What You Can Do in the GUI:**
132
+ > - Enter credentials (`CLIENT_ID`, `TENANT_ID`, etc.).
133
+ > - Choose your authentication method.
134
+ > - Credentials are saved securely in a `.env` file.
135
+
136
+ ![GUI Screenshot](https://raw.githubusercontent.com/cedricmoorejr/azauthlib/v1.0.0b1/assets/gui_main.png)
137
+
138
+ ---
139
+
140
+ #### πŸ›  **Option B: Non-GUI Mode**
141
+
142
+ 1. **Using Environment Variables** (Recommended):
143
+
144
+ ```bash
145
+ export TENANT_ID="your-tenant-id"
146
+ export CLIENT_ID="your-client-id"
147
+ export CLIENT_SECRET="your-client-secret"
148
+ ```
149
+
150
+ 2. **Hardcoding in Code** (⚠️ Not Recommended):
151
+
152
+ ```python
153
+ from azauthlib import Authentication
154
+
155
+ auth = Authentication(scopes="Files.ReadWrite.All")
156
+ auth.Build.WithEntry(
157
+ client_id="your-client-id",
158
+ tenant_id="your-tenant-id",
159
+ client_secret="your-client-secret"
160
+ )
161
+ ```
162
+
163
+ ---
164
+
165
+ ## πŸ”‘ **Authentication Flows**
166
+
167
+ ### πŸ”’ **Silent Authentication**
168
+ Authenticate using cached tokens.
169
+
170
+ ```python
171
+ auth.Silent()
172
+ ```
173
+
174
+ ### 🌐 **Interactive Authentication**
175
+ Prompts user to log in via a browser.
176
+
177
+ ```python
178
+ auth.Interactive()
179
+ ```
180
+
181
+ ### πŸ“± **Device Code Flow**
182
+ Displays a device code for cross-device authentication.
183
+
184
+ ```python
185
+ auth.DeviceCodeFlow(webbrowser_enabled=True)
186
+ ```
187
+
188
+ ### 🀝 **Client Credentials Flow**
189
+ Authenticate server-to-server.
190
+
191
+ ```python
192
+ auth.ClientCredentials()
193
+ ```
194
+
195
+ ---
196
+
197
+ ## πŸ’Ό **Token Management**
198
+
199
+ - **Access Token**: Retrieve the active token.
200
+
201
+ ```python
202
+ token = auth.access_token
203
+ ```
204
+
205
+ - **Token Expiry**: Check token lifetime.
206
+
207
+ ```python
208
+ print("Token expires in:", auth.token_expires_in)
209
+ ```
210
+
211
+ - **Automatic Refresh**: Tokens are refreshed seamlessly.
212
+
213
+ ---
214
+
215
+ ## πŸ“œ **Logging**
216
+
217
+ Easily track authentication flow and token operations using Python’s `logging` module. Customize as needed!
218
+
219
+ ---
220
+
221
+ ## 🀝 **Contributing**
222
+
223
+ We welcome contributions! πŸš€ Here's how you can help:
224
+ 1. Fork the repo.
225
+ 2. Create a feature or bugfix branch.
226
+ 3. Submit a PR with a detailed description.
227
+
228
+ ---
229
+
230
+ ## πŸ“„ **License**
231
+
232
+ This project is licensed under the **Apache License 2.0**. See the `LICENSE` file for more details.
233
+
234
+ ---
235
+
236
+ ## ℹ️ **Trademarks**
237
+
238
+ - This project references **Microsoft** trademarks such as Azure and Microsoft Graph. Please ensure compliance with Microsoft’s [Trademark Guidelines](https://www.microsoft.com/trademarks).
239
+
240
+ ---
241
+
242
+ πŸ”— **[GitHub Repository](https://github.com/cedricmoorejr/azauthlib/tree/v1.0.0b1)**
243
+ πŸ’¬ **Feedback? Issues?** We’d love to hear from you!
244
+
245
+ ---
246
+
247
+
248
+
@@ -0,0 +1,225 @@
1
+
2
+
3
+ ---
4
+
5
+ <div align="center">
6
+
7
+ # 🌟 **azauthlib** 🌟
8
+
9
+ > **Your Simplified Authentication Companion for Azure Microsoft Graph**
10
+
11
+ </div>
12
+
13
+
14
+ `azauthlib` is a Python library that **streamlines the authentication process** with Azure Microsoft Graph. From interactive logins to client credentials flow, `azauthlib` provides an intuitive interface, robust token management, and a GUI for seamless configuration.
15
+
16
+ πŸ” Whether you're building applications that interact with Microsoft Graph APIs or automating workflows, `azauthlib` has you covered.
17
+
18
+ ![Microsoft REST API](https://img.shields.io/badge/Powered%20by-Microsoft%20REST%20APIs-blue)
19
+ ![Release Date](https://img.shields.io/github/release-date/cedricmoorejr/azauthlib)
20
+ ![Azure](https://img.shields.io/badge/Cloud-Azure-blue?logo=microsoft-azure)
21
+ ![Language](https://img.shields.io/badge/language-python-blue)
22
+ ![License](https://img.shields.io/github/license/cedricmoorejr/azauthlib)
23
+ ![PyPI](https://img.shields.io/pypi/v/azauthlib)
24
+ ![Static Badge](https://img.shields.io/badge/status-beta-yellow)
25
+ ![OAuth 2.0](https://img.shields.io/badge/OAuth-2.0-blue)
26
+ ![Version](https://img.shields.io/github/v/release/cedricmoorejr/azauthlib)
27
+ ![Azure AD](https://img.shields.io/badge/Azure%20Active%20Directory-Integration-blue?logo=microsoft)
28
+ ![OpenID Connect](https://img.shields.io/badge/OpenID%20Connect-Supported-green)
29
+ ![Azure DevOps](https://img.shields.io/badge/DevOps-Azure-blue?logo=azure-devops)
30
+ ![Docs](https://img.shields.io/badge/docs-complete-brightgreen)
31
+ ![Microsoft Graph](https://img.shields.io/badge/Microsoft%20Graph-API-blue?logo=microsoft)
32
+ ![Code Style](https://img.shields.io/badge/code%20style-pep8-green)
33
+ ---
34
+
35
+ ## ✨ **Features** ✨
36
+
37
+ βœ… **Multiple Authentication Flows**
38
+ - Silent Authentication
39
+ - Interactive Authentication
40
+ - Device Code Flow
41
+ - Client Credentials
42
+
43
+ βœ… **Graphical User Interface (GUI)**
44
+ - Configure credentials with an easy-to-use GUI.
45
+
46
+ βœ… **Token Management**
47
+ - Automatic refresh for access tokens
48
+ - Secure token storage
49
+
50
+ βœ… **Flexible Environment Configuration**
51
+ - Use `.env` files, OS variables, or direct input.
52
+
53
+ βœ… **Customizable Permissions**
54
+ - Specify Microsoft Graph API scopes effortlessly.
55
+
56
+ ---
57
+
58
+ ## πŸš€ **Installation**
59
+
60
+ ### Install from PyPI
61
+
62
+ ```bash
63
+ pip install azauthlib
64
+ ```
65
+
66
+ ### Install from Source
67
+
68
+ ```bash
69
+ git clone https://github.com/cedricmoorejr/azauthlib.git
70
+ cd azauthlib
71
+ pip install .
72
+ ```
73
+
74
+ ### πŸ“‹ **Requirements**
75
+ - Python 3.7+
76
+ - `msal`
77
+ - `portalocker`
78
+ - `python-dotenv`
79
+
80
+ Install dependencies manually if needed:
81
+
82
+ ```bash
83
+ pip install -r requirements.txt
84
+ ```
85
+
86
+ ---
87
+
88
+ ## πŸ›  **Getting Started**
89
+
90
+ ### 1️⃣ **Prerequisites**
91
+ - Register an app in **Azure Active Directory** via the [Azure Portal](https://portal.azure.com/).
92
+ - Collect the following:
93
+ - `CLIENT_ID`
94
+ - `TENANT_ID`
95
+ - (Optional) `CLIENT_SECRET`
96
+
97
+ - Assign the appropriate Microsoft Graph API permissions.
98
+
99
+ ### 2️⃣ **Configuration Options**
100
+ #### 🌐 **Option A: GUI Mode**
101
+
102
+ Launch the GUI for intuitive configuration:
103
+
104
+ ```bash
105
+ python config_app.py
106
+ ```
107
+
108
+ > πŸ’‘ **What You Can Do in the GUI:**
109
+ > - Enter credentials (`CLIENT_ID`, `TENANT_ID`, etc.).
110
+ > - Choose your authentication method.
111
+ > - Credentials are saved securely in a `.env` file.
112
+
113
+ ![GUI Screenshot](https://raw.githubusercontent.com/cedricmoorejr/azauthlib/v1.0.0b1/assets/gui_main.png)
114
+
115
+ ---
116
+
117
+ #### πŸ›  **Option B: Non-GUI Mode**
118
+
119
+ 1. **Using Environment Variables** (Recommended):
120
+
121
+ ```bash
122
+ export TENANT_ID="your-tenant-id"
123
+ export CLIENT_ID="your-client-id"
124
+ export CLIENT_SECRET="your-client-secret"
125
+ ```
126
+
127
+ 2. **Hardcoding in Code** (⚠️ Not Recommended):
128
+
129
+ ```python
130
+ from azauthlib import Authentication
131
+
132
+ auth = Authentication(scopes="Files.ReadWrite.All")
133
+ auth.Build.WithEntry(
134
+ client_id="your-client-id",
135
+ tenant_id="your-tenant-id",
136
+ client_secret="your-client-secret"
137
+ )
138
+ ```
139
+
140
+ ---
141
+
142
+ ## πŸ”‘ **Authentication Flows**
143
+
144
+ ### πŸ”’ **Silent Authentication**
145
+ Authenticate using cached tokens.
146
+
147
+ ```python
148
+ auth.Silent()
149
+ ```
150
+
151
+ ### 🌐 **Interactive Authentication**
152
+ Prompts user to log in via a browser.
153
+
154
+ ```python
155
+ auth.Interactive()
156
+ ```
157
+
158
+ ### πŸ“± **Device Code Flow**
159
+ Displays a device code for cross-device authentication.
160
+
161
+ ```python
162
+ auth.DeviceCodeFlow(webbrowser_enabled=True)
163
+ ```
164
+
165
+ ### 🀝 **Client Credentials Flow**
166
+ Authenticate server-to-server.
167
+
168
+ ```python
169
+ auth.ClientCredentials()
170
+ ```
171
+
172
+ ---
173
+
174
+ ## πŸ’Ό **Token Management**
175
+
176
+ - **Access Token**: Retrieve the active token.
177
+
178
+ ```python
179
+ token = auth.access_token
180
+ ```
181
+
182
+ - **Token Expiry**: Check token lifetime.
183
+
184
+ ```python
185
+ print("Token expires in:", auth.token_expires_in)
186
+ ```
187
+
188
+ - **Automatic Refresh**: Tokens are refreshed seamlessly.
189
+
190
+ ---
191
+
192
+ ## πŸ“œ **Logging**
193
+
194
+ Easily track authentication flow and token operations using Python’s `logging` module. Customize as needed!
195
+
196
+ ---
197
+
198
+ ## 🀝 **Contributing**
199
+
200
+ We welcome contributions! πŸš€ Here's how you can help:
201
+ 1. Fork the repo.
202
+ 2. Create a feature or bugfix branch.
203
+ 3. Submit a PR with a detailed description.
204
+
205
+ ---
206
+
207
+ ## πŸ“„ **License**
208
+
209
+ This project is licensed under the **Apache License 2.0**. See the `LICENSE` file for more details.
210
+
211
+ ---
212
+
213
+ ## ℹ️ **Trademarks**
214
+
215
+ - This project references **Microsoft** trademarks such as Azure and Microsoft Graph. Please ensure compliance with Microsoft’s [Trademark Guidelines](https://www.microsoft.com/trademarks).
216
+
217
+ ---
218
+
219
+ πŸ”— **[GitHub Repository](https://github.com/cedricmoorejr/azauthlib/tree/v1.0.0b1)**
220
+ πŸ’¬ **Feedback? Issues?** We’d love to hear from you!
221
+
222
+ ---
223
+
224
+
225
+
@@ -0,0 +1,23 @@
1
+ # main
2
+ __all__ = ['Authentication']
3
+
4
+ # Explicit imports
5
+ from .authentication import Authentication
6
+
7
+
8
+ # import os
9
+ # import sys
10
+ #
11
+ # # Absolute path of this package's directory
12
+ # PACKAGEPATH = os.path.abspath(os.path.dirname(__file__))
13
+ #
14
+ # # Add the package path to sys.path
15
+ # if PACKAGEPATH not in sys.path:
16
+ # sys.path.append(PACKAGEPATH)
17
+ #
18
+ # # # Define HOMEPATH for general usage
19
+ # # HOMEPATH = os.path.dirname(PACKAGEPATH)
20
+ #
21
+ # from authentication import Authentication
22
+ #
23
+ # __all__ = ['Authentication']