2626
2727from spiffworkflow_backend .config .openid .rsa_keys import OpenIdConfigsForDevOnly
2828
29- openid_blueprint = Blueprint (
30- "openid" , __name__ , template_folder = "templates" , static_folder = "static"
31- )
29+ openid_blueprint = Blueprint ("openid" , __name__ , template_folder = "templates" , static_folder = "static" )
3230
3331OPEN_ID_CODE = ":this_is_not_secure_do_not_use_in_production"
3432SPIFF_OPEN_ID_KEY_ID = "spiffworkflow_backend_open_id"
@@ -79,10 +77,7 @@ def auth() -> str:
7977def form_submit () -> Any :
8078 """Handles the login form submission."""
8179 users = get_users ()
82- if (
83- request .values ["Uname" ] in users
84- and request .values ["Pass" ] == users [request .values ["Uname" ]]["password" ]
85- ):
80+ if request .values ["Uname" ] in users and request .values ["Pass" ] == users [request .values ["Uname" ]]["password" ]:
8681 # Redirect back to the end user with some detailed information
8782 state = request .values .get ("state" )
8883 data = {
@@ -112,9 +107,7 @@ def token() -> Response:
112107 code = request .values .get ("code" )
113108
114109 if code is None :
115- return make_response (
116- jsonify ({"error" : "missing_code_value_in_token_request" }), 400
117- )
110+ return make_response (jsonify ({"error" : "missing_code_value_in_token_request" }), 400 )
118111
119112 """We just stuffed the user name on the front of the code, so grab it."""
120113 user_name , secret_hash = code .split (":" )
@@ -168,9 +161,7 @@ def end_session() -> Response:
168161
169162@openid_blueprint .route ("/jwks" , methods = ["GET" ])
170163def jwks () -> Response :
171- public_key = base64 .b64encode (OpenIdConfigsForDevOnly .public_key .encode ()).decode (
172- "utf-8"
173- )
164+ public_key = base64 .b64encode (OpenIdConfigsForDevOnly .public_key .encode ()).decode ("utf-8" )
174165 jwks_configs = {
175166 "keys" : [
176167 {
@@ -195,9 +186,7 @@ def get_users() -> Any:
195186 """Load users from a local configuration file."""
196187 global permission_cache # noqa: PLW0603, allow global for performance
197188 if not permission_cache :
198- with open (
199- current_app .config ["SPIFFWORKFLOW_BACKEND_PERMISSIONS_FILE_ABSOLUTE_PATH" ]
200- ) as file :
189+ with open (current_app .config ["SPIFFWORKFLOW_BACKEND_PERMISSIONS_FILE_ABSOLUTE_PATH" ]) as file :
201190 permission_cache = yaml .safe_load (file )
202191 if "users" in permission_cache :
203192 return permission_cache ["users" ]
0 commit comments