<@U0A71G31CDV> for LDAP group provider , can Starr...
# questions-and-troubleshooting
m
@Rocky for LDAP group provider , can Starrocks authenticate by nested AD groups?
r
Based on the current StarRocks documentation (up to version 3.5), there is no explicit mention of native support for nested Active Directory (AD) groups in the LDAP Group Provider. The LDAP Group Provider (introduced in v3.5.0) relies on a mapping mechanism that typically works as follows: 1. Group Identification: StarRocks searches for group objects using the
ldap_group_filter
or
ldap_group_dn
defined in the
CREATE GROUP PROVIDER
statement. 2. Member Extraction: It extracts members from the group using the attribute specified in
ldap_group_member_attr
(usually
member
for AD or
memberUid
for POSIX). 3. Matching: It checks if the authenticated user's DN (Distinguished Name) or username exists in that member list. Why Nested Groups are usually not supported by default In Microsoft Active Directory, the
member
attribute of a group only contains the immediate members (direct users or direct child groups). It does not automatically list users belonging to those child groups. To support nested groups in LDAP, a system must either: * Recursively expand members (the StarRocks documentation does not indicate that the Group Provider performs this recursion). * Use the AD-specific OID filter
1.2.840.113556.1.4.1941
(Matching Rule In Chain). However, the
ldap_group_filter
in StarRocks is used to locate the group object itself, not to perform a membership check against a specific user during the search phase. Summary * Direct Groups: Supported. Users who are direct members of the specified LDAP/AD group will be correctly identified and mapped to StarRocks roles. * Nested Groups: Likely not supported natively. Users in a subgroup will not appear in the
member
attribute of the parent group, and StarRocks will not see them as part of the parent group. Recommendation: If you require nested group support, you may need to: 1. Flatten your group structure in AD so users are direct members. 2. Explicitly add the child groups to the
ldap_group_dn
list if they are few in number. 3. Verify with the StarRocks community or maintainers on GitHub if there are plans to support recursive group resolution or the AD-specific
memberOf
recursive filter. For further verification, you can refer to the official documentation on Authenticating User Groups. References • administration/user_privs/authentication/ldap_authentication.md • administration/user_privs/group_provider.md
m
How does oauth authentication work in starrocks? What group provider should I use when i am using oauth? @Rocky
How does oauth authentication work in starrocks? What group provider should I use when i am using oauth? @Rocky
r
OAuth 2.0 authentication in StarRocks (introduced in version 3.5.0) allows you to authenticate users through an external Authorization Server using the Authorization Code flow. How OAuth 2.0 Authentication Works 1. Redirection: When a user attempts to connect (via Web UI or a supported JDBC driver), the StarRocks coordinator redirects the browser to the external Authorization Server (e.g., Okta, Azure AD, Keycloak). 2. Authentication: The user logs in to the external server. 3. Authorization Code: Upon success, the browser is redirected back to StarRocks with an authorization code. 4. Token Exchange: StarRocks exchanges this code for an access token (JWT) from the token server. 5. Principal Mapping: StarRocks extracts a "principal" (username) from a specified field in the JWT (defined by
principal_field
, defaults to
sub
) and matches it to a StarRocks user. Group Providers for OAuth When using OAuth, StarRocks does not currently have a dedicated "OAuth Group Provider" that extracts group information directly from JWT claims (like a
groups
or
roles
claim). Instead, you should use one of the standard Group Providers to manage user-to-group mappings: 1. LDAP Group Provider (Recommended): Even if you authenticate via OAuth, StarRocks can look up the user's groups in your LDAP/AD server. This is the most common enterprise setup. 2. File Group Provider: Useful for static mappings where you define groups and their members (usernames) in a local configuration file on the FE. 3. Unix Group Provider: Maps users based on Linux system groups. Configuration Example To use OAuth with an external group (e.g., an LDAP group named
analysts
), the workflow is: 1. Create an LDAP Group Provider:
Copy code
sql
    CREATE GROUP PROVIDER my_ldap_groups PROPERTIES("type"="ldap", ...);
2. Grant roles to the external group:
Copy code
sql
    GRANT reports_role TO EXTERNAL GROUP analysts;
3. Authentication: When a user
tom
logs in via OAuth, StarRocks identifies him as
tom
, queries the
my_ldap_groups
provider to see if
tom
belongs to
analysts
, and if so, grants him the
reports_role
for that session. Note: Ensure that the
principal_field
extracted from the OAuth token matches the username/UID format expected by your chosen Group Provider. References • administration/user_privs/authentication/oauth2_authentication.md • administration/user_privs/group_provider.md • administration/user_privs/authentication/security_integration.md References • administration/user_privs/authentication/security_integration.md • administration/user_privs/group_provider.md
OAuth 2.0 authentication (introduced in v3.5.0) works by integrating StarRocks with an external Authorization Server (e.g., Keycloak, Okta, or Azure AD) using the standard Authorization Code flow. How OAuth Authentication Works 1. Redirection: When you connect via the Web UI or a supported JDBC driver, the StarRocks FE (coordinator) redirects your browser to the external Authorization Server. 2. Authentication: You log in to the external server using your credentials. 3. Token Exchange: After successful login, the server redirects you back to StarRocks with an authorization code. StarRocks then exchanges this code for a JWT (JSON Web Token). 4. Verification: StarRocks verifies the JWT's signature (using a JWKS URL or local public key) and checks fields like
iss
(issuer) and
aud
(audience). 5. Principal Identification: StarRocks extracts a "username" from the JWT using the
principal_field
(default is
sub
). This username must match the username created in StarRocks (e.g.,
CREATE USER tom IDENTIFIED WITH authentication_oauth2
). Which Group Provider to Use? Currently, StarRocks supports three types of group providers: LDAP, Unix, and File. Crucially, StarRocks does not yet have a native "OAuth Group Provider" that extracts groups directly from JWT claims (like a
groups
claim in the token). Instead, you must use one of the existing providers to "bridge" the identity from the token to actual group memberships: 1. LDAP Group Provider (Recommended): Use this if your OAuth server (like Keycloak or Okta) has a corresponding LDAP/AD interface. StarRocks will take the
principal_field
from the JWT and look it up in LDAP to find the user's groups. 2. File Group Provider: Use this for smaller setups where you can manually maintain a mapping of OAuth usernames to groups in a flat file (e.g.,
admin_group:user_sub_id_1,user_sub_id_2
). 3. Unix Group Provider: Use this if the users authenticated via OAuth also exist as local Unix users on the FE host. Configuration Workflow: 1. Create the Group Provider: Define how to fetch groups (e.g.,
CREATE GROUP PROVIDER my_ldap ...
). 2. Create the Security Integration: Define the OAuth 2.0 properties. 3. Link Them: Use
ALTER SECURITY INTEGRATION
to bind the group provider to your OAuth setup:
Copy code
sql
    ALTER SECURITY INTEGRATION my_oauth_integration SET
    (
        "group_provider" = "my_ldap_provider",
        "permitted_groups" = "bi_users, data_admins" -- Optional login filter
    );
Once linked, whenever a user logs in via OAuth, StarRocks identifies them by their JWT
sub
and automatically fetches their groups from the associated provider for use in authorization (e.g., in Apache Ranger). References • administration/user_privs/authentication/oauth2_authentication.md • administration/user_privs/group_provider.md • administration/user_privs/authentication/security_integration.md References • administration/user_privs/authentication/jwt_authentication.md • administration/user_privs/group_provider.md • administration/management/FE_configuration.md