bito-code-review[bot] commented on code in PR #38606:
URL: https://github.com/apache/superset/pull/38606#discussion_r2927458005
##########
superset/views/base.py:
##########
@@ -505,6 +507,16 @@ def cached_common_bootstrap_data( # pylint:
disable=unused-argument
}
)
frontend_config["AUTH_PROVIDERS"] = oauth_providers
+ elif auth_type == AUTH_SAML:
+ saml_providers = []
+ for provider in appbuilder.sm.saml_providers:
+ saml_providers.append(
+ {
+ "name": provider["name"],
+ "icon": provider.get("icon", "fa-sign-in"),
+ }
+ )
+ frontend_config["AUTH_PROVIDERS"] = saml_providers
Review Comment:
<div>
<div id="suggestion">
<div id="issue"><b>Undefined saml_providers attribute</b></div>
<div id="fix">
Accessing appbuilder.sm.saml_providers assumes SAML support exists in
Flask-AppBuilder, but it doesn't in version 5.x.
</div>
</div>
<small><i>Code Review Run #d2fb23</i></small>
</div>
---
Should Bito avoid suggestions like this for future reviews? (<a
href=https://alpha.bito.ai/home/ai-agents/review-rules>Manage Rules</a>)
- [ ] Yes, avoid them
##########
superset-frontend/src/pages/Login/Login.test.tsx:
##########
@@ -53,3 +57,22 @@ test('should render form instruction text', () => {
screen.getByText('Enter your login and password below:'),
).toBeInTheDocument();
});
+
+test('should render SAML provider buttons', () => {
+ mockBootstrapOverride = {
+ common: {
+ conf: {
+ AUTH_TYPE: 5,
+ AUTH_PROVIDERS: [
+ { name: 'okta', icon: 'okta' },
+ { name: 'onelogin', icon: 'onelogin' },
+ ],
+ AUTH_USER_REGISTRATION: false,
+ },
+ },
+ };
+ render(<Login />, { useRedux: true });
+ expect(screen.getByText('Sign in with Okta')).toBeInTheDocument();
+ expect(screen.getByText('Sign in with Onelogin')).toBeInTheDocument();
+ mockBootstrapOverride = null;
+});
Review Comment:
<div>
<div id="suggestion">
<div id="issue"><b>Incomplete test assertions for SAML login
behavior</b></div>
<div id="fix">
The test 'should render SAML provider buttons' only checks that specific
text appears in the document, but does not validate the core behavior of
generating correct login URLs for the providers. To assert the actual logic,
consider checking the button elements' href attributes (e.g.,
expect(screen.getByRole('link', { name: /Sign in with Okta/
})).toHaveAttribute('href', '/login/okta')). This prevents bugs in URL
generation from going undetected.
</div>
</div>
<small><i>Code Review Run #d2fb23</i></small>
</div>
---
Should Bito avoid suggestions like this for future reviews? (<a
href=https://alpha.bito.ai/home/ai-agents/review-rules>Manage Rules</a>)
- [ ] Yes, avoid them
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]