Removed the use of play.api.Application and play.api.Cache singletons #178
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Since Play 2.4, the use of
play.api.Application
andplay.api.Cache
is deprecated and not recommended.play.api.Cache
singleton should be replaced withCacheApi
andplay.api.Application
withConfiguration/Environment
.To minimize the change, I think It's reasonable to add fields of
CacheApi/Environment
toAuthConfig
trait. But it is not always the case forCacheApi
.CacheApi
is used only whenCacheIdContainer
is used asIdContainer
. It is already discussed in #155. So I addedidContainer
field instead.As for
play.api.Environment
which is the substitute ofplay.api.Application
, I can say the same thing asCacheApi
. It is used for only whenCookieTokenAccessor
.However, should I added a tokenAccessor field to AuthConfig instead of Environment? It's a little difficult but I don't think it's necessary because
Environment
is also inAsyncAuth
and much more commonly used thanCacheApi
in Play app.