
com.google.api.auth.JwtLocation.scala Maven / Gradle / Ivy
// Generated by the Scala Plugin for the Protocol Buffer Compiler.
// Do not edit!
//
// Protofile syntax: PROTO3
package com.google.api.auth
/** Specifies a location to extract JWT from an API request.
*
* @param valuePrefix
* The value prefix. The value format is "value_prefix{token}"
* Only applies to "in" header type. Must be empty for "in" query type.
* If not empty, the header value has to match (case sensitive) this prefix.
* If not matched, JWT will not be extracted. If matched, JWT will be
* extracted after the prefix is removed.
*
* For example, for "Authorization: Bearer {JWT}",
* value_prefix="Bearer " with a space at the end.
*/
@SerialVersionUID(0L)
final case class JwtLocation(
in: com.google.api.auth.JwtLocation.In = com.google.api.auth.JwtLocation.In.Empty,
valuePrefix: _root_.scala.Predef.String = "",
unknownFields: _root_.scalapb.UnknownFieldSet = _root_.scalapb.UnknownFieldSet.empty
) extends scalapb.GeneratedMessage with scalapb.lenses.Updatable[JwtLocation] {
@transient
private[this] var __serializedSizeMemoized: _root_.scala.Int = 0
private[this] def __computeSerializedSize(): _root_.scala.Int = {
var __size = 0
if (in.header.isDefined) {
val __value = in.header.get
__size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(1, __value)
};
if (in.query.isDefined) {
val __value = in.query.get
__size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(2, __value)
};
if (in.cookie.isDefined) {
val __value = in.cookie.get
__size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(4, __value)
};
{
val __value = valuePrefix
if (!__value.isEmpty) {
__size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(3, __value)
}
};
__size += unknownFields.serializedSize
__size
}
override def serializedSize: _root_.scala.Int = {
var __size = __serializedSizeMemoized
if (__size == 0) {
__size = __computeSerializedSize() + 1
__serializedSizeMemoized = __size
}
__size - 1
}
def writeTo(`_output__`: _root_.com.google.protobuf.CodedOutputStream): _root_.scala.Unit = {
in.header.foreach { __v =>
val __m = __v
_output__.writeString(1, __m)
};
in.query.foreach { __v =>
val __m = __v
_output__.writeString(2, __m)
};
{
val __v = valuePrefix
if (!__v.isEmpty) {
_output__.writeString(3, __v)
}
};
in.cookie.foreach { __v =>
val __m = __v
_output__.writeString(4, __m)
};
unknownFields.writeTo(_output__)
}
def getHeader: _root_.scala.Predef.String = in.header.getOrElse("")
def withHeader(__v: _root_.scala.Predef.String): JwtLocation = copy(in = com.google.api.auth.JwtLocation.In.Header(__v))
def getQuery: _root_.scala.Predef.String = in.query.getOrElse("")
def withQuery(__v: _root_.scala.Predef.String): JwtLocation = copy(in = com.google.api.auth.JwtLocation.In.Query(__v))
def getCookie: _root_.scala.Predef.String = in.cookie.getOrElse("")
def withCookie(__v: _root_.scala.Predef.String): JwtLocation = copy(in = com.google.api.auth.JwtLocation.In.Cookie(__v))
def withValuePrefix(__v: _root_.scala.Predef.String): JwtLocation = copy(valuePrefix = __v)
def clearIn: JwtLocation = copy(in = com.google.api.auth.JwtLocation.In.Empty)
def withIn(__v: com.google.api.auth.JwtLocation.In): JwtLocation = copy(in = __v)
def withUnknownFields(__v: _root_.scalapb.UnknownFieldSet) = copy(unknownFields = __v)
def discardUnknownFields = copy(unknownFields = _root_.scalapb.UnknownFieldSet.empty)
def getFieldByNumber(__fieldNumber: _root_.scala.Int): _root_.scala.Any = {
(__fieldNumber: @_root_.scala.unchecked) match {
case 1 => in.header.orNull
case 2 => in.query.orNull
case 4 => in.cookie.orNull
case 3 => {
val __t = valuePrefix
if (__t != "") __t else null
}
}
}
def getField(__field: _root_.scalapb.descriptors.FieldDescriptor): _root_.scalapb.descriptors.PValue = {
_root_.scala.Predef.require(__field.containingMessage eq companion.scalaDescriptor)
(__field.number: @_root_.scala.unchecked) match {
case 1 => in.header.map(_root_.scalapb.descriptors.PString(_)).getOrElse(_root_.scalapb.descriptors.PEmpty)
case 2 => in.query.map(_root_.scalapb.descriptors.PString(_)).getOrElse(_root_.scalapb.descriptors.PEmpty)
case 4 => in.cookie.map(_root_.scalapb.descriptors.PString(_)).getOrElse(_root_.scalapb.descriptors.PEmpty)
case 3 => _root_.scalapb.descriptors.PString(valuePrefix)
}
}
def toProtoString: _root_.scala.Predef.String = _root_.scalapb.TextFormat.printToUnicodeString(this)
def companion: com.google.api.auth.JwtLocation.type = com.google.api.auth.JwtLocation
// @@protoc_insertion_point(GeneratedMessage[google.api.JwtLocation])
}
object JwtLocation extends scalapb.GeneratedMessageCompanion[com.google.api.auth.JwtLocation] {
implicit def messageCompanion: scalapb.GeneratedMessageCompanion[com.google.api.auth.JwtLocation] = this
def parseFrom(`_input__`: _root_.com.google.protobuf.CodedInputStream): com.google.api.auth.JwtLocation = {
var __valuePrefix: _root_.scala.Predef.String = ""
var __in: com.google.api.auth.JwtLocation.In = com.google.api.auth.JwtLocation.In.Empty
var `_unknownFields__`: _root_.scalapb.UnknownFieldSet.Builder = null
var _done__ = false
while (!_done__) {
val _tag__ = _input__.readTag()
_tag__ match {
case 0 => _done__ = true
case 10 =>
__in = com.google.api.auth.JwtLocation.In.Header(_input__.readStringRequireUtf8())
case 18 =>
__in = com.google.api.auth.JwtLocation.In.Query(_input__.readStringRequireUtf8())
case 34 =>
__in = com.google.api.auth.JwtLocation.In.Cookie(_input__.readStringRequireUtf8())
case 26 =>
__valuePrefix = _input__.readStringRequireUtf8()
case tag =>
if (_unknownFields__ == null) {
_unknownFields__ = new _root_.scalapb.UnknownFieldSet.Builder()
}
_unknownFields__.parseField(tag, _input__)
}
}
com.google.api.auth.JwtLocation(
valuePrefix = __valuePrefix,
in = __in,
unknownFields = if (_unknownFields__ == null) _root_.scalapb.UnknownFieldSet.empty else _unknownFields__.result()
)
}
implicit def messageReads: _root_.scalapb.descriptors.Reads[com.google.api.auth.JwtLocation] = _root_.scalapb.descriptors.Reads{
case _root_.scalapb.descriptors.PMessage(__fieldsMap) =>
_root_.scala.Predef.require(__fieldsMap.keys.forall(_.containingMessage eq scalaDescriptor), "FieldDescriptor does not match message type.")
com.google.api.auth.JwtLocation(
valuePrefix = __fieldsMap.get(scalaDescriptor.findFieldByNumber(3).get).map(_.as[_root_.scala.Predef.String]).getOrElse(""),
in = __fieldsMap.get(scalaDescriptor.findFieldByNumber(1).get).flatMap(_.as[_root_.scala.Option[_root_.scala.Predef.String]]).map(com.google.api.auth.JwtLocation.In.Header(_))
.orElse[com.google.api.auth.JwtLocation.In](__fieldsMap.get(scalaDescriptor.findFieldByNumber(2).get).flatMap(_.as[_root_.scala.Option[_root_.scala.Predef.String]]).map(com.google.api.auth.JwtLocation.In.Query(_)))
.orElse[com.google.api.auth.JwtLocation.In](__fieldsMap.get(scalaDescriptor.findFieldByNumber(4).get).flatMap(_.as[_root_.scala.Option[_root_.scala.Predef.String]]).map(com.google.api.auth.JwtLocation.In.Cookie(_)))
.getOrElse(com.google.api.auth.JwtLocation.In.Empty)
)
case _ => throw new RuntimeException("Expected PMessage")
}
def javaDescriptor: _root_.com.google.protobuf.Descriptors.Descriptor = AuthProto.javaDescriptor.getMessageTypes().get(2)
def scalaDescriptor: _root_.scalapb.descriptors.Descriptor = AuthProto.scalaDescriptor.messages(2)
def messageCompanionForFieldNumber(__number: _root_.scala.Int): _root_.scalapb.GeneratedMessageCompanion[_] = throw new MatchError(__number)
lazy val nestedMessagesCompanions: Seq[_root_.scalapb.GeneratedMessageCompanion[_ <: _root_.scalapb.GeneratedMessage]] = Seq.empty
def enumCompanionForFieldNumber(__fieldNumber: _root_.scala.Int): _root_.scalapb.GeneratedEnumCompanion[_] = throw new MatchError(__fieldNumber)
lazy val defaultInstance = com.google.api.auth.JwtLocation(
valuePrefix = "",
in = com.google.api.auth.JwtLocation.In.Empty
)
sealed trait In extends _root_.scalapb.GeneratedOneof {
def isEmpty: _root_.scala.Boolean = false
def isDefined: _root_.scala.Boolean = true
def isHeader: _root_.scala.Boolean = false
def isQuery: _root_.scala.Boolean = false
def isCookie: _root_.scala.Boolean = false
def header: _root_.scala.Option[_root_.scala.Predef.String] = _root_.scala.None
def query: _root_.scala.Option[_root_.scala.Predef.String] = _root_.scala.None
def cookie: _root_.scala.Option[_root_.scala.Predef.String] = _root_.scala.None
}
object In {
@SerialVersionUID(0L)
case object Empty extends com.google.api.auth.JwtLocation.In {
type ValueType = _root_.scala.Nothing
override def isEmpty: _root_.scala.Boolean = true
override def isDefined: _root_.scala.Boolean = false
override def number: _root_.scala.Int = 0
override def value: _root_.scala.Nothing = throw new java.util.NoSuchElementException("Empty.value")
}
@SerialVersionUID(0L)
final case class Header(value: _root_.scala.Predef.String) extends com.google.api.auth.JwtLocation.In {
type ValueType = _root_.scala.Predef.String
override def isHeader: _root_.scala.Boolean = true
override def header: _root_.scala.Option[_root_.scala.Predef.String] = Some(value)
override def number: _root_.scala.Int = 1
}
@SerialVersionUID(0L)
final case class Query(value: _root_.scala.Predef.String) extends com.google.api.auth.JwtLocation.In {
type ValueType = _root_.scala.Predef.String
override def isQuery: _root_.scala.Boolean = true
override def query: _root_.scala.Option[_root_.scala.Predef.String] = Some(value)
override def number: _root_.scala.Int = 2
}
@SerialVersionUID(0L)
final case class Cookie(value: _root_.scala.Predef.String) extends com.google.api.auth.JwtLocation.In {
type ValueType = _root_.scala.Predef.String
override def isCookie: _root_.scala.Boolean = true
override def cookie: _root_.scala.Option[_root_.scala.Predef.String] = Some(value)
override def number: _root_.scala.Int = 4
}
}
implicit class JwtLocationLens[UpperPB](_l: _root_.scalapb.lenses.Lens[UpperPB, com.google.api.auth.JwtLocation]) extends _root_.scalapb.lenses.ObjectLens[UpperPB, com.google.api.auth.JwtLocation](_l) {
def header: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.getHeader)((c_, f_) => c_.copy(in = com.google.api.auth.JwtLocation.In.Header(f_)))
def query: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.getQuery)((c_, f_) => c_.copy(in = com.google.api.auth.JwtLocation.In.Query(f_)))
def cookie: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.getCookie)((c_, f_) => c_.copy(in = com.google.api.auth.JwtLocation.In.Cookie(f_)))
def valuePrefix: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.valuePrefix)((c_, f_) => c_.copy(valuePrefix = f_))
def in: _root_.scalapb.lenses.Lens[UpperPB, com.google.api.auth.JwtLocation.In] = field(_.in)((c_, f_) => c_.copy(in = f_))
}
final val HEADER_FIELD_NUMBER = 1
final val QUERY_FIELD_NUMBER = 2
final val COOKIE_FIELD_NUMBER = 4
final val VALUE_PREFIX_FIELD_NUMBER = 3
def of(
in: com.google.api.auth.JwtLocation.In,
valuePrefix: _root_.scala.Predef.String
): _root_.com.google.api.auth.JwtLocation = _root_.com.google.api.auth.JwtLocation(
in,
valuePrefix
)
// @@protoc_insertion_point(GeneratedMessageCompanion[google.api.JwtLocation])
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy