TokenClaimEnum.java

  1. /*
  2.  * GovWay - A customizable API Gateway
  3.  * https://govway.org
  4.  *
  5.  * Copyright (c) 2005-2025 Link.it srl (https://link.it).
  6.  *
  7.  * This program is free software: you can redistribute it and/or modify
  8.  * it under the terms of the GNU General Public License version 3, as published by
  9.  * the Free Software Foundation.
  10.  *
  11.  * This program is distributed in the hope that it will be useful,
  12.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14.  * GNU General Public License for more details.
  15.  *
  16.  * You should have received a copy of the GNU General Public License
  17.  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  18.  *
  19.  */
  20. package org.openspcoop2.utils.service.beans;

  21. import com.fasterxml.jackson.annotation.JsonCreator;
  22. import com.fasterxml.jackson.annotation.JsonValue;

  23. /**
  24.  * Gets or Sets TokenClaimEnum
  25.  */
  26. public enum TokenClaimEnum {
  27. SUBJECT("subject"),
  28.   ISSUER("issuer"),
  29.   CLIENT_ID("client_id"),
  30.   USERNAME("username"),
  31.   EMAIL("email");

  32.   private String value;

  33.   TokenClaimEnum(String value) {
  34.     this.value = value;
  35.   }

  36.   @Override
  37.   @JsonValue
  38.   public String toString() {
  39.     return String.valueOf(this.value);
  40.   }

  41.   @JsonCreator
  42.   public static TokenClaimEnum fromValue(String text) {
  43.     for (TokenClaimEnum b : TokenClaimEnum.values()) {
  44.       if (String.valueOf(b.value).equals(text)) {
  45.         return b;
  46.       }
  47.     }
  48.     return null;
  49.   }
  50.  
  51. }