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

com.geotab.model.entity.certificate.Certificate Maven / Gradle / Ivy

/*
 *
 * 2020 Copyright (C) Geotab Inc. All rights reserved.
 */

package com.geotab.model.entity.certificate;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.geotab.model.entity.Entity;
import com.geotab.model.serialization.X509CertificateDeserializer;
import com.geotab.model.serialization.X509CertificateSerializer;
import java.security.cert.X509Certificate;
import lombok.Builder;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;

/**
 * An object representing a X509Certificate used to check if a message came from the correct
 * external source.
 */
@NoArgsConstructor
@Getter
@Setter
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
public class Certificate extends Entity {

  /**
   * The issuer of the certificate.
   */
  private String issuer;

  /**
   * The public key of the certificate.
   */
  @JsonSerialize(using = X509CertificateSerializer.class)
  @JsonDeserialize(using = X509CertificateDeserializer.class)
  private X509Certificate key;

  /**
   * The url to go to when as user with this certificate logs off.
   */
  private String logOffUrl;

  /**
   * The url to go to when as user with this certificate logs in.
   */
  private String logInUrl;

  /**
   * Value indicating whether certificate is a root certificate that is used for validating all
   * client certificate.
   */
  @JsonProperty("isRoot")
  private boolean isRoot;

  @Builder
  public Certificate(String id, String issuer, X509Certificate key, String logOffUrl,
      String logInUrl, boolean isRoot) {
    super(id);
    this.issuer = issuer;
    this.key = key;
    this.logOffUrl = logOffUrl;
    this.logInUrl = logInUrl;
    this.isRoot = isRoot;
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy