Skip to content

Commit 8cb9e74

Browse files
committed
fixes AuthMetadataCodec methods names
Signed-off-by: Oleh Dokuka <[email protected]>
1 parent a9e2954 commit 8cb9e74

File tree

2 files changed

+19
-19
lines changed

2 files changed

+19
-19
lines changed

rsocket-core/src/main/java/io/rsocket/metadata/AuthMetadataCodec.java

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ public static boolean isWellKnownAuthType(ByteBuf metadata) {
174174
* field's value is length or unknown auth type
175175
* @throws IllegalStateException if not enough readable bytes in the given {@link ByteBuf}
176176
*/
177-
public static WellKnownAuthType decodeWellKnownAuthType(ByteBuf metadata) {
177+
public static WellKnownAuthType readWellKnownAuthType(ByteBuf metadata) {
178178
if (metadata.readableBytes() < 1) {
179179
throw new IllegalStateException(
180180
"Unable to decode Well Know Auth type. Not enough readable bytes");
@@ -195,7 +195,7 @@ public static WellKnownAuthType decodeWellKnownAuthType(ByteBuf metadata) {
195195
* @param metadata
196196
* @return
197197
*/
198-
public static CharSequence decodeCustomAuthType(ByteBuf metadata) {
198+
public static CharSequence readCustomAuthType(ByteBuf metadata) {
199199
if (metadata.readableBytes() < 2) {
200200
throw new IllegalStateException(
201201
"Unable to decode custom Auth type. Not enough readable bytes");
@@ -226,7 +226,7 @@ public static CharSequence decodeCustomAuthType(ByteBuf metadata) {
226226
* @return sliced {@link ByteBuf} or {@link Unpooled#EMPTY_BUFFER} if no bytes readable in the
227227
* given one
228228
*/
229-
public static ByteBuf decodePayload(ByteBuf metadata) {
229+
public static ByteBuf readPayload(ByteBuf metadata) {
230230
if (metadata.readableBytes() == 0) {
231231
return Unpooled.EMPTY_BUFFER;
232232
}
@@ -242,8 +242,8 @@ public static ByteBuf decodePayload(ByteBuf metadata) {
242242
* simpleAuthMetadata#readIndex} should be set to the username length byte
243243
* @return sliced {@link ByteBuf} or {@link Unpooled#EMPTY_BUFFER} if username length is zero
244244
*/
245-
public static ByteBuf decodeUsername(ByteBuf simpleAuthMetadata) {
246-
short usernameLength = decodeUsernameLength(simpleAuthMetadata);
245+
public static ByteBuf readUsername(ByteBuf simpleAuthMetadata) {
246+
short usernameLength = readUsernameLength(simpleAuthMetadata);
247247

248248
if (usernameLength == 0) {
249249
return Unpooled.EMPTY_BUFFER;
@@ -260,7 +260,7 @@ public static ByteBuf decodeUsername(ByteBuf simpleAuthMetadata) {
260260
* simpleAuthMetadata#readIndex} should be set to the beginning of the password bytes
261261
* @return sliced {@link ByteBuf} or {@link Unpooled#EMPTY_BUFFER} if password length is zero
262262
*/
263-
public static ByteBuf decodePassword(ByteBuf simpleAuthMetadata) {
263+
public static ByteBuf readPassword(ByteBuf simpleAuthMetadata) {
264264
if (simpleAuthMetadata.readableBytes() == 0) {
265265
return Unpooled.EMPTY_BUFFER;
266266
}
@@ -275,8 +275,8 @@ public static ByteBuf decodePassword(ByteBuf simpleAuthMetadata) {
275275
* simpleAuthMetadata#readIndex} should be set to the username length byte
276276
* @return {@code char[]} which represents UTF-8 username
277277
*/
278-
public static char[] decodeUsernameAsCharArray(ByteBuf simpleAuthMetadata) {
279-
short usernameLength = decodeUsernameLength(simpleAuthMetadata);
278+
public static char[] readUsernameAsCharArray(ByteBuf simpleAuthMetadata) {
279+
short usernameLength = readUsernameLength(simpleAuthMetadata);
280280

281281
if (usernameLength == 0) {
282282
return EMPTY_CHARS_ARRAY;
@@ -293,7 +293,7 @@ public static char[] decodeUsernameAsCharArray(ByteBuf simpleAuthMetadata) {
293293
* simpleAuthMetadata#readIndex} should be set to the beginning of the password bytes
294294
* @return {@code char[]} which represents UTF-8 password
295295
*/
296-
public static char[] decodePasswordAsCharArray(ByteBuf simpleAuthMetadata) {
296+
public static char[] readPasswordAsCharArray(ByteBuf simpleAuthMetadata) {
297297
if (simpleAuthMetadata.readableBytes() == 0) {
298298
return EMPTY_CHARS_ARRAY;
299299
}
@@ -309,15 +309,15 @@ public static char[] decodePasswordAsCharArray(ByteBuf simpleAuthMetadata) {
309309
* simpleAuthMetadata#readIndex} should be set to the beginning of the password bytes
310310
* @return {@code char[]} which represents UTF-8 password
311311
*/
312-
public static char[] decodeBearerTokenAsCharArray(ByteBuf bearerAuthMetadata) {
312+
public static char[] readBearerTokenAsCharArray(ByteBuf bearerAuthMetadata) {
313313
if (bearerAuthMetadata.readableBytes() == 0) {
314314
return EMPTY_CHARS_ARRAY;
315315
}
316316

317317
return CharByteBufUtil.readUtf8(bearerAuthMetadata, bearerAuthMetadata.readableBytes());
318318
}
319319

320-
private static short decodeUsernameLength(ByteBuf simpleAuthMetadata) {
320+
private static short readUsernameLength(ByteBuf simpleAuthMetadata) {
321321
if (simpleAuthMetadata.readableBytes() < 1) {
322322
throw new IllegalStateException(
323323
"Unable to decode custom username. Not enough readable bytes");

rsocket-core/src/main/java/io/rsocket/metadata/security/AuthMetadataFlyweight.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ public static boolean isWellKnownAuthType(ByteBuf metadata) {
107107
* @throws IllegalStateException if not enough readable bytes in the given {@link ByteBuf}
108108
*/
109109
public static WellKnownAuthType decodeWellKnownAuthType(ByteBuf metadata) {
110-
return WellKnownAuthType.cast(AuthMetadataCodec.decodeWellKnownAuthType(metadata));
110+
return WellKnownAuthType.cast(AuthMetadataCodec.readWellKnownAuthType(metadata));
111111
}
112112

113113
/**
@@ -117,7 +117,7 @@ public static WellKnownAuthType decodeWellKnownAuthType(ByteBuf metadata) {
117117
* @return
118118
*/
119119
public static CharSequence decodeCustomAuthType(ByteBuf metadata) {
120-
return AuthMetadataCodec.decodeCustomAuthType(metadata);
120+
return AuthMetadataCodec.readCustomAuthType(metadata);
121121
}
122122

123123
/**
@@ -130,7 +130,7 @@ public static CharSequence decodeCustomAuthType(ByteBuf metadata) {
130130
* given one
131131
*/
132132
public static ByteBuf decodePayload(ByteBuf metadata) {
133-
return AuthMetadataCodec.decodePayload(metadata);
133+
return AuthMetadataCodec.readPayload(metadata);
134134
}
135135

136136
/**
@@ -142,7 +142,7 @@ public static ByteBuf decodePayload(ByteBuf metadata) {
142142
* @return sliced {@link ByteBuf} or {@link Unpooled#EMPTY_BUFFER} if username length is zero
143143
*/
144144
public static ByteBuf decodeUsername(ByteBuf simpleAuthMetadata) {
145-
return AuthMetadataCodec.decodeUsername(simpleAuthMetadata);
145+
return AuthMetadataCodec.readUsername(simpleAuthMetadata);
146146
}
147147

148148
/**
@@ -154,7 +154,7 @@ public static ByteBuf decodeUsername(ByteBuf simpleAuthMetadata) {
154154
* @return sliced {@link ByteBuf} or {@link Unpooled#EMPTY_BUFFER} if password length is zero
155155
*/
156156
public static ByteBuf decodePassword(ByteBuf simpleAuthMetadata) {
157-
return AuthMetadataCodec.decodePassword(simpleAuthMetadata);
157+
return AuthMetadataCodec.readPassword(simpleAuthMetadata);
158158
}
159159
/**
160160
* Read up to 257 {@code bytes} from the given {@link ByteBuf} where the first byte is username
@@ -165,7 +165,7 @@ public static ByteBuf decodePassword(ByteBuf simpleAuthMetadata) {
165165
* @return {@code char[]} which represents UTF-8 username
166166
*/
167167
public static char[] decodeUsernameAsCharArray(ByteBuf simpleAuthMetadata) {
168-
return AuthMetadataCodec.decodeUsernameAsCharArray(simpleAuthMetadata);
168+
return AuthMetadataCodec.readUsernameAsCharArray(simpleAuthMetadata);
169169
}
170170

171171
/**
@@ -177,7 +177,7 @@ public static char[] decodeUsernameAsCharArray(ByteBuf simpleAuthMetadata) {
177177
* @return {@code char[]} which represents UTF-8 password
178178
*/
179179
public static char[] decodePasswordAsCharArray(ByteBuf simpleAuthMetadata) {
180-
return AuthMetadataCodec.decodePasswordAsCharArray(simpleAuthMetadata);
180+
return AuthMetadataCodec.readPasswordAsCharArray(simpleAuthMetadata);
181181
}
182182

183183
/**
@@ -189,6 +189,6 @@ public static char[] decodePasswordAsCharArray(ByteBuf simpleAuthMetadata) {
189189
* @return {@code char[]} which represents UTF-8 password
190190
*/
191191
public static char[] decodeBearerTokenAsCharArray(ByteBuf bearerAuthMetadata) {
192-
return AuthMetadataCodec.decodeBearerTokenAsCharArray(bearerAuthMetadata);
192+
return AuthMetadataCodec.readBearerTokenAsCharArray(bearerAuthMetadata);
193193
}
194194
}

0 commit comments

Comments
 (0)