Migration Guide
This is a guide for migrating from Silhouette 2.0 to Silhouette 3.0
The new Silhouette 3.0 version depends on Play 2.4. So please visit the Play 2.4 Migration Guide for more information.
Environment
The Environment
has slightly changed. In Silhouette 2.0 there was the property providers
which has contained all available provider implementations. In Silhouette 3.0 this property was renamed to requestProviders
. Now this property can only be used to provide the list of request providers to Silhouette. All other providers should be directly injected into the appropriate controllers. For the social providers, there exists a registry with the name SocialProviderRegistry
, which can be used to inject a group of social providers into the controller instead of injecting every provider separately.
Authenticators
In Silhouette 2.0, for some authenticator methods(update, renew and discard), it was needed for the client code to explicitly wrap the Result
in a Future
. This isn't longer needed in Silhouette 3.0, because it suffices to pass the Result
directly.
CookieAuthenticator
The cookie authenticator can now store the complete authenticator instead of only the ID in the cookie. With this additional option the cookie authenticator can now be used in a stateless manner without a backing store.
Authorization
The Authorization.isAuthorized
method has completely changed. It gets now the current authenticator instance passed additionally to the current identity. So it's now possible to reject a request based on the authenticator. It gets also the full request passed so that it's possible to use data from the request body to check if a request to an action should be authorized or not. The return type has also changed to return a Future
to follow Silhouette's reactive approach.
Providers
The companion object to instantiate the providers was removed. Now you must instantiate the provider instance directly. All provider instances have now a withSettings
method that allows you to override the global provider settings with a local one.
FacebookProvider
In version 3.0 we have implemented the new Facebook 2.3 API version. In this version Facebook follows now the OAuth2 standard and returns Json for the access token. So all you have to do is to use the API version in your URL.
silhouette.facebook.authorizationURL="https://graph.facebook.com/v2.3/oauth/authorize"
silhouette.facebook.accessTokenURL="https://graph.facebook.com/v2.3/oauth/access_token"
Services
GravatarService
The Gravatar service can now be configured. For more information please visit the configuration section.
Settings
The duration based values have been changed to scala.concurrent.duration.FiniteDuration
to allow the usage of expressions like 5 minutes
instead of passing the value in seconds.
Updated about 2 months ago