Skip to content

[improvement](fe) Support LDAP default roles#63411

Open
Jungzhang wants to merge 1 commit into
apache:masterfrom
Jungzhang:ldap-default-roles
Open

[improvement](fe) Support LDAP default roles#63411
Jungzhang wants to merge 1 commit into
apache:masterfrom
Jungzhang:ldap-default-roles

Conversation

@Jungzhang
Copy link
Copy Markdown

@Jungzhang Jungzhang commented May 19, 2026

What problem does this PR solve?

Issue Number: N/A

Related PR: N/A

Problem Summary:

LDAP temporary users could only receive roles mapped from LDAP groups and the built-in information_schema-only role. This PR adds ldap_default_roles so every LDAP-authenticated user can receive configured Doris roles while still keeping LDAP group roles.

Release note

Support configuring default Doris roles for LDAP-authenticated users through ldap_default_roles.

Check List (For Author)

  • Test

    • Regression test
    • Unit Test
      • Ran env PATH=/private/tmp/doris-brew-shim:/opt/homebrew/bin:/usr/bin:/bin:/usr/sbin:/sbin FE_UT_PARALLEL=1 JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk-17.jdk/Contents/Home CUSTOM_MVN=/Users/zhanggen/.m2/wrapper/dists/apache-maven-3.9.5-bin/32db9c34/apache-maven-3.9.5/bin/mvn ./run-fe-ut.sh --run 'org.apache.doris.mysql.authenticate.ldap.LdapManagerTest#testGetUserInfoWithLdapDefaultRoles'
      • Ran env PATH=/private/tmp/doris-brew-shim:/opt/homebrew/bin:/usr/bin:/bin:/usr/sbin:/sbin FE_UT_PARALLEL=1 JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk-17.jdk/Contents/Home CUSTOM_MVN=/Users/zhanggen/.m2/wrapper/dists/apache-maven-3.9.5-bin/32db9c34/apache-maven-3.9.5/bin/mvn ./run-fe-ut.sh --run org.apache.doris.mysql.authenticate.ldap.LdapManagerTest
      • Ran env JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk-17.jdk/Contents/Home /Users/zhanggen/.m2/wrapper/dists/apache-maven-3.9.5-bin/32db9c34/apache-maven-3.9.5/bin/mvn checkstyle:check -pl fe-core
    • Manual test
    • No need to test or manual test. Explain why:
      • This is a refactor/code format and no logic has been changed.
      • Previous test can cover this change.
      • No code files have been changed.
      • Other reason
  • Behavior changed:

    • No.
    • Yes. LDAP-authenticated users can receive configured default Doris roles in addition to LDAP group roles, and online updates of ldap_default_roles refresh the LDAP user cache.
  • Does this need documentation?

Check List (For Reviewer who merge this PR)

  • Confirm the release note
  • Confirm test cases
  • Confirm document
  • Add branch pick label

Issue Number: N/A

Related PR: N/A

Problem Summary: LDAP temporary users could only receive roles mapped from LDAP groups and the built-in information_schema-only role. Add ldap_default_roles so every LDAP-authenticated user can receive configured Doris roles while still keeping LDAP group roles.

Support configuring default Doris roles for LDAP-authenticated users through ldap_default_roles.

- Test: Unit Test
    - Ran `env PATH=/private/tmp/doris-brew-shim:/opt/homebrew/bin:/usr/bin:/bin:/usr/sbin:/sbin FE_UT_PARALLEL=1 JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk-17.jdk/Contents/Home CUSTOM_MVN=/Users/zhanggen/.m2/wrapper/dists/apache-maven-3.9.5-bin/32db9c34/apache-maven-3.9.5/bin/mvn ./run-fe-ut.sh --run 'org.apache.doris.mysql.authenticate.ldap.LdapManagerTest#testGetUserInfoWithLdapDefaultRoles'`
    - Ran `env PATH=/private/tmp/doris-brew-shim:/opt/homebrew/bin:/usr/bin:/bin:/usr/sbin:/sbin FE_UT_PARALLEL=1 JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk-17.jdk/Contents/Home CUSTOM_MVN=/Users/zhanggen/.m2/wrapper/dists/apache-maven-3.9.5-bin/32db9c34/apache-maven-3.9.5/bin/mvn ./run-fe-ut.sh --run org.apache.doris.mysql.authenticate.ldap.LdapManagerTest`
    - Ran `env JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk-17.jdk/Contents/Home /Users/zhanggen/.m2/wrapper/dists/apache-maven-3.9.5-bin/32db9c34/apache-maven-3.9.5/bin/mvn checkstyle:check -pl fe-core`
- Behavior changed: Yes. LDAP-authenticated users can receive configured default Doris roles in addition to LDAP group roles, and online updates of ldap_default_roles refresh LDAP user cache.
- Does this need documentation: Yes. Added ldap.conf template entry.
@hello-stephen
Copy link
Copy Markdown
Contributor

Thank you for your contribution to Apache Doris.
Don't know what should be done next? See How to process your PR.

Please clearly describe your PR:

  1. What problem was fixed (it's best to include specific error reporting information). How it was fixed.
  2. Which behaviors were modified. What was the previous behavior, what is it now, why was it modified, and what possible impacts might there be.
  3. What features were added. Why was this function added?
  4. Which code was refactored and why was this part of the code refactored?
  5. Which functions were optimized and what is the difference before and after the optimization?

@Jungzhang
Copy link
Copy Markdown
Author

run buildall

@hello-stephen
Copy link
Copy Markdown
Contributor

TPC-H: Total hot run time: 31028 ms
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpch-tools
Tpch sf100 test result on commit ecff0457699528a9b298405b1668e9d0867182a3, data reload: false

------ Round 1 ----------------------------------
orders	Doris	NULL	NULL	0	0	0	NULL	0	NULL	NULL	2023-12-26 18:27:23	2023-12-26 18:42:55	NULL	utf-8	NULL	NULL	
============================================
q1	17627	3903	3864	3864
q2	q3	10780	1363	790	790
q4	4687	475	356	356
q5	7620	2224	2123	2123
q6	271	179	139	139
q7	975	786	622	622
q8	9395	1741	1575	1575
q9	6600	4920	4859	4859
q10	6425	2108	1825	1825
q11	435	274	253	253
q12	697	426	298	298
q13	18211	3791	2771	2771
q14	262	260	236	236
q15	q16	820	765	701	701
q17	976	969	963	963
q18	6941	5739	5528	5528
q19	1218	1360	1173	1173
q20	523	403	256	256
q21	5804	2622	2386	2386
q22	434	365	310	310
Total cold run time: 100701 ms
Total hot run time: 31028 ms

----- Round 2, with runtime_filter_mode=off -----
orders	Doris	NULL	NULL	150000000	42	6422171781	NULL	22778155	NULL	NULL	2023-12-26 18:27:23	2023-12-26 18:42:55	NULL	utf-8	NULL	NULL	
============================================
q1	4194	4171	4140	4140
q2	q3	4458	4893	4280	4280
q4	2086	2222	1387	1387
q5	4367	4279	4308	4279
q6	231	181	156	156
q7	2182	1859	1627	1627
q8	2497	2123	2041	2041
q9	7851	7729	7644	7644
q10	4560	4474	4057	4057
q11	565	417	532	417
q12	742	737	521	521
q13	3279	3590	3005	3005
q14	301	305	291	291
q15	q16	729	729	635	635
q17	1357	1301	1385	1301
q18	8051	7250	6731	6731
q19	1125	1077	1075	1075
q20	2218	2202	1922	1922
q21	5339	4651	4463	4463
q22	535	466	434	434
Total cold run time: 56667 ms
Total hot run time: 50406 ms

@hello-stephen
Copy link
Copy Markdown
Contributor

TPC-DS: Total hot run time: 170218 ms
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpcds-tools
TPC-DS sf100 test result on commit ecff0457699528a9b298405b1668e9d0867182a3, data reload: false

query5	4329	656	514	514
query6	324	221	200	200
query7	4299	570	307	307
query8	327	231	227	227
query9	8790	4098	4058	4058
query10	442	340	282	282
query11	5777	2427	2182	2182
query12	183	133	129	129
query13	1273	661	403	403
query14	6003	5329	5034	5034
query14_1	4328	4318	4406	4318
query15	211	201	184	184
query16	980	474	420	420
query17	1131	709	590	590
query18	2446	481	355	355
query19	220	210	162	162
query20	158	129	131	129
query21	212	141	119	119
query22	13629	13510	13521	13510
query23	17160	16475	16028	16028
query23_1	16254	16127	16144	16127
query24	7372	1752	1303	1303
query24_1	1312	1303	1327	1303
query25	570	510	450	450
query26	1315	334	180	180
query27	2715	592	355	355
query28	4475	1966	1999	1966
query29	1005	660	522	522
query30	306	245	204	204
query31	1136	1069	947	947
query32	101	82	75	75
query33	553	370	314	314
query34	1184	1164	634	634
query35	774	812	728	728
query36	1354	1359	1120	1120
query37	153	104	90	90
query38	3232	3165	3090	3090
query39	933	929	907	907
query39_1	866	884	903	884
query40	242	155	134	134
query41	75	72	69	69
query42	117	114	117	114
query43	344	327	293	293
query44	
query45	217	204	197	197
query46	1077	1221	738	738
query47	2348	2364	2206	2206
query48	402	424	299	299
query49	662	513	403	403
query50	991	364	252	252
query51	4332	4222	4239	4222
query52	109	111	97	97
query53	262	291	219	219
query54	338	287	282	282
query55	100	93	89	89
query56	329	324	327	324
query57	1407	1408	1263	1263
query58	324	294	285	285
query59	1580	1637	1405	1405
query60	360	368	303	303
query61	156	153	148	148
query62	694	622	566	566
query63	236	202	210	202
query64	2406	798	613	613
query65	
query66	1755	472	358	358
query67	30015	29953	29734	29734
query68	
query69	475	342	331	331
query70	1035	1006	985	985
query71	318	287	276	276
query72	3017	2654	2653	2653
query73	846	771	441	441
query74	5071	4898	4683	4683
query75	2666	2582	2248	2248
query76	2310	1161	757	757
query77	393	393	340	340
query78	12160	12117	11506	11506
query79	1507	1057	768	768
query80	1288	555	472	472
query81	515	278	238	238
query82	984	161	124	124
query83	321	278	245	245
query84	259	141	113	113
query85	952	527	443	443
query86	568	328	351	328
query87	3452	3352	3239	3239
query88	3552	2658	2661	2658
query89	449	384	339	339
query90	1901	181	194	181
query91	210	164	139	139
query92	82	80	75	75
query93	1638	1399	854	854
query94	719	339	311	311
query95	689	477	350	350
query96	1030	736	362	362
query97	2685	2679	2548	2548
query98	238	231	229	229
query99	1114	1112	1009	1009
Total cold run time: 254178 ms
Total hot run time: 170218 ms

@hello-stephen
Copy link
Copy Markdown
Contributor

FE Regression Coverage Report

Increment line coverage 0.00% (0/19) 🎉
Increment coverage report
Complete coverage report

@Jungzhang
Copy link
Copy Markdown
Author

run feut

@Jungzhang
Copy link
Copy Markdown
Author

run nonConcurrent

@Jungzhang
Copy link
Copy Markdown
Author

@morningman PTAL when you have time. Could you also help trigger /review for this PR? Thanks.

@hello-stephen
Copy link
Copy Markdown
Contributor

FE Regression Coverage Report

Increment line coverage 0.00% (0/34) 🎉
Increment coverage report
Complete coverage report

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.

2 participants