-
Notifications
You must be signed in to change notification settings - Fork 1k
Description
Hey there, thanks for great library!
Currently, CredentialProvider.GetCredential returns a single password per username. In some use cases, a user may have multiple valid credentials (e.g., API tokens, rotating secrets) that should all be accepted during authentication.
Would you be open to replace GetCredential by a new GetCredentials method that returns a slice of valid credentials?
Another approach if we don't want to break existing implementations of the interface would be to add a new MultiCredentialProvider interface that embeds CredentialProvider and adds that new method.
Then in the authentication flow, we could check if the provider implements MultiCredentialProvider via type assertion:
if mcp, ok := provider.(MultiCredentialProvider); ok {
passwords, found, err := mcp.GetCredentials(username)
// ...
} else {
password, found, err := provider.GetCredential(username)
// ...
}Happy to submit a PR if any of the two approaches sounds reasonable.