Repository navigation
Restore deprecated DSE authentication API stubs #1237
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+1,059
−29
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
e10c40b
Restore deprecated DSE authentication API compatibility
dkropachev 2dbf8fd
Export restored DSE authentication APIs from both bundles
dkropachev 39421d6
Document migration from restored DSE authentication APIs
dkropachev d030db1
Scope legacy authentication validation to the selected provider
dkropachev c876bd9
Clarify legacy option ownership in migration guidance
dkropachev File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
core/src/main/java/com/datastax/dse/driver/api/core/auth/BaseDseAuthenticator.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one | ||
| * or more contributor license agreements. See the NOTICE file | ||
| * distributed with this work for additional information | ||
| * regarding copyright ownership. The ASF licenses this file | ||
| * to you under the Apache License, Version 2.0 (the | ||
| * "License"); you may not use this file except in compliance | ||
| * with the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
| package com.datastax.dse.driver.api.core.auth; | ||
|
|
||
| import com.datastax.oss.driver.api.core.auth.SyncAuthenticator; | ||
| import edu.umd.cs.findbugs.annotations.NonNull; | ||
| import edu.umd.cs.findbugs.annotations.Nullable; | ||
| import java.nio.ByteBuffer; | ||
| import java.util.Objects; | ||
| import net.jcip.annotations.ThreadSafe; | ||
|
|
||
| /** | ||
| * Base class retained for ordinary authentication by existing subclasses. | ||
| * | ||
| * @deprecated DSE authentication negotiation is no longer supported. | ||
| */ | ||
| @Deprecated | ||
| @ThreadSafe | ||
| public abstract class BaseDseAuthenticator implements SyncAuthenticator { | ||
|
|
||
| protected BaseDseAuthenticator(@NonNull String serverAuthenticator) { | ||
| if (Objects.requireNonNull(serverAuthenticator) | ||
| .equals("com.datastax.bdp.cassandra.auth.DseAuthenticator")) { | ||
| throw new UnsupportedOperationException( | ||
| "DSE authentication negotiation is no longer supported"); | ||
| } | ||
| } | ||
|
|
||
| @NonNull | ||
| protected abstract ByteBuffer getMechanism(); | ||
|
|
||
| @NonNull | ||
| protected abstract ByteBuffer getInitialServerChallenge(); | ||
|
|
||
| @Nullable | ||
| @Override | ||
| public ByteBuffer initialResponseSync() { | ||
| return evaluateChallengeSync(getInitialServerChallenge()); | ||
| } | ||
|
|
||
| @Override | ||
| public void onAuthenticationSuccessSync(@Nullable ByteBuffer token) {} | ||
| } | ||
188 changes: 188 additions & 0 deletions
188
core/src/main/java/com/datastax/dse/driver/api/core/auth/DseGssApiAuthProviderBase.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,188 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one | ||
| * or more contributor license agreements. See the NOTICE file | ||
| * distributed with this work for additional information | ||
| * regarding copyright ownership. The ASF licenses this file | ||
| * to you under the Apache License, Version 2.0 (the | ||
| * "License"); you may not use this file except in compliance | ||
| * with the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
| package com.datastax.dse.driver.api.core.auth; | ||
|
|
||
| import com.datastax.oss.driver.api.core.auth.AuthProvider; | ||
| import com.datastax.oss.driver.api.core.auth.Authenticator; | ||
| import com.datastax.oss.driver.api.core.metadata.EndPoint; | ||
| import edu.umd.cs.findbugs.annotations.NonNull; | ||
| import edu.umd.cs.findbugs.annotations.Nullable; | ||
| import java.nio.ByteBuffer; | ||
| import java.util.Map; | ||
| import javax.security.auth.Subject; | ||
| import javax.security.auth.login.Configuration; | ||
| import net.jcip.annotations.Immutable; | ||
| import net.jcip.annotations.NotThreadSafe; | ||
| import net.jcip.annotations.ThreadSafe; | ||
|
|
||
| /** @deprecated DSE GSSAPI authentication is no longer supported. */ | ||
| @Deprecated | ||
| @ThreadSafe | ||
| public abstract class DseGssApiAuthProviderBase implements AuthProvider { | ||
|
|
||
| public static final String DEFAULT_SASL_SERVICE_NAME = "dse"; | ||
| public static final String SASL_SERVICE_NAME_PROPERTY = "dse.sasl.service"; | ||
|
|
||
| protected DseGssApiAuthProviderBase(@NonNull String logPrefix) { | ||
| throw unsupported(); | ||
| } | ||
|
|
||
| @NonNull | ||
| protected abstract GssApiOptions getOptions( | ||
| @NonNull EndPoint endPoint, @NonNull String serverAuthenticator); | ||
|
|
||
| @NonNull | ||
| @Override | ||
| public Authenticator newAuthenticator( | ||
| @NonNull EndPoint endPoint, @NonNull String serverAuthenticator) { | ||
| throw unsupported(); | ||
| } | ||
|
|
||
| @Override | ||
| public void onMissingChallenge(@NonNull EndPoint endPoint) { | ||
| throw unsupported(); | ||
| } | ||
|
|
||
| @Override | ||
| public void close() {} | ||
|
|
||
| private static UnsupportedOperationException unsupported() { | ||
| return new UnsupportedOperationException("DSE GSSAPI authentication is no longer supported"); | ||
| } | ||
|
|
||
| /** @deprecated DSE GSSAPI authentication is no longer supported. */ | ||
| @Deprecated | ||
| @Immutable | ||
| public static class GssApiOptions { | ||
|
|
||
| private GssApiOptions() {} | ||
|
|
||
| @NonNull | ||
| public static Builder builder() { | ||
| return new Builder(); | ||
| } | ||
|
|
||
| @Nullable | ||
| public Configuration getLoginConfiguration() { | ||
| throw unsupported(); | ||
| } | ||
|
|
||
| @Nullable | ||
| public Subject getSubject() { | ||
| throw unsupported(); | ||
| } | ||
|
|
||
| @Nullable | ||
| public String getSaslProtocol() { | ||
| throw unsupported(); | ||
| } | ||
|
|
||
| @Nullable | ||
| public String getAuthorizationId() { | ||
| throw unsupported(); | ||
| } | ||
|
|
||
| @NonNull | ||
| public Map<String, String> getSaslProperties() { | ||
| throw unsupported(); | ||
| } | ||
|
|
||
| /** @deprecated DSE GSSAPI authentication is no longer supported. */ | ||
| @Deprecated | ||
| @NotThreadSafe | ||
| public static class Builder { | ||
|
|
||
| public Builder() {} | ||
|
|
||
| @NonNull | ||
| public Builder withLoginConfiguration(@Nullable Configuration loginConfiguration) { | ||
| throw unsupported(); | ||
| } | ||
|
|
||
| @NonNull | ||
| public Builder withLoginConfiguration(@Nullable Map<String, String> loginConfiguration) { | ||
| throw unsupported(); | ||
| } | ||
|
|
||
| @NonNull | ||
| public Builder withSubject(@Nullable Subject subject) { | ||
| throw unsupported(); | ||
| } | ||
|
|
||
| @NonNull | ||
| public Builder withSaslProtocol(@Nullable String saslProtocol) { | ||
| throw unsupported(); | ||
| } | ||
|
|
||
| @NonNull | ||
| public Builder withAuthorizationId(@Nullable String authorizationId) { | ||
| throw unsupported(); | ||
| } | ||
|
|
||
| @NonNull | ||
| public Builder addSaslProperty(@NonNull String name, @NonNull String value) { | ||
| throw unsupported(); | ||
| } | ||
|
|
||
| @NonNull | ||
| public GssApiOptions build() { | ||
| throw unsupported(); | ||
| } | ||
|
|
||
| @SuppressWarnings("DoNotCallSuggester") | ||
| public static Configuration fetchLoginConfiguration(@Nullable Map<String, String> options) { | ||
| throw unsupported(); | ||
| } | ||
| } | ||
| } | ||
|
|
||
| /** @deprecated DSE GSSAPI authentication is no longer supported. */ | ||
| @Deprecated | ||
| @ThreadSafe | ||
| protected static class GssApiAuthenticator extends BaseDseAuthenticator { | ||
|
|
||
| // Keep the unused parameters for compatibility with existing subclasses. | ||
| @SuppressWarnings("unused") | ||
| protected GssApiAuthenticator( | ||
| @Nullable GssApiOptions options, | ||
| @Nullable EndPoint endPoint, | ||
| @Nullable String serverAuthenticator) { | ||
| // Do not validate the unused server name before rejecting unsupported GSSAPI. | ||
| super("org.apache.cassandra.auth.PasswordAuthenticator"); | ||
| throw unsupported(); | ||
| } | ||
|
|
||
| @NonNull | ||
| @Override | ||
| protected ByteBuffer getMechanism() { | ||
| throw unsupported(); | ||
| } | ||
|
|
||
| @NonNull | ||
| @Override | ||
| protected ByteBuffer getInitialServerChallenge() { | ||
| throw unsupported(); | ||
| } | ||
|
|
||
| @Nullable | ||
| @Override | ||
| public ByteBuffer evaluateChallengeSync(@Nullable ByteBuffer challenge) { | ||
| throw unsupported(); | ||
| } | ||
| } | ||
| } |
35 changes: 35 additions & 0 deletions
35
core/src/main/java/com/datastax/dse/driver/api/core/auth/DsePlainTextAuthProviderBase.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one | ||
| * or more contributor license agreements. See the NOTICE file | ||
| * distributed with this work for additional information | ||
| * regarding copyright ownership. The ASF licenses this file | ||
| * to you under the Apache License, Version 2.0 (the | ||
| * "License"); you may not use this file except in compliance | ||
| * with the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
| package com.datastax.dse.driver.api.core.auth; | ||
|
|
||
| import com.datastax.oss.driver.api.core.auth.PlainTextAuthProviderBase; | ||
| import edu.umd.cs.findbugs.annotations.NonNull; | ||
| import net.jcip.annotations.ThreadSafe; | ||
|
|
||
| /** | ||
| * @deprecated Retained for source and binary compatibility. Use {@link PlainTextAuthProviderBase} | ||
| * for standard plaintext authentication. | ||
| */ | ||
| @Deprecated | ||
| @ThreadSafe | ||
| public abstract class DsePlainTextAuthProviderBase extends PlainTextAuthProviderBase { | ||
|
|
||
| protected DsePlainTextAuthProviderBase(@NonNull String logPrefix) { | ||
| super(logPrefix); | ||
| } | ||
| } |
42 changes: 42 additions & 0 deletions
42
...rc/main/java/com/datastax/dse/driver/api/core/auth/ProgrammaticDseGssApiAuthProvider.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one | ||
| * or more contributor license agreements. See the NOTICE file | ||
| * distributed with this work for additional information | ||
| * regarding copyright ownership. The ASF licenses this file | ||
| * to you under the Apache License, Version 2.0 (the | ||
| * "License"); you may not use this file except in compliance | ||
| * with the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
| package com.datastax.dse.driver.api.core.auth; | ||
|
|
||
| import com.datastax.oss.driver.api.core.metadata.EndPoint; | ||
| import edu.umd.cs.findbugs.annotations.NonNull; | ||
| import edu.umd.cs.findbugs.annotations.Nullable; | ||
| import net.jcip.annotations.ThreadSafe; | ||
|
|
||
| /** @deprecated DSE GSSAPI authentication is no longer supported. */ | ||
| @Deprecated | ||
| @ThreadSafe | ||
| public class ProgrammaticDseGssApiAuthProvider extends DseGssApiAuthProviderBase { | ||
|
|
||
| // Keep the unused parameter for compatibility with existing callers. | ||
| @SuppressWarnings("unused") | ||
| public ProgrammaticDseGssApiAuthProvider(@Nullable GssApiOptions options) { | ||
|
dkropachev marked this conversation as resolved.
|
||
| super(""); | ||
| } | ||
|
|
||
| @NonNull | ||
| @Override | ||
| protected GssApiOptions getOptions( | ||
| @NonNull EndPoint endPoint, @NonNull String serverAuthenticator) { | ||
| throw new UnsupportedOperationException("DSE GSSAPI authentication is no longer supported"); | ||
| } | ||
| } | ||
35 changes: 35 additions & 0 deletions
35
core/src/main/java/com/datastax/dse/driver/api/core/auth/ProxyAuthentication.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one | ||
| * or more contributor license agreements. See the NOTICE file | ||
| * distributed with this work for additional information | ||
| * regarding copyright ownership. The ASF licenses this file | ||
| * to you under the Apache License, Version 2.0 (the | ||
| * "License"); you may not use this file except in compliance | ||
| * with the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
| package com.datastax.dse.driver.api.core.auth; | ||
|
|
||
| import com.datastax.oss.driver.api.core.cql.Statement; | ||
| import edu.umd.cs.findbugs.annotations.NonNull; | ||
|
|
||
| /** @deprecated DSE proxy execution is no longer supported. */ | ||
| @Deprecated | ||
| @SuppressWarnings("DoNotCallSuggester") | ||
| public class ProxyAuthentication { | ||
|
|
||
| /** @deprecated DSE proxy execution is no longer supported. */ | ||
| @Deprecated | ||
| @NonNull | ||
| public static <StatementT extends Statement<StatementT>> StatementT executeAs( | ||
| @NonNull String userOrRole, @NonNull StatementT statement) { | ||
| throw new UnsupportedOperationException("DSE proxy execution is no longer supported"); | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.