From 62f28bae535d5587df53e14d74619747915b178e Mon Sep 17 00:00:00 2001 From: jacquesfize Date: Tue, 16 Jul 2024 15:50:17 +0200 Subject: [PATCH] cleaning code and debug cas inpn --- .../auth/providers/cas_inpn_provider.py | 13 ++----------- src/pypnusershub/auth/providers/openid_provider.py | 3 --- .../auth/providers/usershub_provider.py | 1 - 3 files changed, 2 insertions(+), 15 deletions(-) diff --git a/src/pypnusershub/auth/providers/cas_inpn_provider.py b/src/pypnusershub/auth/providers/cas_inpn_provider.py index 405e5a7..799b116 100644 --- a/src/pypnusershub/auth/providers/cas_inpn_provider.py +++ b/src/pypnusershub/auth/providers/cas_inpn_provider.py @@ -16,7 +16,6 @@ class AuthenficationCASINPN(Authentication): - name = "CAS_INPN_PROVIDER" label = "INPN" is_external = True logo = "" @@ -54,20 +53,15 @@ def authorize(self): user = xml_dict["cas:serviceResponse"]["cas:authenticationSuccess"][ "cas:user" ] - if not user: log.info("Erreur d'authentification lié au CAS, voir log du CAS") log.error("Erreur d'authentification lié au CAS, voir log du CAS") - return render_template( - "cas_login_error.html", - cas_logout=self.URL_LOGOUT, - url_geonature=current_app.config["URL_APPLICATION"], - ) + return redirect(self.logout_url) ws_user_url = f"{self.URL_INFO}/{user}/?verify=false" response = requests.get( ws_user_url, - ( + auth=( self.WS_ID, self.WS_PASSWORD, ), @@ -144,9 +138,6 @@ class CASINPNConfiguration(ProviderConfigurationSchema): URL_VALIDATION = fields.String( load_default="https://inpn.mnhn.fr/auth/serviceValidate" ) - URL_AUTHORIZE = fields.String( - load_default="https://inpn.mnhn.fr/authentication/" - ) URL_INFO = fields.String( load_default="https://inpn.mnhn.fr/authentication/information", ) diff --git a/src/pypnusershub/auth/providers/openid_provider.py b/src/pypnusershub/auth/providers/openid_provider.py index ee39821..4567dd8 100644 --- a/src/pypnusershub/auth/providers/openid_provider.py +++ b/src/pypnusershub/auth/providers/openid_provider.py @@ -16,7 +16,6 @@ class OpenIDProvider(Authentication): """ - name = "OPENID_PROVIDER_CONFIG" logo = '' is_external = True """ @@ -106,8 +105,6 @@ class OpenIDConnectProvider(OpenIDProvider): """ - name = "OPENID_CONNECT_PROVIDER_CONFIG" - def revoke(self): if not "openid_token_resp" in session: diff --git a/src/pypnusershub/auth/providers/usershub_provider.py b/src/pypnusershub/auth/providers/usershub_provider.py index e24f769..b4f35c8 100644 --- a/src/pypnusershub/auth/providers/usershub_provider.py +++ b/src/pypnusershub/auth/providers/usershub_provider.py @@ -13,7 +13,6 @@ class ExternalUsersHubAuthProvider(Authentication): Authentication provider for Flask application using UsersHub-authentification-module. """ - name = "EXTERNAL_USERSHUB_PROVIDER_CONFIG" logo = '' is_external = False