Skip to content

Commit 5b79045

Browse files
committed
Inherit from Dovecot auth plugin.
1 parent 636f88b commit 5b79045

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

radicale_modoboa_auth_oauth2/__init__.py

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,23 @@
22

33
import requests
44

5-
from radicale import auth
5+
from radicale.auth.dovecot import Auth as DovecotAuth
66
from radicale.log import logger
77

88

9-
class Auth(auth.BaseAuth):
9+
class Auth(DovecotAuth):
10+
"""
11+
Custom authentication plugin using oAuth2 introspection mode.
12+
13+
If the authentication fails with given credentials, it falls back to Dovecot
14+
authentication.
15+
16+
Configuration:
17+
18+
[auth]
19+
type = radicale_modoboa_auth_oauth2
20+
oauth2_introspection_endpoint = <URL HERE>
21+
"""
1022

1123
def __init__(self, configuration):
1224
super().__init__(configuration)
@@ -25,4 +37,4 @@ def _login(self, login, password):
2537
content = response.json()
2638
if response.status_code == 200 and content.get("active") and content.get("username") == login:
2739
return login
28-
return ""
40+
return super()._login(login, password)

0 commit comments

Comments
 (0)