Skip to content

Commit c9145b2

Browse files
committed
[FIX] base_..._oauth: no need for basic type provider.
Basic authentication is no oauth at all and fully handled by base_external_system_http.
1 parent 406f613 commit c9145b2

File tree

1 file changed

+3
-16
lines changed

1 file changed

+3
-16
lines changed

base_external_system_oauth/models/auth_oauth_provider.py

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2020 Therp BV <https://therp.nl>.
1+
# Copyright 2020-2024 Therp BV <https://therp.nl>.
22
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
33
# pylint: disable=no-self-use
44
"""Provide extra functionality to use Microsoft oauth for applications."""
@@ -22,9 +22,8 @@ class AuthOAuthProvider(models.Model):
2222
client_secret = fields.Char()
2323
provider_type = fields.Selection(
2424
selection=[
25-
("demo", "Use client_id and client_secret, but return fixed result"),
26-
("basic", "Use client_id and client_secret for basic Authentication"),
27-
("microsoft_client_secret", "Microsoft Client Secret autehntication"),
25+
("demo", "DEMO Just for testing purposes"),
26+
("microsoft_client_secret", "Microsoft Client Secret Authentication"),
2827
],
2928
default="basic",
3029
help="Provider type determines the method to retrieve bearer token",
@@ -46,18 +45,6 @@ def _get_access_token_demo(self):
4645
return "you_are_in"
4746
raise UserError(_("Wrong client_id or client_secret"))
4847

49-
def _get_access_token_basic(self):
50-
"""Get access token using basic authentication."""
51-
login_params = {
52-
"grant_type": "client_credentials",
53-
}
54-
basic = HTTPBasicAuth(self.client_id, self.client_secret)
55-
response = requests.post(
56-
url=self.auth_endpoint, params=login_params, auth=basic, timeout=16
57-
)
58-
self._check_response(response)
59-
return response.json()["access_token"]
60-
6148
def _get_access_token_microsoft_client_secret(self):
6249
"""Get access token from Microsoft."""
6350
login_url = "%(auth_endpoint)s/%(tenant_id)s%(validation_endpoint)s" % {

0 commit comments

Comments
 (0)