33
44import structlog
55from csh_ldap import CSHLDAP
6- from flask import Flask , redirect , render_template , request , g
6+ from flask import Flask , redirect , render_template , g
77from flask_migrate import Migrate
88from flask_gzip import Gzip
99from flask_pyoidc .flask_pyoidc import OIDCAuthentication
10- from flask_pyoidc .provider_configuration import ProviderConfiguration , ClientMetadata
1110from flask_sqlalchemy import SQLAlchemy
1211
1312import sentry_sdk
4039 app .config ['LDAP_BIND_PW' ],
4140 ro = app .config ['LDAP_RO' ])
4241
43- client_metadata = ClientMetadata (app .config ["OIDC_CLIENT_CONFIG" ])
44- provider_config = ProviderConfiguration (issuer = app .config ["OIDC_ISSUER" ], client_registration_info = client_metadata )
45-
46- auth = OIDCAuthentication ({'default' : provider_config }, app )
42+ auth = OIDCAuthentication (app , issuer = app .config ["OIDC_ISSUER" ],
43+ client_registration_info = app .config ["OIDC_CLIENT_CONFIG" ])
4744
4845app .secret_key = app .config ["SECRET_KEY" ]
4946
@@ -58,6 +55,7 @@ def start_of_year():
5855# pylint: disable=C0413
5956from .models .models import UserLog
6057
58+
6159# Configure Logging
6260def request_processor (logger , log_method , event_dict ): # pylint: disable=unused-argument, redefined-outer-name
6361 if 'request' in event_dict :
@@ -101,7 +99,6 @@ def database_processor(logger, log_method, event_dict): # pylint: disable=unuse
10199# pylint: disable=wrong-import-order
102100from conditional .util import context_processors
103101from conditional .util .auth import get_user
104- from conditional .util .member import gatekeep_status
105102from .blueprints .dashboard import dashboard_bp # pylint: disable=ungrouped-imports
106103from .blueprints .attendance import attendance_bp
107104from .blueprints .major_project_submission import major_project_bp
@@ -140,7 +137,7 @@ def static_proxy(path):
140137
141138
142139@app .route ('/' )
143- @auth .oidc_auth ( "default" )
140+ @auth .oidc_auth
144141def default_route ():
145142 return redirect ('/dashboard' )
146143
@@ -159,25 +156,12 @@ def health():
159156 return {'status' : 'ok' }
160157
161158
162- @app .route ("/gatekeep/<username>" )
163- def gatekeep (username ):
164- token = request .headers .get ("X-VOTE-TOKEN" , "" )
165- if token != app .config ["VOTE_TOKEN" ]:
166- return "Users cannot access this page" , 403
167- try :
168- gatekeep_data = gatekeep_status (username )
169- except KeyError :
170- return "" , 404
171-
172- return gatekeep_data , 200
173-
174-
175159@app .errorhandler (404 )
176160@app .errorhandler (500 )
177- @auth .oidc_auth ( "default" )
161+ @auth .oidc_auth
178162@get_user
179163def route_errors (error , user_dict = None ):
180- data = {}
164+ data = dict ()
181165
182166 # Handle the case where the header isn't present
183167 if user_dict ['username' ] is not None :
0 commit comments