Skip to content

RANGER-5499: Add support for header based authentication#873

Open
kumaab wants to merge 7 commits intoapache:masterfrom
kumaab:ranger_5499
Open

RANGER-5499: Add support for header based authentication#873
kumaab wants to merge 7 commits intoapache:masterfrom
kumaab:ranger_5499

Conversation

@kumaab
Copy link
Contributor

@kumaab kumaab commented Mar 12, 2026

What changes were proposed in this pull request?

Ranger servers currently support multiple authentication mechanisms, including Kerberos, username/password (LDAP, local users), JWT, SSO. To support deployments behind proxy servers that handle authentication, Ranger servers should support header based authentication. When this authentication is enabled, Ranger should look for configured HTTP headers to find the username and request-id.

How was this patch tested?

Pending CI

@kumaab kumaab self-assigned this Mar 12, 2026
@kumaab kumaab requested a review from mneethiraj March 12, 2026 22:09
@kumaab kumaab requested a review from mneethiraj March 13, 2026 20:34

private final Object principal;
private final AuthMechanism authMechanism;
private final int authType;
Copy link
Contributor

Choose a reason for hiding this comment

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

authType and authMechanism seem to capture the same details. For example, given a authMechanism can there be different authType values or vice-versa? If not, I suggest dropping authMechanism (and the enum) from here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Different authMechanism's can map to the sameauthType. for ex: both HEADER and KERBEROS authMechanism map to AUTH_TYPE_TRUSTED_PROXY authType. AuthMechanism can have more enum values once the existing filters migrate to use RangerAuthenticationToken.

Copy link
Contributor

Choose a reason for hiding this comment

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

Mapping for authMechanisms HEADER and KERBEROS to AUTH_TYPE_TRUSTED_PROXY doesn't seem correct. Consider the following mappings:

  • BASIC => XXAuthSession.AUTH_TYPE_PASSWORD
  • KERBEROS =>XXAuthSession.AUTH_TYPE_KERBEROS
  • SSO => XXAuthSession.AUTH_TYPE_SSO
  • HEADER => XXAuthSession.AUTH_TYPE_TRUSTED_PROXY

private final Object principal;
private final AuthMechanism authMechanism;
private final int authType;
private final String requestId;
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is it necessary to capture requestId in RangerAuthenticationToken? I sugest dropping it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's used in the last filter RangerSecurityContextFormationFilter:

String requestId = (auth instanceof RangerAuthenticationToken) ? ((RangerAuthenticationToken) auth).getRequestId() : null;

Copy link
Contributor

Choose a reason for hiding this comment

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

requestId shouldn't be tied to a session; instead it should be read from each request header.

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