@Test public void testHeaderAndPayload() { ByteBuf header = Jwt.headerAndPayload(JWT); String s = header.toString(StandardCharsets.UTF_8); Assert.assertEquals( "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJhbGlJZCI6IjExMTE4ODg4OCIsInN1YiI6InRlc" + "3RpbmctYXBwIiwiYXVkIjoiamFja3kuY2hlbmxiQGFsaWJhYmEtaW5jLmNvbSIsInNhcyI6WyJkZWZhdWx0Iiw" + "iYWNjb3VudCIsInRyYW5zYWN0aW9uIl0sInJvbGVzIjpbImludGVybmFsIl0sImlzcyI6IlJTb2NrZXRCcm9r" + "ZXIiLCJvcmdzIjpbImFsaWJhYmEiLCJhbGlwYXkiXSwiaWF0IjoxNTY1NjMzMzA5fQ", s); }
public static ByteBuf headerAndPayload(ByteBuf token) { int index = ByteBufUtil.indexOf(token, token.readerIndex(), token.readableBytes(), JWT_SEPARATOR); int length = ByteBufUtil.indexOf(token, index + 1, token.readableBytes(), JWT_SEPARATOR); return token.slice(token.readerIndex(), length); }
Jwt { public static ByteBuf headerAndPayload(ByteBuf token) { int index = ByteBufUtil.indexOf(token, token.readerIndex(), token.readableBytes(), JWT_SEPARATOR); int length = ByteBufUtil.indexOf(token, index + 1, token.readableBytes(), JWT_SEPARATOR); return token.slice(token.readerIndex(), length); } }
Jwt { public static ByteBuf headerAndPayload(ByteBuf token) { int index = ByteBufUtil.indexOf(token, token.readerIndex(), token.readableBytes(), JWT_SEPARATOR); int length = ByteBufUtil.indexOf(token, index + 1, token.readableBytes(), JWT_SEPARATOR); return token.slice(token.readerIndex(), length); }  }
Jwt { public static ByteBuf headerAndPayload(ByteBuf token) { int index = ByteBufUtil.indexOf(token, token.readerIndex(), token.readableBytes(), JWT_SEPARATOR); int length = ByteBufUtil.indexOf(token, index + 1, token.readableBytes(), JWT_SEPARATOR); return token.slice(token.readerIndex(), length); }  static ByteBuf header(ByteBuf token); static ByteBuf payload(ByteBuf token); static ByteBuf signature(ByteBuf token); static ByteBuf headerAndPayload(ByteBuf token); static boolean verifySHA256withRSA(PublicKey publicKey, ByteBuf token); static boolean verify(String alg, PublicKey publicKey, ByteBuf token); static long parseAccessKey(ByteBuf token, Set<String> mappedFields); static String parseAlgorithm(ByteBuf token); }
Jwt { public static ByteBuf headerAndPayload(ByteBuf token) { int index = ByteBufUtil.indexOf(token, token.readerIndex(), token.readableBytes(), JWT_SEPARATOR); int length = ByteBufUtil.indexOf(token, index + 1, token.readableBytes(), JWT_SEPARATOR); return token.slice(token.readerIndex(), length); }  static ByteBuf header(ByteBuf token); static ByteBuf payload(ByteBuf token); static ByteBuf signature(ByteBuf token); static ByteBuf headerAndPayload(ByteBuf token); static boolean verifySHA256withRSA(PublicKey publicKey, ByteBuf token); static boolean verify(String alg, PublicKey publicKey, ByteBuf token); static long parseAccessKey(ByteBuf token, Set<String> mappedFields); static String parseAlgorithm(ByteBuf token);  }