public static <T> T fromString(Class<T> type, String json, ResteasyProviderFactory factory) throws Exception { byte[] bytes = json.getBytes(StandardCharsets.UTF_8); return fromBytes(type, bytes, factory); }
public static String toString(Object token, ResteasyProviderFactory factory) throws Exception { byte[] bytes = toByteArray(token, factory); return new String(bytes); }
public static <T> T fromString(Class<T> type, String json) throws Exception { byte[] bytes = json.getBytes(StandardCharsets.UTF_8); return fromBytes(type, bytes); }
public static String toString(Object token, boolean indent) throws Exception { byte[] bytes = toByteArray(token, indent); return new String(bytes); }
public static <T> T fromBytes(Class<T> type, byte[] bytes) throws IOException { ResteasyProviderFactory factory = new ResteasyProviderFactoryImpl(); factory.register(ResteasyJackson2Provider.class); factory.register(JWTContextResolver.class); return fromBytes(type, bytes, factory); }
public static byte[] toByteArray(Object token, boolean indent) throws Exception { ResteasyProviderFactory factory = new ResteasyProviderFactoryImpl(); factory.register(new JWTContextResolver(indent)); factory.register(ResteasyJackson2Provider.class); return toByteArray(token, factory); }
public static <T> T fromString(Class<T> type, String json, ResteasyProviderFactory factory) throws Exception { byte[] bytes = json.getBytes(StandardCharsets.UTF_8); return fromBytes(type, bytes, factory); }
public static String toString(Object token, ResteasyProviderFactory factory) throws Exception { byte[] bytes = toByteArray(token, factory); return new String(bytes); }
public static <T> T fromString(Class<T> type, String json) throws Exception { byte[] bytes = json.getBytes(StandardCharsets.UTF_8); return fromBytes(type, bytes); }
public static String toString(Object token, boolean indent) throws Exception { byte[] bytes = toByteArray(token, indent); return new String(bytes); }
public static <T> T fromBytes(Class<T> type, byte[] bytes) throws IOException { ResteasyProviderFactory factory = new ResteasyProviderFactory(); factory.register(ResteasyJacksonProvider.class); factory.register(JWTContextResolver.class); return fromBytes(type, bytes, factory); }
protected String buildTokenString(PrivateKey privateKey, SkeletonKeyToken token) { byte[] tokenBytes = null; try { tokenBytes = JsonSerialization.toByteArray(token, false); } catch (Exception e) { throw new RuntimeException(e); } return new JWSBuilder() .content(tokenBytes) .rsa256(privateKey); }
try scope = JsonSerialization.fromBytes(SkeletonKeyScope.class, bytes);
public static byte[] toByteArray(Object token, boolean indent) throws Exception { ResteasyProviderFactory factory = new ResteasyProviderFactory(); factory.register(new JWTContextResolver(indent)); factory.register(ResteasyJacksonProvider.class); return toByteArray(token, factory); }
try token = JsonSerialization.fromBytes(SkeletonKeyToken.class, input.getContent());
protected AccessTokenResponse accessTokenResponse(PrivateKey privateKey, SkeletonKeyToken token) { byte[] tokenBytes = null; try { tokenBytes = JsonSerialization.toByteArray(token, false); } catch (Exception e) { throw new RuntimeException(e); } String encodedToken = new JWSBuilder() .content(tokenBytes) .rsa256(privateKey); AccessTokenResponse res = new AccessTokenResponse(); res.setToken(encodedToken); res.setTokenType("bearer"); if (token.getExpiration() != 0) { long time = token.getExpiration() - (System.currentTimeMillis() / 1000); res.setExpiresIn(time); } return res; }