Skip to content

Conversation

@nobuQuartile
Copy link
Contributor

@nobuQuartile nobuQuartile commented Jan 15, 2025

Copy link
Member

@yostashiro yostashiro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nobuQuartile Can you please rename the module to auth_oauth_enforced? Please also fix the pre-commit error.

@nobuQuartile nobuQuartile force-pushed the 4777-add-auth_oauth_force_oauth branch 2 times, most recently from b8bbef1 to f249ccc Compare January 15, 2025 06:48
@nobuQuartile nobuQuartile changed the title [4777][ADD] auth_oauth_force_oauth [4777][ADD] auth_oauth_enforced Jan 15, 2025
@nobuQuartile nobuQuartile force-pushed the 4777-add-auth_oauth_force_oauth branch from f249ccc to afe7cf9 Compare January 15, 2025 06:51
@nobuQuartile
Copy link
Contributor Author

@yostashiro
Thank you for your review. The name you created is nice. I rename the module.
I changed the reference to axls-custom in the readme to thc-oca. I checked if all URLs were working and found that only “https://github.com/qrtl/thc-oca/tree/16.0/auth_oauth_enforced” URL was not working. But I think this will be available when this module is merged.

Copy link
Member

@yostashiro yostashiro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nobuQuartile Please add CONFIGURE.md (and USAGE.md and CONTEXT.md as appropriate).

Comment on lines 1 to 3
This module controls login methods by email domain, requiring OAuth for
specified domains, as defined in company
settings.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's avoid random line breaks.

Suggested change
This module controls login methods by email domain, requiring OAuth for
specified domains, as defined in company
settings.
This module controls login methods by email domain, requiring OAuth for specified
domains, as defined in company settings.

@nobuQuartile nobuQuartile force-pushed the 4777-add-auth_oauth_force_oauth branch 2 times, most recently from d217c65 to 4e095ae Compare January 15, 2025 07:47
@nobuQuartile nobuQuartile force-pushed the 4777-add-auth_oauth_force_oauth branch 2 times, most recently from fafe793 to daabfd5 Compare January 20, 2025 09:44
Copy link
Member

@yostashiro yostashiro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nobuQuartile The commits shouldn't have squashed for this PR. It makes it hard to see what changes you have made.

@@ -0,0 +1 @@
To streamline security practices, many companies are adopting an OAuth-only login policy, reducing risks associated with managing multiple passwords. However, in B2B scenarios—such as when third-party service providers like accounting firms require access to Odoo—enforcing OAuth exclusively can lead to operational inefficiencies, as third parties may need to create and manage dedicated accounts for this purpose. To overcome this challenge, implementing domain-specific OAuth enforcement offers a more flexible and targeted solution. No newline at end of file
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make it more concise as it sounds a bit too verbose (the last sentence sounds very ChatGPTish and we don't want that), and apply the 88-char max length for better readability, although it's not required by the linter.

Comment on lines 1 to 3
1. Navigate to Settings → Companies → Update Info to open your company's form view.
2. In the General Information tab, locate the field Force OAuth Domains.
3. Enter the domain names you want to block in login IDs. You can specify multiple domains by separating them with commas (,).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These steps should be in CONFIGURE.md.

Step 3 sounds incorrect.

1. Navigate to Settings → Companies → Update Info to open your company's form view.
2. In the General Information tab, locate the field Force OAuth Domains.
3. Enter the domain names you want to block in login IDs. You can specify multiple domains by separating them with commas (,).
4. Once configured, users with emails from the blocked domains will be restricted from logging in. Additionally, if a user tries to access the company's admin panel with a password instead of OAuth, they will see the notification: "You are not allowed to login with password. Please use OAuth login." No newline at end of file
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This sounds incorrect or doesn't clearly tell what the module does.

@nobuQuartile nobuQuartile force-pushed the 4777-add-auth_oauth_force_oauth branch 2 times, most recently from da15744 to a8d5063 Compare January 23, 2025 07:59
@nobuQuartile
Copy link
Contributor Author

I fixed some point.

@nobuQuartile nobuQuartile force-pushed the 4777-add-auth_oauth_force_oauth branch 4 times, most recently from 7c225d2 to 0612927 Compare January 23, 2025 08:12
@nobuQuartile
Copy link
Contributor Author

I fixed some point.

@nobuQuartile nobuQuartile force-pushed the 4777-add-auth_oauth_force_oauth branch 2 times, most recently from bf5a0ad to 049bc8e Compare January 23, 2025 09:23
@nobuQuartile
Copy link
Contributor Author

I fixed the USAGE.

Comment on lines 1 to 3
Users with a blocked domain in their login ID cannot log in with a password
and will receive a notification on the login page if they attempt this,
instructing them to use OAuth instead. No newline at end of file
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For better flow (IMO).

Suggested change
Users with a blocked domain in their login ID cannot log in with a password
and will receive a notification on the login page if they attempt this,
instructing them to use OAuth instead.
On the login page, users with a blocked domain in their login will receive an error
message directing them to use OAuth login instead, if they attempt to log in with a
password.

@@ -0,0 +1,4 @@
1. Navigate to Settings → Companies → Update Info to open your company's form view.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
1. Navigate to Settings → Companies → Update Info to open your company's form view.
1. Navigate to *Settings > Users & Companies > Companies*.

@@ -0,0 +1,4 @@
1. Navigate to Settings → Companies → Update Info to open your company's form view.
2. In the General Information tab, locate the field Force OAuth Domains.
3. Enter the domain names you want to block for email-based login IDs.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
3. Enter the domain names you want to block for email-based login IDs.
3. Enter the domain names you wish to block for password-based login, i.e., users with
a login that matches the domains listed here will not be able to log in with a password.

Comment on lines 1 to 3
For example, some companies may have wanted to enforce OAuth for their users.
On the other hand, there may be those who prefer not to enforce OAuth for users
such as stakeholders accessing the portal. No newline at end of file
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
For example, some companies may have wanted to enforce OAuth for their users.
On the other hand, there may be those who prefer not to enforce OAuth for users
such as stakeholders accessing the portal.
Sometimes, you may want to enforce OAuth login for your employees for security reasons,
while it may not be appropriate to do so for portal users. This module intends to
address this need.

Comment on lines 1 to 2
This module controls login methods by email domain, requiring OAuth for
specified domains, as defined in company settings. No newline at end of file
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
This module controls login methods by email domain, requiring OAuth for
specified domains, as defined in company settings.
This module enforces OAuth login for users with specific domains listed in the company
settings.

@nobuQuartile nobuQuartile force-pushed the 4777-add-auth_oauth_force_oauth branch from 3b0a54a to a8d13ef Compare January 24, 2025 05:45
@nobuQuartile
Copy link
Contributor Author

@yostashiro
I fixed the parts you mentioned & rebase it.


@api.model
def _is_allowed_password_login(self):
force_domains = self.company_id.force_oauth_domains
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
force_domains = self.company_id.force_oauth_domains
# Skip enforcing the password login in Odoo.sh staging instances as their URIs are not predictable.
if self.env["ir.config_parameter"].sudo().get_param("database.is_neutralized"):
return True
force_domains = self.company_id.force_oauth_domains

@nobuQuartile
Copy link
Contributor Author

@yostashiro
Sorry for the late update the code.
After testing in a modified development environment, OAuth was forced without any problems.
I will applies to Odoo.sh development environment.

@nobuQuartile
Copy link
Contributor Author

I have the behaviour test in the staging env.
I've confirmed that users with e-mail domains where this module enforces OAuth can log in with a password.

@nobuQuartile nobuQuartile changed the title [4777][ADD] auth_oauth_enforced [5188][ADD] auth_oauth_enforced Mar 3, 2025
@nobuQuartile
Copy link
Contributor Author

The ticket number has been changed. Please update the commit message when this PR is merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants