Prev Next

Spring / Spring CredHub Interview questions

Explain the internal working of Spring CredHub's mutual TLS auto-configuration on Cloud Foundry?

flowchart TD A[App staged with Java buildpack] --> B[Container Security Provider injects app identity cert and key] B --> C[Spring CredHub auto-configuration reads spring.credhub.url] C --> D[No OAuth2 properties present, so CredHubTemplate is built for mTLS] D --> E[RestTemplate uses container's keystore and truststore] E --> F[Request to CredHub presents app's platform-issued certificate] F --> G[CredHub validates certificate against trusted platform CA] G --> H[Connection authenticated; request evaluated as mtls-app actor]

The important thing to notice is how little Spring CredHub itself actually does here: it doesn't generate, store, or manage the certificate at all. That's entirely the platform's job, handled before the app process even starts, via the buildpack's container security provider.

Spring CredHub's only real responsibility is deciding, at auto-configuration time, not to configure OAuth2 — because no OAuth2 properties are present — and building a RestTemplate that simply uses the JVM's default (container-provided) keystore and truststore for its TLS connections. CredHub, on its side, resolves the authenticated caller's identity from the certificate's subject and evaluates every subsequent request as that mtls-app:<guid> actor against the credential's permissions.

Who is responsible for generating and installing the app's mTLS certificate?
What does CredHub use to resolve the caller's identity under mTLS?

More Related questions...

What is Spring CredHub? What is CredHub? What are the core modules of Spring CredHub? What is the purpose of the spring-credhub-starter dependency? How do you add Spring CredHub to a Maven project? What is CredHubOperations? What is CredHubTemplate? What are the credential types supported by Spring CredHub? Define CredentialName in Spring CredHub? What is a CredentialDetails object? Describe CredHubCredentialOperations? What is CredHubPermissionOperations used for? List the authentication mechanisms supported by Spring CredHub? What is mutual TLS authentication in Spring CredHub? How do you configure the CredHub server URL? What is a password credential in Spring CredHub? What is a JsonCredential? How do you write a credential using CredHubOperations? What is CredHubInfoOperations? Describe CredHubInterpolationOperations? What is the difference between write and generate operations in Spring CredHub? What is the difference between getByName and getByNameWithHistory? How does Spring CredHub regenerate a credential? Why does Spring CredHub prefer mutual TLS over OAuth2 on Cloud Foundry? How do you configure OAuth2 authentication for Spring CredHub? What is the difference between CredHubPermissionOperations and CredHubPermissionV2Operations? How does Spring CredHub represent an actor in a permission entry? When should you use CredHubInterpolationOperations? What happens when you call getByName for a credential that does not exist? How is CredHubException structured? What is the difference between a UserCredential and a PasswordCredential? How do you enable reactive support in Spring CredHub? What is the difference between CredHubOperations and ReactiveCredHubOperations? Why would you choose CertificateCredential over a generic JsonCredential for TLS material? How does Spring Cloud Config Server use CredHub as a backend? When should you use the generate operation instead of write for a password? How do you troubleshoot a certificate_unknown error with mutual TLS? What is the difference between spring-credhub-core and spring-credhub-starter? Explain the lifecycle of a generated credential in CredHub? Explain the execution flow of a Spring Boot app calling CredHubOperations.write()? Explain the internal working of Spring CredHub's OAuth2 client-credentials authentication? How can you optimize credential retrieval in a high-throughput Spring service? Which is better for testing Spring CredHub integrations, Mockito or a real CredHub server, and why? Explain how CredentialRequest and CredentialDetails work together in the write API? Explain the internal working of Spring CredHub's mutual TLS auto-configuration on Cloud Foundry? How do you unit test a service that depends on CredHubCredentialOperations? Explain how permission actors and operations combine to enforce access control in CredHub? How does Spring CredHub's ReactiveCredHubTemplate differ internally from CredHubTemplate? Explain the execution flow of credential interpolation for VCAP_SERVICES? How can you design a credential rotation strategy using Spring CredHub's regenerate operation?
Show more question and Answers...


Comments & Discussions