Skip to content
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

KAFKA-18064: SASL mechanisms that do support neihter integrity nor co… #17901

Open
wants to merge 2 commits into
base: trunk
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@

import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.Arrays;
import java.util.Map;
import java.util.Objects;

Expand Down Expand Up @@ -128,17 +127,17 @@ public boolean isComplete() {
}

@Override
public byte[] unwrap(byte[] incoming, int offset, int len) {
public byte[] unwrap(byte[] incoming, int offset, int len) throws SaslException {
if (!isComplete())
throw new IllegalStateException("Authentication exchange has not completed");
return Arrays.copyOfRange(incoming, offset, offset + len);
throw new SaslException("OAUTHBEARER supports neither integrity nor privacy");
}

@Override
public byte[] wrap(byte[] outgoing, int offset, int len) {
public byte[] wrap(byte[] outgoing, int offset, int len) throws SaslException {
if (!isComplete())
throw new IllegalStateException("Authentication exchange has not completed");
return Arrays.copyOfRange(outgoing, offset, offset + len);
throw new SaslException("OAUTHBEARER supports neither integrity nor privacy");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@

import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.Arrays;
import java.util.Map;
import java.util.Objects;

Expand Down Expand Up @@ -131,17 +130,17 @@ public boolean isComplete() {
}

@Override
public byte[] unwrap(byte[] incoming, int offset, int len) {
public byte[] unwrap(byte[] incoming, int offset, int len) throws SaslException {
if (!complete)
throw new IllegalStateException("Authentication exchange has not completed");
return Arrays.copyOfRange(incoming, offset, offset + len);
throw new SaslException("OAUTHBEARER supports neither integrity nor privacy");
}

@Override
public byte[] wrap(byte[] outgoing, int offset, int len) {
public byte[] wrap(byte[] outgoing, int offset, int len) throws SaslException {
if (!complete)
throw new IllegalStateException("Authentication exchange has not completed");
return Arrays.copyOfRange(outgoing, offset, offset + len);
throw new SaslException("OAUTHBEARER supports neither integrity nor privacy");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@

import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;

Expand Down Expand Up @@ -159,17 +158,17 @@ public boolean isComplete() {
}

@Override
public byte[] unwrap(byte[] incoming, int offset, int len) {
public byte[] unwrap(byte[] incoming, int offset, int len) throws SaslException {
if (!complete)
throw new IllegalStateException("Authentication exchange has not completed");
return Arrays.copyOfRange(incoming, offset, offset + len);
throw new SaslException("PLAIN supports neither integrity nor privacy");
}

@Override
public byte[] wrap(byte[] outgoing, int offset, int len) {
public byte[] wrap(byte[] outgoing, int offset, int len) throws SaslException {
if (!complete)
throw new IllegalStateException("Authentication exchange has not completed");
return Arrays.copyOfRange(outgoing, offset, offset + len);
throw new SaslException("PLAIN supports neither integrity nor privacy");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,17 +159,17 @@ public boolean isComplete() {
}

@Override
public byte[] unwrap(byte[] incoming, int offset, int len) {
public byte[] unwrap(byte[] incoming, int offset, int len) throws SaslException {
if (!isComplete())
throw new IllegalStateException("Authentication exchange has not completed");
return Arrays.copyOfRange(incoming, offset, offset + len);
throw new SaslException("SCRAM supports neither integrity nor privacy");
}

@Override
public byte[] wrap(byte[] outgoing, int offset, int len) {
public byte[] wrap(byte[] outgoing, int offset, int len) throws SaslException {
if (!isComplete())
throw new IllegalStateException("Authentication exchange has not completed");
return Arrays.copyOfRange(outgoing, offset, offset + len);
throw new SaslException("SCRAM supports neither integrity nor privacy");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
import java.security.InvalidKeyException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.Arrays;
import java.util.Collection;
import java.util.Map;
import java.util.Set;
Expand Down Expand Up @@ -202,17 +201,17 @@ public boolean isComplete() {
}

@Override
public byte[] unwrap(byte[] incoming, int offset, int len) {
public byte[] unwrap(byte[] incoming, int offset, int len) throws SaslException {
if (!isComplete())
throw new IllegalStateException("Authentication exchange has not completed");
return Arrays.copyOfRange(incoming, offset, offset + len);
throw new SaslException("SCRAM supports neither integrity nor privacy");
}

@Override
public byte[] wrap(byte[] outgoing, int offset, int len) {
public byte[] wrap(byte[] outgoing, int offset, int len) throws SaslException {
if (!isComplete())
throw new IllegalStateException("Authentication exchange has not completed");
return Arrays.copyOfRange(outgoing, offset, offset + len);
throw new SaslException("SCRAM supports neither integrity nor privacy");
}

@Override
Expand Down