1
- # Copyright 2020 Therp BV <https://therp.nl>.
1
+ # Copyright 2020-2024 Therp BV <https://therp.nl>.
2
2
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
3
3
# pylint: disable=no-self-use
4
4
"""Provide extra functionality to use Microsoft oauth for applications."""
@@ -22,9 +22,8 @@ class AuthOAuthProvider(models.Model):
22
22
client_secret = fields .Char ()
23
23
provider_type = fields .Selection (
24
24
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" ),
28
27
],
29
28
default = "basic" ,
30
29
help = "Provider type determines the method to retrieve bearer token" ,
@@ -46,18 +45,6 @@ def _get_access_token_demo(self):
46
45
return "you_are_in"
47
46
raise UserError (_ ("Wrong client_id or client_secret" ))
48
47
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
-
61
48
def _get_access_token_microsoft_client_secret (self ):
62
49
"""Get access token from Microsoft."""
63
50
login_url = "%(auth_endpoint)s/%(tenant_id)s%(validation_endpoint)s" % {
0 commit comments