RocketChat / RocketChat/Rocket.Chat

Restore Username Field template tags to Custom OAuth Config for non-nested attributes

Open
#13,480 10 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
46.1k
Forks
13.9k
Avg merge
3d 3h
Merged PRs (30d)
130

Description

Description:

As a RC_Admin, I would like custom oauth config to accept combination of various attributes similar to LDAP implementation so that non-nested attributes can be combined to provide username (ie #{givenName}.#{sn})

https://github.com/RocketChat/Rocket.Chat/issues/9051 removed required functionality that was added with https://github.com/RocketChat/Rocket.Chat/issues/3917.

Suggest logic be added to handle both use cases for getUserName
Here is the code that was removed for our needed use case.
https://github.com/RocketChat/Rocket.Chat/blob/c22467482123418604fe29ca9fef80e5fe0e3752/packages/rocketchat-custom-oauth/server/custom_oauth_server.js#L241

Steps to reproduce:
  1. Administration->OAuth
  2. Create custom oauth
  3. Set Username field: #{lastname}.#{firstname}.#{uid}
Expected behavior:

getUserName able to parse identity response data with fields like { "uid": "12345", "lastname": "Jones", "firstname": "Bob" } and create Jones.Bob.12345

Actual behavior:

username is undefined with current implementation and broke deployments counting on this functionality upon upgrading to newer version.

Server Setup Information:
  • Version of Rocket.Chat Server: 0.60.0 or later. Discovered on 0.69.2
Additional context

N/A

Relevant logs:

N/A

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the linked historical custom_oauth_server.js code around line 241 and trace the current Custom OAuth getUserName behavior. Reproduce the Administration→OAuth configuration with #{lastname}.#{firstname}.#{uid} and identity data containing uid, lastname, and firstname; done means it produces Jones.Bob.12345 instead of undefined.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
authentication
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.