Spring / Spring CredHub Interview questions
Explain how CredentialRequest and CredentialDetails work together in the write API?
CredentialRequest<T> and CredentialDetails<T> are the input and output halves of the same operation, sharing the type parameter T so the compiler ties the value type of what you send to the value type of what you get back.
A CredentialRequest<T> — built through a type-specific subclass like PasswordCredentialRequest — carries the CredentialName, the credential type, and the value itself (T), plus optional metadata like additional permissions to grant at creation time. Passing it to credentials().write() sends exactly that shape to CredHub's data endpoint.
What comes back is a CredentialDetails<T>: the same value type T, but now enriched with what only CredHub can supply — a generated id, the confirmed CredentialName, and the credential type. In other words, the request describes what you want stored; the details describe what's actually now stored, including the identifiers you didn't have before the call.
Every other credential type follows the identical pattern, which is why learning this once covers write() for passwords, certificates, JSON blobs, or any of the other supported types.
More Related questions...