mirror of
https://github.com/SuiteCRM/SuiteCRM.git
synced 2026-03-02 19:16:58 -05:00
API Access Token Does Not Respect External Auth #4461
Labels
No labels
Area: API
Area: Campaigns
Area: Cases
Area: Clean Up
Area: Clean Up: Performance
Area: Dashlets
Area: Databases
Area: Developer Tools
Area: Elasticsearch
Area: Elasticsearch
Area: Emails
Area: Emails:Campaigns
Area: Emails:Cases
Area: Emails:Compose
Area: Emails:Config
Area: Emails:Templates
Area: Environment
Area: Installation
Area: Language
Area: Mobile
Area: Module
Area: PDFs
Area: PHP8
Area: Reports
Area: Studio
Area: Styling
Area: Upgrading
Area: Workflow
Area:Activity Stream
Area:Calls
Area:Import
Area:Projects
Area:Search
Area:Surveys
Area:Themes
Area:Users
Branch:Hotfix
Good First Issue
Hacktoberfest
Help Wanted
PR:Community Contribution
PR:Type:Enhancement
Priority:Critical
Priority:Important
Priority:Moderate
Severity: Major
Severity: Minor
Severity: Moderate
Status: Requires Code Review
Status: Requires Updates
Status: Stale
Status: Team Investigating
Status:Assessed
Status:Fix Proposed
Status:Needs Assessed
Status:Requires Automated Tests
Type: Bug
Type:Deprecated
Type:Discussion
Type:Duplicate
Type:Invalid
Type:Question
Type:Suggestion
Type:Suggestion
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/SuiteCRM-SuiteCRM#4461
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @SIN3R6Y on GitHub (Dec 9, 2020).
Issue
When using external authentication such as LDAP, a user using said external provider cannot generate an access token via the API. This comes down to this section of code in Api/V8/OAuth2/Repository/UserRepository.php
Here we are simply checking if the password is valid, not actually authenticating, so users with external auth such as LDAP cannot pass this check, as they have no local password.
Expected Behavior
Users with external auth should be able to generate an access token
Actual Behavior
The password check does not account for external auth, denying the user from getting an access token
Possible Fix
I see three options,
Actually attempt to authenticate the user on token generation, granted this may be slow, and complicated
When authenticating via the UI, set the users password in database to match the provided password if external auth succeeds. Granted if the user changes their external password, the would need to log into the main UI for the API password check to update.
Allow admins to set an API Key variable per user, use this as an alternative to a users password for the API only.
Steps to Reproduce
Pretty simple, just use ldap and try to generate an access token in the api for the ldap user.
Context
We use ldap as a central authentication mechanism, and are working on integrations to use CRM data in other applications. However, with ldap users, you essentially can't use the API at all.
Your Environment
@SIN3R6Y commented on GitHub (Dec 29, 2020):
We're likely going to attempt resolve this ourselves, and contribute the changes. It looks to us like proposed options 2 and 3 are most ideal? Is it possible to get any consensus on preference here?
@MrMontesa commented on GitHub (Oct 25, 2021):
We're currently running into the same issue. LDAP users cannot use the API so that we have to duplicate an LDAP user to a local user to make it work.
I have to admit that we're on an even older version (7.11.6) and still on API v4_1.