Class CredentialInjector.Builder
java.lang.Object
com.google.protobuf.AbstractMessageLite.Builder
com.google.protobuf.AbstractMessage.Builder<BuilderT>
com.google.protobuf.GeneratedMessageV3.Builder<CredentialInjector.Builder>
io.envoyproxy.envoy.extensions.filters.http.credential_injector.v3.CredentialInjector.Builder
- All Implemented Interfaces:
com.google.protobuf.Message.Builder,com.google.protobuf.MessageLite.Builder,com.google.protobuf.MessageLiteOrBuilder,com.google.protobuf.MessageOrBuilder,CredentialInjectorOrBuilder,Cloneable
- Enclosing class:
- CredentialInjector
public static final class CredentialInjector.Builder
extends com.google.protobuf.GeneratedMessageV3.Builder<CredentialInjector.Builder>
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-
Method Summary
Modifier and TypeMethodDescriptionaddRepeatedField(com.google.protobuf.Descriptors.FieldDescriptor field, Object value) build()clear()Whether 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]clearField(com.google.protobuf.Descriptors.FieldDescriptor field) clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) Whether to overwrite the value or not if the injected headers already exist.clone()booleanWhether 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]The credential to inject into the proxied requests [#extension-category: envoy.http.injected_credentials]static final com.google.protobuf.Descriptors.Descriptorcom.google.protobuf.Descriptors.DescriptorbooleanWhether to overwrite the value or not if the injected headers already exist.booleanThe credential to inject into the proxied requests [#extension-category: envoy.http.injected_credentials]protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTablefinal booleanThe credential to inject into the proxied requests [#extension-category: envoy.http.injected_credentials]mergeFrom(com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) mergeFrom(com.google.protobuf.Message other) mergeFrom(CredentialInjector other) mergeUnknownFields(com.google.protobuf.UnknownFieldSet unknownFields) setAllowRequestWithoutCredential(boolean value) Whether 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]setCredential(TypedExtensionConfig.Builder builderForValue) The credential to inject into the proxied requests [#extension-category: envoy.http.injected_credentials]setOverwrite(boolean value) Whether to overwrite the value or not if the injected headers already exist.setRepeatedField(com.google.protobuf.Descriptors.FieldDescriptor field, int index, Object value) setUnknownFields(com.google.protobuf.UnknownFieldSet unknownFields) Methods inherited from class com.google.protobuf.GeneratedMessageV3.Builder
getAllFields, getField, getFieldBuilder, getOneofFieldDescriptor, getParentForChildren, getRepeatedField, getRepeatedFieldBuilder, getRepeatedFieldCount, getUnknownFields, getUnknownFieldSetBuilder, hasField, hasOneof, internalGetMapField, internalGetMapFieldReflection, internalGetMutableMapField, internalGetMutableMapFieldReflection, isClean, markClean, mergeUnknownLengthDelimitedField, mergeUnknownVarintField, newBuilderForField, onBuilt, onChanged, parseUnknownField, setUnknownFieldSetBuilder, setUnknownFieldsProto3Methods inherited from class com.google.protobuf.AbstractMessage.Builder
findInitializationErrors, getInitializationErrorString, internalMergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, newUninitializedMessageException, toStringMethods inherited from class com.google.protobuf.AbstractMessageLite.Builder
addAll, addAll, mergeDelimitedFrom, mergeDelimitedFrom, mergeFrom, newUninitializedMessageExceptionMethods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface com.google.protobuf.Message.Builder
mergeDelimitedFrom, mergeDelimitedFromMethods inherited from interface com.google.protobuf.MessageLite.Builder
mergeFromMethods inherited from interface com.google.protobuf.MessageOrBuilder
findInitializationErrors, getAllFields, getField, getInitializationErrorString, getOneofFieldDescriptor, getRepeatedField, getRepeatedFieldCount, getUnknownFields, hasField, hasOneof
-
Method Details
-
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.Builder<CredentialInjector.Builder>
-
clear
- Specified by:
clearin interfacecom.google.protobuf.Message.Builder- Specified by:
clearin interfacecom.google.protobuf.MessageLite.Builder- Overrides:
clearin classcom.google.protobuf.GeneratedMessageV3.Builder<CredentialInjector.Builder>
-
getDescriptorForType
public com.google.protobuf.Descriptors.Descriptor getDescriptorForType()- Specified by:
getDescriptorForTypein interfacecom.google.protobuf.Message.Builder- Specified by:
getDescriptorForTypein interfacecom.google.protobuf.MessageOrBuilder- Overrides:
getDescriptorForTypein classcom.google.protobuf.GeneratedMessageV3.Builder<CredentialInjector.Builder>
-
getDefaultInstanceForType
- Specified by:
getDefaultInstanceForTypein interfacecom.google.protobuf.MessageLiteOrBuilder- Specified by:
getDefaultInstanceForTypein interfacecom.google.protobuf.MessageOrBuilder
-
build
- Specified by:
buildin interfacecom.google.protobuf.Message.Builder- Specified by:
buildin interfacecom.google.protobuf.MessageLite.Builder
-
buildPartial
- Specified by:
buildPartialin interfacecom.google.protobuf.Message.Builder- Specified by:
buildPartialin interfacecom.google.protobuf.MessageLite.Builder
-
clone
- Specified by:
clonein interfacecom.google.protobuf.Message.Builder- Specified by:
clonein interfacecom.google.protobuf.MessageLite.Builder- Overrides:
clonein classcom.google.protobuf.GeneratedMessageV3.Builder<CredentialInjector.Builder>
-
setField
public CredentialInjector.Builder setField(com.google.protobuf.Descriptors.FieldDescriptor field, Object value) - Specified by:
setFieldin interfacecom.google.protobuf.Message.Builder- Overrides:
setFieldin classcom.google.protobuf.GeneratedMessageV3.Builder<CredentialInjector.Builder>
-
clearField
- Specified by:
clearFieldin interfacecom.google.protobuf.Message.Builder- Overrides:
clearFieldin classcom.google.protobuf.GeneratedMessageV3.Builder<CredentialInjector.Builder>
-
clearOneof
- Specified by:
clearOneofin interfacecom.google.protobuf.Message.Builder- Overrides:
clearOneofin classcom.google.protobuf.GeneratedMessageV3.Builder<CredentialInjector.Builder>
-
setRepeatedField
public CredentialInjector.Builder setRepeatedField(com.google.protobuf.Descriptors.FieldDescriptor field, int index, Object value) - Specified by:
setRepeatedFieldin interfacecom.google.protobuf.Message.Builder- Overrides:
setRepeatedFieldin classcom.google.protobuf.GeneratedMessageV3.Builder<CredentialInjector.Builder>
-
addRepeatedField
public CredentialInjector.Builder addRepeatedField(com.google.protobuf.Descriptors.FieldDescriptor field, Object value) - Specified by:
addRepeatedFieldin interfacecom.google.protobuf.Message.Builder- Overrides:
addRepeatedFieldin classcom.google.protobuf.GeneratedMessageV3.Builder<CredentialInjector.Builder>
-
mergeFrom
- Specified by:
mergeFromin interfacecom.google.protobuf.Message.Builder- Overrides:
mergeFromin classcom.google.protobuf.AbstractMessage.Builder<CredentialInjector.Builder>
-
mergeFrom
-
isInitialized
public final boolean isInitialized()- Specified by:
isInitializedin interfacecom.google.protobuf.MessageLiteOrBuilder- Overrides:
isInitializedin classcom.google.protobuf.GeneratedMessageV3.Builder<CredentialInjector.Builder>
-
mergeFrom
public CredentialInjector.Builder mergeFrom(com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws IOException - Specified by:
mergeFromin interfacecom.google.protobuf.Message.Builder- Specified by:
mergeFromin interfacecom.google.protobuf.MessageLite.Builder- Overrides:
mergeFromin classcom.google.protobuf.AbstractMessage.Builder<CredentialInjector.Builder>- Throws:
IOException
-
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.
-
setOverwrite
Whether to overwrite the value or not if the injected headers already exist. Value defaults to false.
bool overwrite = 1;- Parameters:
value- The overwrite to set.- Returns:
- This builder for chaining.
-
clearOverwrite
Whether to overwrite the value or not if the injected headers already exist. Value defaults to false.
bool overwrite = 1;- Returns:
- This builder for chaining.
-
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.
-
setAllowRequestWithoutCredential
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;- Parameters:
value- The allowRequestWithoutCredential to set.- Returns:
- This builder for chaining.
-
clearAllowRequestWithoutCredential
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;- Returns:
- This builder for chaining.
-
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.
-
setCredential
The credential to inject into the proxied requests [#extension-category: envoy.http.injected_credentials]
.envoy.config.core.v3.TypedExtensionConfig credential = 3 [(.validate.rules) = { ... } -
setCredential
The credential to inject into the proxied requests [#extension-category: envoy.http.injected_credentials]
.envoy.config.core.v3.TypedExtensionConfig credential = 3 [(.validate.rules) = { ... } -
mergeCredential
The credential to inject into the proxied requests [#extension-category: envoy.http.injected_credentials]
.envoy.config.core.v3.TypedExtensionConfig credential = 3 [(.validate.rules) = { ... } -
clearCredential
The credential to inject into the proxied requests [#extension-category: envoy.http.injected_credentials]
.envoy.config.core.v3.TypedExtensionConfig credential = 3 [(.validate.rules) = { ... } -
getCredentialBuilder
The credential to inject into the proxied requests [#extension-category: envoy.http.injected_credentials]
.envoy.config.core.v3.TypedExtensionConfig credential = 3 [(.validate.rules) = { ... } -
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
-
setUnknownFields
public final CredentialInjector.Builder setUnknownFields(com.google.protobuf.UnknownFieldSet unknownFields) - Specified by:
setUnknownFieldsin interfacecom.google.protobuf.Message.Builder- Overrides:
setUnknownFieldsin classcom.google.protobuf.GeneratedMessageV3.Builder<CredentialInjector.Builder>
-
mergeUnknownFields
public final CredentialInjector.Builder mergeUnknownFields(com.google.protobuf.UnknownFieldSet unknownFields) - Specified by:
mergeUnknownFieldsin interfacecom.google.protobuf.Message.Builder- Overrides:
mergeUnknownFieldsin classcom.google.protobuf.GeneratedMessageV3.Builder<CredentialInjector.Builder>
-