Skip to content

Commit

Permalink
[Test] Service Accounts - Remove colon from invalid token name genera…
Browse files Browse the repository at this point in the history
…tor (elastic#71099)

The colon character is interpreted as the separate between token name and token
secret. So if a token name contains a colon, it is in theory invalid. But the
parser takes only the part before the colon as the token name and thus consider
it as a valid token name. Subsequent authentication will still fail. But for
tests, this generates a different exception and fails the expectation. This PR
removes the colon char from being used to generate invalid token names for
simplicity.
  • Loading branch information
ywangd committed Apr 8, 2021
1 parent 2bbe346 commit 2611310
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,11 @@ public void close() {
secret.close();
}

@Override
public String toString() {
return getQualifiedName();
}

@Override
public boolean equals(Object o) {
if (this == o)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public class ServiceAccountTokenTests extends ESTestCase {
);

private static final Set<Character> INVALID_TOKEN_NAME_CHARS = Set.of(
'!', '"', '#', '$', '%', '&', '\'', '(', ')', '*', '+', ',', '.', '/', ':', ';', '<', '=', '>', '?', '@', '[',
'!', '"', '#', '$', '%', '&', '\'', '(', ')', '*', '+', ',', '.', '/', ';', '<', '=', '>', '?', '@', '[',
'\\', ']', '^', '`', '{', '|', '}', '~', ' ', '\t', '\n', '\r');

public void testIsValidTokenName() {
Expand Down

0 comments on commit 2611310

Please sign in to comment.