类io.jsonwebtoken.io.Deserializer源码实例Demo

下面列出了怎么用io.jsonwebtoken.io.Deserializer的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: jjwt   文件: DefaultJwtParser.java
DefaultJwtParser(SigningKeyResolver signingKeyResolver,
                 Key key,
                 byte[] keyBytes,
                 Clock clock,
                 long allowedClockSkewMillis,
                 Claims expectedClaims,
                 Decoder<String, byte[]> base64UrlDecoder,
                 Deserializer<Map<String, ?>> deserializer,
                 CompressionCodecResolver compressionCodecResolver) {
    this.signingKeyResolver = signingKeyResolver;
    this.key = key;
    this.keyBytes = keyBytes;
    this.clock = clock;
    this.allowedClockSkewMillis = allowedClockSkewMillis;
    this.expectedClaims = expectedClaims;
    this.base64UrlDecoder = base64UrlDecoder;
    this.deserializer = deserializer;
    this.compressionCodecResolver = compressionCodecResolver;
}
 
源代码2 项目: jjwt   文件: DefaultJwtParserBuilder.java
@Override
public JwtParser build() {

    // Only lookup the deserializer IF it is null. It is possible a Deserializer implementation was set
    // that is NOT exposed as a service and no other implementations are available for lookup.
    if (this.deserializer == null) {
        // try to find one based on the services available:
        this.deserializer = Services.loadFirst(Deserializer.class);
    }

    return new ImmutableJwtParser(
            new DefaultJwtParser(signingKeyResolver,
                                 key,
                                 keyBytes,
                                 clock,
                                 allowedClockSkewMillis,
                                 expectedClaims,
                                 base64UrlDecoder,
                                 deserializer,
                                 compressionCodecResolver));
}
 
源代码3 项目: ditto   文件: JjwtDeserializer.java
/**
 * @return the instance of {@link JjwtDeserializer}.
 */
public static Deserializer getInstance() {
    if (instance == null) {
        instance = new JjwtDeserializer();
    }
    return instance;
}
 
源代码4 项目: trellis   文件: JwksAuthenticator.java
private static Map<String, Key> buildKeys(final String location) {
    // TODO eventually, this will become part of the JJWT library
    final Deserializer<Map<String, List<Map<String, String>>>> deserializer = new JacksonDeserializer<>();
    try (final InputStream input = new URL(location).openConnection().getInputStream()) {
        return deserializer.deserialize(IOUtils.toByteArray(input)).getOrDefault("keys", emptyList()).stream()
            .map(JwksAuthenticator::buildKeyEntry).filter(Objects::nonNull).collect(collectingAndThen(
                        toMap(Map.Entry::getKey, Map.Entry::getValue), Collections::unmodifiableMap));
    } catch (final IOException ex) {
        LOGGER.error("Error fetching/parsing jwk document", ex);
    }
    return emptyMap();
}
 
源代码5 项目: jjwt   文件: ImmutableJwtParser.java
@Override
public JwtParser deserializeJsonWith(Deserializer<Map<String, ?>> deserializer) {
    throw doNotMutate();
}
 
源代码6 项目: jjwt   文件: DefaultJwtParser.java
@Override
public JwtParser deserializeJsonWith(Deserializer<Map<String, ?>> deserializer) {
    Assert.notNull(deserializer, "deserializer cannot be null.");
    this.deserializer = deserializer;
    return this;
}
 
源代码7 项目: jjwt   文件: DefaultJwtParserBuilder.java
@Override
public JwtParserBuilder deserializeJsonWith(Deserializer<Map<String, ?>> deserializer) {
    Assert.notNull(deserializer, "deserializer cannot be null.");
    this.deserializer = deserializer;
    return this;
}
 
源代码8 项目: jjwt   文件: JwtParserBuilder.java
/**
 * Uses the specified deserializer to convert JSON Strings (UTF-8 byte arrays) into Java Map objects.  This is
 * used by the parser after Base64Url-decoding to convert JWT/JWS/JWT JSON headers and claims into Java Map
 * objects.
 *
 * <p>If this method is not called, JJWT will use whatever deserializer it can find at runtime, checking for the
 * presence of well-known implementations such Jackson, Gson, and org.json.  If one of these is not found
 * in the runtime classpath, an exception will be thrown when one of the various {@code parse}* methods is
 * invoked.</p>
 *
 * @param deserializer the deserializer to use when converting JSON Strings (UTF-8 byte arrays) into Map objects.
 * @return the builder for method chaining.
 */
JwtParserBuilder deserializeJsonWith(Deserializer<Map<String,?>> deserializer);
 
源代码9 项目: jjwt   文件: JwtParser.java
/**
 * Uses the specified deserializer to convert JSON Strings (UTF-8 byte arrays) into Java Map objects.  This is
 * used by the parser after Base64Url-decoding to convert JWT/JWS/JWT JSON headers and claims into Java Map
 * objects.
 *
 * <p>If this method is not called, JJWT will use whatever deserializer it can find at runtime, checking for the
 * presence of well-known implementations such Jackson, Gson, and org.json.  If one of these is not found
 * in the runtime classpath, an exception will be thrown when one of the various {@code parse}* methods is
 * invoked.</p>
 *
 * @param deserializer the deserializer to use when converting JSON Strings (UTF-8 byte arrays) into Map objects.
 * @return the parser for method chaining.
 * @since 0.10.0
 * @deprecated see {@link JwtParserBuilder#deserializeJsonWith(Deserializer)} )}.
 * To construct a JwtParser use the corresponding builder via {@link Jwts#parserBuilder()}. This will construct an
 * immutable JwtParser.
 * <p><b>NOTE: this method will be removed before version 1.0</b>
 */
@Deprecated
JwtParser deserializeJsonWith(Deserializer<Map<String,?>> deserializer);
 
 类所在包
 类方法