Class CredentialInjector
java.lang.Object
com.google.protobuf.AbstractMessageLite
com.google.protobuf.AbstractMessage
com.google.protobuf.GeneratedMessageV3
io.envoyproxy.envoy.extensions.filters.http.credential_injector.v3.CredentialInjector
- All Implemented Interfaces:
com.google.protobuf.Message,com.google.protobuf.MessageLite,com.google.protobuf.MessageLiteOrBuilder,com.google.protobuf.MessageOrBuilder,CredentialInjectorOrBuilder,Serializable
public final class CredentialInjector
extends com.google.protobuf.GeneratedMessageV3
implements CredentialInjectorOrBuilder
Credential Injector injects credentials into outgoing HTTP requests. The filter configuration is used to retrieve the credentials, or
they can be requested through the OAuth2 client credential grant. The credentials obtained are then injected into the Authorization header
of the proxied HTTP requests, utilizing either the Basic or Bearer scheme.
If the credential is not present or there was a failure injecting the credential, the request will fail with ``401 Unauthorized`` unless
``allow_request_without_credential`` is set to ``true``.
Notice: This filter is intended to be used for workload authentication, which means that the identity associated with the inserted credential
is considered as the identity of the workload behind the envoy proxy(in this case, envoy is typically deployed as a sidecar alongside that
workload). Please note that this filter does not handle end user authentication. Its purpose is solely to authenticate the workload itself.
Here is an example of CredentialInjector configuration with Generic credential, which injects an HTTP Basic Auth credential into the proxied requests.
.. code-block:: yaml
overwrite: true
credential:
name: generic_credential
typed_config:
"@type": type.googleapis.com/envoy.extensions.http.injected_credentials.generic.v3.Generic
credential:
name: credential
sds_config:
path_config_source:
path: credential.yaml
header: Authorization
credential.yaml for Basic Auth:
.. code-block:: yaml
resources:
- "@type": "type.googleapis.com/envoy.extensions.transport_sockets.tls.v3.Secret"
name: credential
generic_secret:
secret:
inline_string: "Basic base64EncodedUsernamePassword"
It can also be configured to inject a Bearer token into the proxied requests.
credential.yaml for Bearer Token:
.. code-block:: yaml
resources:
- "@type": "type.googleapis.com/envoy.extensions.transport_sockets.tls.v3.Secret"
name: credential
generic_secret:
secret:
inline_string: "Bearer myToken"
Protobuf type envoy.extensions.filters.http.credential_injector.v3.CredentialInjector- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classCredential Injector injects credentials into outgoing HTTP requests.Nested classes/interfaces inherited from class com.google.protobuf.GeneratedMessageV3
com.google.protobuf.GeneratedMessageV3.BuilderParent, com.google.protobuf.GeneratedMessageV3.ExtendableBuilder<MessageT extends com.google.protobuf.GeneratedMessageV3.ExtendableMessage<MessageT>,BuilderT extends com.google.protobuf.GeneratedMessageV3.ExtendableBuilder<MessageT, BuilderT>>, com.google.protobuf.GeneratedMessageV3.ExtendableMessage<MessageT extends com.google.protobuf.GeneratedMessageV3.ExtendableMessage<MessageT>>, com.google.protobuf.GeneratedMessageV3.ExtendableMessageOrBuilder<MessageT extends com.google.protobuf.GeneratedMessageV3.ExtendableMessage<MessageT>>, com.google.protobuf.GeneratedMessageV3.FieldAccessorTable, com.google.protobuf.GeneratedMessageV3.UnusedPrivateParameter Nested classes/interfaces inherited from class com.google.protobuf.AbstractMessageLite
com.google.protobuf.AbstractMessageLite.InternalOneOfEnum -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intstatic final intFields inherited from class com.google.protobuf.GeneratedMessageV3
alwaysUseFieldBuilders, unknownFieldsFields inherited from class com.google.protobuf.AbstractMessage
memoizedSizeFields inherited from class com.google.protobuf.AbstractMessageLite
memoizedHashCode -
Method Summary
Modifier and TypeMethodDescriptionbooleanbooleanWhether to send the request to upstream if the credential is not present or if the credential injection to the request fails.The credential to inject into the proxied requests [#extension-category: envoy.http.injected_credentials]The credential to inject into the proxied requests [#extension-category: envoy.http.injected_credentials]static CredentialInjectorstatic final com.google.protobuf.Descriptors.DescriptorbooleanWhether to overwrite the value or not if the injected headers already exist.com.google.protobuf.Parser<CredentialInjector>intbooleanThe credential to inject into the proxied requests [#extension-category: envoy.http.injected_credentials]inthashCode()protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTablefinal booleanstatic CredentialInjector.Builderstatic CredentialInjector.BuildernewBuilder(CredentialInjector prototype) protected CredentialInjector.BuildernewBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) protected ObjectnewInstance(com.google.protobuf.GeneratedMessageV3.UnusedPrivateParameter unused) static CredentialInjectorparseDelimitedFrom(InputStream input) static CredentialInjectorparseDelimitedFrom(InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) static CredentialInjectorparseFrom(byte[] data) static CredentialInjectorparseFrom(byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) static CredentialInjectorparseFrom(com.google.protobuf.ByteString data) static CredentialInjectorparseFrom(com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) static CredentialInjectorparseFrom(com.google.protobuf.CodedInputStream input) static CredentialInjectorparseFrom(com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) static CredentialInjectorparseFrom(InputStream input) static CredentialInjectorparseFrom(InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) static CredentialInjectorparseFrom(ByteBuffer data) static CredentialInjectorparseFrom(ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) static com.google.protobuf.Parser<CredentialInjector>parser()voidwriteTo(com.google.protobuf.CodedOutputStream output) Methods inherited from class com.google.protobuf.GeneratedMessageV3
canUseUnsafe, computeStringSize, computeStringSizeNoTag, emptyBooleanList, emptyDoubleList, emptyFloatList, emptyIntList, emptyList, emptyLongList, getAllFields, getDescriptorForType, getField, getOneofFieldDescriptor, getRepeatedField, getRepeatedFieldCount, getUnknownFields, hasField, hasOneof, internalGetMapField, internalGetMapFieldReflection, isStringEmpty, makeExtensionsImmutable, makeMutableCopy, makeMutableCopy, mergeFromAndMakeImmutableInternal, mutableCopy, mutableCopy, mutableCopy, mutableCopy, mutableCopy, newBooleanList, newBuilderForType, newDoubleList, newFloatList, newIntList, newLongList, parseDelimitedWithIOException, parseDelimitedWithIOException, parseUnknownField, parseUnknownFieldProto3, parseWithIOException, parseWithIOException, parseWithIOException, parseWithIOException, serializeBooleanMapTo, serializeIntegerMapTo, serializeLongMapTo, serializeStringMapTo, writeReplace, writeString, writeStringNoTagMethods inherited from class com.google.protobuf.AbstractMessage
findInitializationErrors, getInitializationErrorString, hashBoolean, hashEnum, hashEnumList, hashFields, hashLong, toStringMethods inherited from class com.google.protobuf.AbstractMessageLite
addAll, addAll, checkByteStringIsUtf8, toByteArray, toByteString, writeDelimitedTo, writeToMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface com.google.protobuf.MessageLite
toByteArray, toByteString, writeDelimitedTo, writeToMethods inherited from interface com.google.protobuf.MessageOrBuilder
findInitializationErrors, getAllFields, getDescriptorForType, getField, getInitializationErrorString, getOneofFieldDescriptor, getRepeatedField, getRepeatedFieldCount, getUnknownFields, hasField, hasOneof
-
Field Details
-
OVERWRITE_FIELD_NUMBER
public static final int OVERWRITE_FIELD_NUMBER- See Also:
-
ALLOW_REQUEST_WITHOUT_CREDENTIAL_FIELD_NUMBER
public static final int ALLOW_REQUEST_WITHOUT_CREDENTIAL_FIELD_NUMBER- See Also:
-
CREDENTIAL_FIELD_NUMBER
public static final int CREDENTIAL_FIELD_NUMBER- See Also:
-
-
Method Details
-
newInstance
- Overrides:
newInstancein classcom.google.protobuf.GeneratedMessageV3
-
getDescriptor
public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() -
internalGetFieldAccessorTable
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()- Specified by:
internalGetFieldAccessorTablein classcom.google.protobuf.GeneratedMessageV3
-
getOverwrite
public boolean getOverwrite()Whether to overwrite the value or not if the injected headers already exist. Value defaults to false.
bool overwrite = 1;- Specified by:
getOverwritein interfaceCredentialInjectorOrBuilder- Returns:
- The overwrite.
-
getAllowRequestWithoutCredential
public boolean getAllowRequestWithoutCredential()Whether to send the request to upstream if the credential is not present or if the credential injection to the request fails. By default, a request will fail with ``401 Unauthorized`` if the credential is not present or the injection of the credential to the request fails. If set to true, the request will be sent to upstream without the credential.
bool allow_request_without_credential = 2;- Specified by:
getAllowRequestWithoutCredentialin interfaceCredentialInjectorOrBuilder- Returns:
- The allowRequestWithoutCredential.
-
hasCredential
public boolean hasCredential()The credential to inject into the proxied requests [#extension-category: envoy.http.injected_credentials]
.envoy.config.core.v3.TypedExtensionConfig credential = 3 [(.validate.rules) = { ... }- Specified by:
hasCredentialin interfaceCredentialInjectorOrBuilder- Returns:
- Whether the credential field is set.
-
getCredential
The credential to inject into the proxied requests [#extension-category: envoy.http.injected_credentials]
.envoy.config.core.v3.TypedExtensionConfig credential = 3 [(.validate.rules) = { ... }- Specified by:
getCredentialin interfaceCredentialInjectorOrBuilder- Returns:
- The credential.
-
getCredentialOrBuilder
The credential to inject into the proxied requests [#extension-category: envoy.http.injected_credentials]
.envoy.config.core.v3.TypedExtensionConfig credential = 3 [(.validate.rules) = { ... }- Specified by:
getCredentialOrBuilderin interfaceCredentialInjectorOrBuilder
-
isInitialized
public final boolean isInitialized()- Specified by:
isInitializedin interfacecom.google.protobuf.MessageLiteOrBuilder- Overrides:
isInitializedin classcom.google.protobuf.GeneratedMessageV3
-
writeTo
- Specified by:
writeToin interfacecom.google.protobuf.MessageLite- Overrides:
writeToin classcom.google.protobuf.GeneratedMessageV3- Throws:
IOException
-
getSerializedSize
public int getSerializedSize()- Specified by:
getSerializedSizein interfacecom.google.protobuf.MessageLite- Overrides:
getSerializedSizein classcom.google.protobuf.GeneratedMessageV3
-
equals
- Specified by:
equalsin interfacecom.google.protobuf.Message- Overrides:
equalsin classcom.google.protobuf.AbstractMessage
-
hashCode
public int hashCode()- Specified by:
hashCodein interfacecom.google.protobuf.Message- Overrides:
hashCodein classcom.google.protobuf.AbstractMessage
-
parseFrom
public static CredentialInjector parseFrom(ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException - Throws:
com.google.protobuf.InvalidProtocolBufferException
-
parseFrom
public static CredentialInjector parseFrom(ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException - Throws:
com.google.protobuf.InvalidProtocolBufferException
-
parseFrom
public static CredentialInjector parseFrom(com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException - Throws:
com.google.protobuf.InvalidProtocolBufferException
-
parseFrom
public static CredentialInjector parseFrom(com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException - Throws:
com.google.protobuf.InvalidProtocolBufferException
-
parseFrom
public static CredentialInjector parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException - Throws:
com.google.protobuf.InvalidProtocolBufferException
-
parseFrom
public static CredentialInjector parseFrom(byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException - Throws:
com.google.protobuf.InvalidProtocolBufferException
-
parseFrom
- Throws:
IOException
-
parseFrom
public static CredentialInjector parseFrom(InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws IOException - Throws:
IOException
-
parseDelimitedFrom
- Throws:
IOException
-
parseDelimitedFrom
public static CredentialInjector parseDelimitedFrom(InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws IOException - Throws:
IOException
-
parseFrom
public static CredentialInjector parseFrom(com.google.protobuf.CodedInputStream input) throws IOException - Throws:
IOException
-
parseFrom
public static CredentialInjector parseFrom(com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws IOException - Throws:
IOException
-
newBuilderForType
- Specified by:
newBuilderForTypein interfacecom.google.protobuf.Message- Specified by:
newBuilderForTypein interfacecom.google.protobuf.MessageLite
-
newBuilder
-
newBuilder
-
toBuilder
- Specified by:
toBuilderin interfacecom.google.protobuf.Message- Specified by:
toBuilderin interfacecom.google.protobuf.MessageLite
-
newBuilderForType
protected CredentialInjector.Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) - Specified by:
newBuilderForTypein classcom.google.protobuf.GeneratedMessageV3
-
getDefaultInstance
-
parser
-
getParserForType
- Specified by:
getParserForTypein interfacecom.google.protobuf.Message- Specified by:
getParserForTypein interfacecom.google.protobuf.MessageLite- Overrides:
getParserForTypein classcom.google.protobuf.GeneratedMessageV3
-
getDefaultInstanceForType
- Specified by:
getDefaultInstanceForTypein interfacecom.google.protobuf.MessageLiteOrBuilder- Specified by:
getDefaultInstanceForTypein interfacecom.google.protobuf.MessageOrBuilder
-