Skip to content

Commit

Permalink
fixes AuthMetadataCodec methods names
Browse files Browse the repository at this point in the history
Signed-off-by: Oleh Dokuka <[email protected]>
  • Loading branch information
OlegDokuka committed May 12, 2020
1 parent a9e2954 commit 8cb9e74
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ public static boolean isWellKnownAuthType(ByteBuf metadata) {
* field's value is length or unknown auth type
* @throws IllegalStateException if not enough readable bytes in the given {@link ByteBuf}
*/
public static WellKnownAuthType decodeWellKnownAuthType(ByteBuf metadata) {
public static WellKnownAuthType readWellKnownAuthType(ByteBuf metadata) {
if (metadata.readableBytes() < 1) {
throw new IllegalStateException(
"Unable to decode Well Know Auth type. Not enough readable bytes");
Expand All @@ -195,7 +195,7 @@ public static WellKnownAuthType decodeWellKnownAuthType(ByteBuf metadata) {
* @param metadata
* @return
*/
public static CharSequence decodeCustomAuthType(ByteBuf metadata) {
public static CharSequence readCustomAuthType(ByteBuf metadata) {
if (metadata.readableBytes() < 2) {
throw new IllegalStateException(
"Unable to decode custom Auth type. Not enough readable bytes");
Expand Down Expand Up @@ -226,7 +226,7 @@ public static CharSequence decodeCustomAuthType(ByteBuf metadata) {
* @return sliced {@link ByteBuf} or {@link Unpooled#EMPTY_BUFFER} if no bytes readable in the
* given one
*/
public static ByteBuf decodePayload(ByteBuf metadata) {
public static ByteBuf readPayload(ByteBuf metadata) {
if (metadata.readableBytes() == 0) {
return Unpooled.EMPTY_BUFFER;
}
Expand All @@ -242,8 +242,8 @@ public static ByteBuf decodePayload(ByteBuf metadata) {
* simpleAuthMetadata#readIndex} should be set to the username length byte
* @return sliced {@link ByteBuf} or {@link Unpooled#EMPTY_BUFFER} if username length is zero
*/
public static ByteBuf decodeUsername(ByteBuf simpleAuthMetadata) {
short usernameLength = decodeUsernameLength(simpleAuthMetadata);
public static ByteBuf readUsername(ByteBuf simpleAuthMetadata) {
short usernameLength = readUsernameLength(simpleAuthMetadata);

if (usernameLength == 0) {
return Unpooled.EMPTY_BUFFER;
Expand All @@ -260,7 +260,7 @@ public static ByteBuf decodeUsername(ByteBuf simpleAuthMetadata) {
* simpleAuthMetadata#readIndex} should be set to the beginning of the password bytes
* @return sliced {@link ByteBuf} or {@link Unpooled#EMPTY_BUFFER} if password length is zero
*/
public static ByteBuf decodePassword(ByteBuf simpleAuthMetadata) {
public static ByteBuf readPassword(ByteBuf simpleAuthMetadata) {
if (simpleAuthMetadata.readableBytes() == 0) {
return Unpooled.EMPTY_BUFFER;
}
Expand All @@ -275,8 +275,8 @@ public static ByteBuf decodePassword(ByteBuf simpleAuthMetadata) {
* simpleAuthMetadata#readIndex} should be set to the username length byte
* @return {@code char[]} which represents UTF-8 username
*/
public static char[] decodeUsernameAsCharArray(ByteBuf simpleAuthMetadata) {
short usernameLength = decodeUsernameLength(simpleAuthMetadata);
public static char[] readUsernameAsCharArray(ByteBuf simpleAuthMetadata) {
short usernameLength = readUsernameLength(simpleAuthMetadata);

if (usernameLength == 0) {
return EMPTY_CHARS_ARRAY;
Expand All @@ -293,7 +293,7 @@ public static char[] decodeUsernameAsCharArray(ByteBuf simpleAuthMetadata) {
* simpleAuthMetadata#readIndex} should be set to the beginning of the password bytes
* @return {@code char[]} which represents UTF-8 password
*/
public static char[] decodePasswordAsCharArray(ByteBuf simpleAuthMetadata) {
public static char[] readPasswordAsCharArray(ByteBuf simpleAuthMetadata) {
if (simpleAuthMetadata.readableBytes() == 0) {
return EMPTY_CHARS_ARRAY;
}
Expand All @@ -309,15 +309,15 @@ public static char[] decodePasswordAsCharArray(ByteBuf simpleAuthMetadata) {
* simpleAuthMetadata#readIndex} should be set to the beginning of the password bytes
* @return {@code char[]} which represents UTF-8 password
*/
public static char[] decodeBearerTokenAsCharArray(ByteBuf bearerAuthMetadata) {
public static char[] readBearerTokenAsCharArray(ByteBuf bearerAuthMetadata) {
if (bearerAuthMetadata.readableBytes() == 0) {
return EMPTY_CHARS_ARRAY;
}

return CharByteBufUtil.readUtf8(bearerAuthMetadata, bearerAuthMetadata.readableBytes());
}

private static short decodeUsernameLength(ByteBuf simpleAuthMetadata) {
private static short readUsernameLength(ByteBuf simpleAuthMetadata) {
if (simpleAuthMetadata.readableBytes() < 1) {
throw new IllegalStateException(
"Unable to decode custom username. Not enough readable bytes");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public static boolean isWellKnownAuthType(ByteBuf metadata) {
* @throws IllegalStateException if not enough readable bytes in the given {@link ByteBuf}
*/
public static WellKnownAuthType decodeWellKnownAuthType(ByteBuf metadata) {
return WellKnownAuthType.cast(AuthMetadataCodec.decodeWellKnownAuthType(metadata));
return WellKnownAuthType.cast(AuthMetadataCodec.readWellKnownAuthType(metadata));
}

/**
Expand All @@ -117,7 +117,7 @@ public static WellKnownAuthType decodeWellKnownAuthType(ByteBuf metadata) {
* @return
*/
public static CharSequence decodeCustomAuthType(ByteBuf metadata) {
return AuthMetadataCodec.decodeCustomAuthType(metadata);
return AuthMetadataCodec.readCustomAuthType(metadata);
}

/**
Expand All @@ -130,7 +130,7 @@ public static CharSequence decodeCustomAuthType(ByteBuf metadata) {
* given one
*/
public static ByteBuf decodePayload(ByteBuf metadata) {
return AuthMetadataCodec.decodePayload(metadata);
return AuthMetadataCodec.readPayload(metadata);
}

/**
Expand All @@ -142,7 +142,7 @@ public static ByteBuf decodePayload(ByteBuf metadata) {
* @return sliced {@link ByteBuf} or {@link Unpooled#EMPTY_BUFFER} if username length is zero
*/
public static ByteBuf decodeUsername(ByteBuf simpleAuthMetadata) {
return AuthMetadataCodec.decodeUsername(simpleAuthMetadata);
return AuthMetadataCodec.readUsername(simpleAuthMetadata);
}

/**
Expand All @@ -154,7 +154,7 @@ public static ByteBuf decodeUsername(ByteBuf simpleAuthMetadata) {
* @return sliced {@link ByteBuf} or {@link Unpooled#EMPTY_BUFFER} if password length is zero
*/
public static ByteBuf decodePassword(ByteBuf simpleAuthMetadata) {
return AuthMetadataCodec.decodePassword(simpleAuthMetadata);
return AuthMetadataCodec.readPassword(simpleAuthMetadata);
}
/**
* Read up to 257 {@code bytes} from the given {@link ByteBuf} where the first byte is username
Expand All @@ -165,7 +165,7 @@ public static ByteBuf decodePassword(ByteBuf simpleAuthMetadata) {
* @return {@code char[]} which represents UTF-8 username
*/
public static char[] decodeUsernameAsCharArray(ByteBuf simpleAuthMetadata) {
return AuthMetadataCodec.decodeUsernameAsCharArray(simpleAuthMetadata);
return AuthMetadataCodec.readUsernameAsCharArray(simpleAuthMetadata);
}

/**
Expand All @@ -177,7 +177,7 @@ public static char[] decodeUsernameAsCharArray(ByteBuf simpleAuthMetadata) {
* @return {@code char[]} which represents UTF-8 password
*/
public static char[] decodePasswordAsCharArray(ByteBuf simpleAuthMetadata) {
return AuthMetadataCodec.decodePasswordAsCharArray(simpleAuthMetadata);
return AuthMetadataCodec.readPasswordAsCharArray(simpleAuthMetadata);
}

/**
Expand All @@ -189,6 +189,6 @@ public static char[] decodePasswordAsCharArray(ByteBuf simpleAuthMetadata) {
* @return {@code char[]} which represents UTF-8 password
*/
public static char[] decodeBearerTokenAsCharArray(ByteBuf bearerAuthMetadata) {
return AuthMetadataCodec.decodeBearerTokenAsCharArray(bearerAuthMetadata);
return AuthMetadataCodec.readBearerTokenAsCharArray(bearerAuthMetadata);
}
}

0 comments on commit 8cb9e74

Please sign in to comment.