IEEE.org     |     IEEE Xplore Digital Library     |     IEEE Standards     |     IEEE Spectrum     |     More Sites

Verified Commit d2ec35e7 authored by Emi Simpson's avatar Emi Simpson
Browse files

[api] Updated the Authentication to work with the new changes

parent b945905f
Pipeline #1089 passed with stage
in 48 seconds
......@@ -56,7 +56,7 @@
### Authentication
* **sso:** `Optional[str]` (valid url) - If SSO is enabled, the URL to direct the user to authenticate
* **sso:** `bool` - Indicates that SSO is enabled
* **direct:** `bool` - Indicates that direct auth is available
### Session
......
......@@ -90,6 +90,11 @@ class AuthModule:
some information about what their username is.
"""
mock_saml_auth: bool
"""
If true, replaces SAML login with an identical flow that uses the local database
"""
def get_auth_dict(self) -> Response:
"""
The `GET /api/v1/auth` method
......@@ -98,7 +103,7 @@ class AuthModule:
"""
return R(HTTPStatus.OK, Auth(
direct=self.direct_auth_enabled,
sso=self.saml_login_url is not None
sso=self.saml_login_url is not None or self.mock_saml_auth
)).to_response()
def post_login(self, req: ApiJsonRequest) -> R[MismatchedTypeError | MissingFieldsError] | Query[R[Session], R[UserDneError | BadPasswordError | InternalError | UnknownError]]:
......
......@@ -154,9 +154,9 @@ def create_app(test_config: Optional[Dict[str, Any]] = None) -> Flask:
auth_module = cast(AuthModule, app.config['AUTH'])
if isinstance(auth_module, SamlAuth):
app.register_blueprint(v1_auth.AuthModule(True, auth_module.get_login_url()).get_blueprint())
app.register_blueprint(v1_auth.AuthModule(True, auth_module.get_login_url(), False).get_blueprint())
else:
app.register_blueprint(v1_auth.AuthModule(True, None).get_blueprint())
app.register_blueprint(v1_auth.AuthModule(True, None, True).get_blueprint())
views.register_error_pages(app)
app.jinja_env.globals.update(uuid=uuid.uuid4)
app.jinja_env.globals.update(high_contrast=is_high_contrast)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment