All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.castle.client.internal.json.CastleGsonModel Maven / Gradle / Ivy

Go to download

Castle adds real-time monitoring of your authentication stack, instantly notifying you and your users on potential account hijacks.

There is a newer version: 2.4.3
Show newest version
package io.castle.client.internal.json;

import com.google.gson.FieldNamingPolicy;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import io.castle.client.model.AuthenticateAction;
import io.castle.client.model.CastleHeaders;

public class CastleGsonModel {

    private final Gson gson;

    public CastleGsonModel() {
        GsonBuilder builder = new GsonBuilder().setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES);
        builder.registerTypeAdapter(CastleHeaders.class, new CastleHeadersSerializer());
        builder.registerTypeAdapter(String.class, new StringJsonSerializer());
        builder.registerTypeAdapter(CastleHeaders.class, new CastleHeadersDeserializer());
        builder.registerTypeAdapter(AuthenticateAction.class, new AuthenticateActionDeserializer());
        this.gson = builder.create();
    }


    public Gson getGson() {
        return gson;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy