At present there isn't a way to add security to WireMock's admin API, other than by adding it via a reverse proxy server.
However, we've had a similar request to this a few times recently so I think we're going to prioritise working on it.
Here's what I have in mind, feedback appreciated on whether this will work for you:
- Add a hook in the WireMockConfiguration object for adding an Authenticator implementation which will take a Request and provide a yes/no answer as to whether it's authenticated or not.
- Include a default implementation of this for HTTP Basic authentication with a fixed username/password.
- Add a constructor variant for the WireMock class (the client) to support passing credentials to the admin API.
- Again, provide a default implementation for HTTP Basic.
Having hooks in both places would mean that you could e.g. integrate with your own OAuth2 server if you wanted to go beyond a fixed username/password.
What are your thoughts?