Skip to content

Commit 321be65

Browse files
committed
fix: add logout callback arguments to backends
1 parent f676b13 commit 321be65

File tree

8 files changed

+49
-18
lines changed

8 files changed

+49
-18
lines changed

src/satosa/backends/apple.py

+7-2
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,13 @@
3636
class AppleBackend(BackendModule):
3737
"""Sign in with Apple backend"""
3838

39-
def __init__(self, auth_callback_func, internal_attributes, config, base_url, name):
39+
def __init__(self, auth_callback_func, logout_callback_func, internal_attributes, config, base_url, name):
4040
"""
4141
Sign in with Apple backend module.
4242
:param auth_callback_func: Callback should be called by the module after the authorization
4343
in the backend is done.
44+
:param logout_callback_func: Callback should be called by the module after logout in the
45+
backend is done.
4446
:param internal_attributes: Mapping dictionary between SATOSA internal attribute names and
4547
the names returned by underlying IdP's/OP's as well as what attributes the calling SP's and
4648
RP's expects namevice.
@@ -50,13 +52,16 @@ def __init__(self, auth_callback_func, internal_attributes, config, base_url, na
5052
5153
:type auth_callback_func:
5254
(satosa.context.Context, satosa.internal.InternalData) -> satosa.response.Response
55+
:type logout_callback_func:
56+
(satosa.context.Context, satosa.internal.InternalData) -> satosa.response.Response
5357
:type internal_attributes: dict[string, dict[str, str | list[str]]]
5458
:type config: dict[str, dict[str, str] | list[str]]
5559
:type base_url: str
5660
:type name: str
5761
"""
58-
super().__init__(auth_callback_func, internal_attributes, base_url, name)
62+
super().__init__(auth_callback_func, logout_callback_func, internal_attributes, base_url, name)
5963
self.auth_callback_func = auth_callback_func
64+
self.logout_callback_func = logout_callback_func
6065
self.config = config
6166
self.client = _create_client(
6267
config["provider_metadata"],

src/satosa/backends/bitbucket.py

+7-2
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,12 @@ class BitBucketBackend(_OAuthBackend):
1919

2020
logprefix = "BitBucket Backend:"
2121

22-
def __init__(self, outgoing, internal_attributes, config, base_url, name):
22+
def __init__(self, outgoing, logout, internal_attributes, config, base_url, name):
2323
"""BitBucket backend constructor
2424
:param outgoing: Callback should be called by the module after the
2525
authorization in the backend is done.
26+
:param logout: Callback should be called by the module after logout in
27+
the backend is done.
2628
:param internal_attributes: Mapping dictionary between SATOSA internal
2729
attribute names and the names returned by underlying IdP's/OP's as
2830
well as what attributes the calling SP's and RP's expects namevice.
@@ -32,14 +34,17 @@ def __init__(self, outgoing, internal_attributes, config, base_url, name):
3234
:type outgoing:
3335
(satosa.context.Context, satosa.internal.InternalData) ->
3436
satosa.response.Response
37+
:type logout:
38+
(satosa.context.Context, satosa.internal.InternalData) ->
39+
satosa.response.Response
3540
:type internal_attributes: dict[string, dict[str, str | list[str]]]
3641
:type config: dict[str, dict[str, str] | list[str] | str]
3742
:type base_url: str
3843
:type name: str
3944
"""
4045
config.setdefault('response_type', 'code')
4146
config['verify_accesstoken_state'] = False
42-
super().__init__(outgoing, internal_attributes, config, base_url,
47+
super().__init__(outgoing, logout, internal_attributes, config, base_url,
4348
name, 'bitbucket', 'account_id')
4449

4550
def get_request_args(self, get_state=stateID):

src/satosa/backends/github.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,12 @@
2121
class GitHubBackend(_OAuthBackend):
2222
"""GitHub OAuth 2.0 backend"""
2323

24-
def __init__(self, outgoing, internal_attributes, config, base_url, name):
24+
def __init__(self, outgoing, logout, internal_attributes, config, base_url, name):
2525
"""GitHub backend constructor
2626
:param outgoing: Callback should be called by the module after the
2727
authorization in the backend is done.
28+
:param logout: Callback should be called by the module after logout
29+
in the backend is done.
2830
:param internal_attributes: Mapping dictionary between SATOSA internal
2931
attribute names and the names returned by underlying IdP's/OP's as
3032
well as what attributes the calling SP's and RP's expects namevice.
@@ -42,7 +44,7 @@ def __init__(self, outgoing, internal_attributes, config, base_url, name):
4244
config.setdefault('response_type', 'code')
4345
config['verify_accesstoken_state'] = False
4446
super().__init__(
45-
outgoing, internal_attributes, config, base_url, name, 'github',
47+
outgoing, logout, internal_attributes, config, base_url, name, 'github',
4648
'id')
4749

4850
def start_auth(self, context, internal_request, get_state=stateID):

src/satosa/backends/linkedin.py

+7-2
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,12 @@
2222
class LinkedInBackend(_OAuthBackend):
2323
"""LinkedIn OAuth 2.0 backend"""
2424

25-
def __init__(self, outgoing, internal_attributes, config, base_url, name):
25+
def __init__(self, outgoing, logout, internal_attributes, config, base_url, name):
2626
"""LinkedIn backend constructor
2727
:param outgoing: Callback should be called by the module after the
2828
authorization in the backend is done.
29+
:param logout: Callback should be called by the module after logout
30+
in the backend is done
2931
:param internal_attributes: Mapping dictionary between SATOSA internal
3032
attribute names and the names returned by underlying IdP's/OP's as
3133
well as what attributes the calling SP's and RP's expects namevice.
@@ -35,6 +37,9 @@ def __init__(self, outgoing, internal_attributes, config, base_url, name):
3537
:type outgoing:
3638
(satosa.context.Context, satosa.internal.InternalData) ->
3739
satosa.response.Response
40+
:type logout:
41+
(satosa.context.Context, satosa.internal.InternalData) ->
42+
satosa.response.Response
3843
:type internal_attributes: dict[string, dict[str, str | list[str]]]
3944
:type config: dict[str, dict[str, str] | list[str] | str]
4045
:type base_url: str
@@ -43,7 +48,7 @@ def __init__(self, outgoing, internal_attributes, config, base_url, name):
4348
config.setdefault('response_type', 'code')
4449
config['verify_accesstoken_state'] = False
4550
super().__init__(
46-
outgoing, internal_attributes, config, base_url, name, 'linkedin',
51+
outgoing, logout, internal_attributes, config, base_url, name, 'linkedin',
4752
'id')
4853

4954
def start_auth(self, context, internal_request, get_state=stateID):

src/satosa/backends/oauth.py

+8-4
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class _OAuthBackend(BackendModule):
3232
See satosa.backends.oauth.FacebookBackend.
3333
"""
3434

35-
def __init__(self, outgoing, internal_attributes, config, base_url, name, external_type, user_id_attr):
35+
def __init__(self, outgoing, logout, internal_attributes, config, base_url, name, external_type, user_id_attr):
3636
"""
3737
:param outgoing: Callback should be called by the module after the authorization in the
3838
backend is done.
@@ -52,7 +52,7 @@ def __init__(self, outgoing, internal_attributes, config, base_url, name, extern
5252
:type name: str
5353
:type external_type: str
5454
"""
55-
super().__init__(outgoing, internal_attributes, base_url, name)
55+
super().__init__(outgoing, logout, internal_attributes, base_url, name)
5656
self.config = config
5757
self.redirect_url = "%s/%s" % (self.config["base_url"], self.config["authz_page"])
5858
self.external_type = external_type
@@ -190,11 +190,13 @@ class FacebookBackend(_OAuthBackend):
190190
"""
191191
DEFAULT_GRAPH_ENDPOINT = "https://graph.facebook.com/v2.5/me"
192192

193-
def __init__(self, outgoing, internal_attributes, config, base_url, name):
193+
def __init__(self, outgoing, logout, internal_attributes, config, base_url, name):
194194
"""
195195
Constructor.
196196
:param outgoing: Callback should be called by the module after the authorization in the
197197
backend is done.
198+
:param logout: Callback should be called by the module after the logout in the backend is
199+
done.
198200
:param internal_attributes: Mapping dictionary between SATOSA internal attribute names and
199201
the names returned by underlying IdP's/OP's as well as what attributes the calling SP's and
200202
RP's expects namevice.
@@ -204,14 +206,16 @@ def __init__(self, outgoing, internal_attributes, config, base_url, name):
204206
205207
:type outgoing:
206208
(satosa.context.Context, satosa.internal.InternalData) -> satosa.response.Response
209+
:type logout:
210+
(satosa.context.Context, satosa.internal.InternalData) -> satosa.response.Response
207211
:type internal_attributes: dict[string, dict[str, str | list[str]]]
208212
:type config: dict[str, dict[str, str] | list[str] | str]
209213
:type base_url: str
210214
:type name: str
211215
"""
212216
config.setdefault("response_type", "code")
213217
config["verify_accesstoken_state"] = False
214-
super().__init__(outgoing, internal_attributes, config, base_url, name, "facebook", "id")
218+
super().__init__(outgoing, logout, internal_attributes, config, base_url, name, "facebook", "id")
215219

216220
def get_request_args(self, get_state=stateID):
217221
request_args = super().get_request_args(get_state=get_state)

src/satosa/backends/openid_connect.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class OpenIDConnectBackend(BackendModule):
3333
OIDC module
3434
"""
3535

36-
def __init__(self, auth_callback_func, internal_attributes, config, base_url, name):
36+
def __init__(self, auth_callback_func, logout_callback_func, internal_attributes, config, base_url, name):
3737
"""
3838
OIDC backend module.
3939
:param auth_callback_func: Callback should be called by the module after the authorization
@@ -52,8 +52,9 @@ def __init__(self, auth_callback_func, internal_attributes, config, base_url, na
5252
:type base_url: str
5353
:type name: str
5454
"""
55-
super().__init__(auth_callback_func, internal_attributes, base_url, name)
55+
super().__init__(auth_callback_func, logout_callback_func, internal_attributes, base_url, name)
5656
self.auth_callback_func = auth_callback_func
57+
self.logout_callback_func = logout_callback_func
5758
self.config = config
5859
self.client = _create_client(
5960
config["provider_metadata"],

src/satosa/backends/orcid.py

+7-2
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,12 @@
2121
class OrcidBackend(_OAuthBackend):
2222
"""Orcid OAuth 2.0 backend"""
2323

24-
def __init__(self, outgoing, internal_attributes, config, base_url, name):
24+
def __init__(self, outgoing, logout, internal_attributes, config, base_url, name):
2525
"""Orcid backend constructor
2626
:param outgoing: Callback should be called by the module after the
2727
authorization in the backend is done.
28+
:param logout: Callback should be called by the module after
29+
logout in the backend is done.
2830
:param internal_attributes: Mapping dictionary between SATOSA internal
2931
attribute names and the names returned by underlying IdP's/OP's as
3032
well as what attributes the calling SP's and RP's expects namevice.
@@ -34,6 +36,9 @@ def __init__(self, outgoing, internal_attributes, config, base_url, name):
3436
:type outgoing:
3537
(satosa.context.Context, satosa.internal.InternalData) ->
3638
satosa.response.Response
39+
:type logout:
40+
(satosa.context.Context, satosa.internal.InternalData) ->
41+
satosa.response.Response
3742
:type internal_attributes: dict[string, dict[str, str | list[str]]]
3843
:type config: dict[str, dict[str, str] | list[str] | str]
3944
:type base_url: str
@@ -42,7 +47,7 @@ def __init__(self, outgoing, internal_attributes, config, base_url, name):
4247
config.setdefault('response_type', 'code')
4348
config['verify_accesstoken_state'] = False
4449
super().__init__(
45-
outgoing, internal_attributes, config, base_url, name, 'orcid',
50+
outgoing, logout, internal_attributes, config, base_url, name, 'orcid',
4651
'orcid')
4752

4853
def get_request_args(self, get_state=stateID):

src/satosa/backends/reflector.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -16,23 +16,27 @@ class ReflectorBackend(BackendModule):
1616

1717
ENTITY_ID = ORG_NAME = AUTH_CLASS_REF = SUBJECT_ID = "reflector"
1818

19-
def __init__(self, outgoing, internal_attributes, config, base_url, name):
19+
def __init__(self, outgoing, logout, internal_attributes, config, base_url, name):
2020
"""
2121
:type outgoing:
2222
(satosa.context.Context, satosa.internal.InternalData) -> satosa.response.Response
23+
:type logout:
24+
2325
:type internal_attributes: dict[str, dict[str, list[str] | str]]
2426
:type config: dict[str, Any]
2527
:type base_url: str
2628
:type name: str
2729
2830
:param outgoing: Callback should be called by the module after
2931
the authorization in the backend is done.
32+
:param logout: Callback should be called by the module after logout
33+
in the backend is done.
3034
:param internal_attributes: Internal attribute map
3135
:param config: The module config
3236
:param base_url: base url of the service
3337
:param name: name of the plugin
3438
"""
35-
super().__init__(outgoing, internal_attributes, base_url, name)
39+
super().__init__(outgoing, logout, internal_attributes, base_url, name)
3640

3741
def start_auth(self, context, internal_req):
3842
"""

0 commit comments

Comments
 (0)