How to dynamically choose at runtime which Authenticator to use?


I have an API for which I’d like to support both basic auth and bearer token flows. To this end, I’d like to choose dynamically at runtime which authenticator I should be using based on the Authorization header of the upcoming requests.

Is this possible? And if it is, then what would be the sketch implementation for such solution?

Note: I am completely new to the Scala world, Play framework, and Silhouette :slight_smile: We already have a Bearer token authentication flow in place.

Thanks for your help!


this is currently not possible. The framework agnostic version of Silhouette will have the possibility to support multiple authenticators per action. But this version needs some time to polish the API.

Best regards,