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

com.svix.models.Oauth2AuthMethodIn Maven / Gradle / Ivy

The newest version!
/*
 * Svix API
 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
 *
 * The version of the OpenAPI document: 1.1.1
 * 
 *
 * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
 * https://openapi-generator.tech
 * Do not edit the class manually.
 */


package com.svix.models;

import java.util.Objects;
import com.google.gson.annotations.SerializedName;

import java.io.IOException;
import com.google.gson.TypeAdapter;
import com.google.gson.JsonElement;
import com.google.gson.annotations.JsonAdapter;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;

/**
 * The method used for authenticating to the OAuth authorization server.  `clientSecretJwt` will construct a JWT used for authentication with the oauth authorization server. This method is less commonly used and may not be supported by all oauth providers. `clientSecretBasic` will authenticate to the oauth authorization server using an `Authorization` header with the client secret as the value. This is the most common means of authentication. `clientSecretPost` will authenticate to the oauth authorization server by passing the client secret in a `client_secret` field in the request body. This method may not be supported by all oauth providers, and in general `clientSecretBasic` should be preferred.
 */
@JsonAdapter(Oauth2AuthMethodIn.Adapter.class)
public enum Oauth2AuthMethodIn {
  
  CLIENT_SECRET_JWT("clientSecretJwt"),
  
  CLIENT_SECRET_BASIC("clientSecretBasic"),
  
  CLIENT_SECRET_POST("clientSecretPost");

  private String value;

  Oauth2AuthMethodIn(String value) {
    this.value = value;
  }

  public String getValue() {
    return value;
  }

  @Override
  public String toString() {
    return String.valueOf(value);
  }

  public static Oauth2AuthMethodIn fromValue(String value) {
    for (Oauth2AuthMethodIn b : Oauth2AuthMethodIn.values()) {
      if (b.value.equals(value)) {
        return b;
      }
    }
    throw new IllegalArgumentException("Unexpected value '" + value + "'");
  }

  public static class Adapter extends TypeAdapter {
    @Override
    public void write(final JsonWriter jsonWriter, final Oauth2AuthMethodIn enumeration) throws IOException {
      jsonWriter.value(enumeration.getValue());
    }

    @Override
    public Oauth2AuthMethodIn read(final JsonReader jsonReader) throws IOException {
      String value = jsonReader.nextString();
      return Oauth2AuthMethodIn.fromValue(value);
    }
  }

  public static void validateJsonElement(JsonElement jsonElement) throws IOException {
    String value = jsonElement.getAsString();
    Oauth2AuthMethodIn.fromValue(value);
  }
}





© 2015 - 2025 Weber Informatics LLC | Privacy Policy