I solved the problem, it was an improperly generated cookie. I found that
silhouette.env.authenticatorService.init(cookieAuthenticator) always returns a secure cookie, which means the cookie will be rejected unless
https is used. For testing on
localhost, setting
Domain=None was also required. This is my kludge for
LoginController:
silhouette.env.authenticatorService.init(cookieAuthenticator).flatMap { cookie =>
val cookieMightBeSecure = cookie.copy(secure=request.secure, domain=None)
silhouette.env.authenticatorService.embed(cookieMightBeSecure, result)
}
Seems like
authenticatorService.init should not always returns a secure cookie.
Next I need to figure out the best incantation for configuring
silhouette.authenticator.cookieDomain so I get proper values back when running on
localhost and in production. The
Silhouette docs say "This should be disabled for testing on localhost without SSL, otherwise cookie couldn't be set" but the docs do not the configuration value(s) that disable
cookieDomain. I'll try
false, the empty string, etc in the hope that I'll eventually stumble upon a way to disable
cookieDomain.
Mike