File tree Expand file tree Collapse file tree 2 files changed +12
-0
lines changed
fluss-common/src/main/java/org/apache/fluss/security/auth/sasl/authenticator Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -82,6 +82,12 @@ public String protocol() {
8282 @ Override
8383 public byte [] authenticate (byte [] data ) throws AuthenticationException {
8484 try {
85+ // Use Subject.doAs to bind the login subject to the current AccessControlContext.
86+ // This is required for Kerberos (GSSAPI) authentication because:
87+ // - GssKrb5Client.evaluateChallenge() -> GSSContextImpl.initSecContext()
88+ // retrieves the Subject via Subject.getSubject(AccessController.getContext())
89+ // to obtain Kerberos credentials (TGT and service tickets).
90+ // - Without Subject.doAs, GSSAPI cannot find the credentials and authentication fails.
8591 return Subject .doAs (
8692 loginManager .subject (),
8793 (PrivilegedExceptionAction <byte []>) () -> saslClient .evaluateChallenge (data ));
Original file line number Diff line number Diff line change @@ -139,6 +139,12 @@ public void matchProtocol(String protocol) {
139139 @ Override
140140 public byte [] evaluateResponse (byte [] token ) throws AuthenticationException {
141141 try {
142+ // Use Subject.doAs to bind the login subject to the current AccessControlContext.
143+ // This is required for Kerberos (GSSAPI) authentication because:
144+ // - GssKrb5Server.evaluateResponse() -> GSSContextImpl.acceptSecContext()
145+ // retrieves the Subject via Subject.getSubject(AccessController.getContext())
146+ // to obtain server credentials from the keytab for validating client service tickets.
147+ // - Without Subject.doAs, GSSAPI cannot find the credentials and authentication fails.
142148 return Subject .doAs (
143149 loginManager .subject (),
144150 (PrivilegedExceptionAction <byte []>) () -> saslServer .evaluateResponse (token ));
You can’t perform that action at this time.
0 commit comments