From the version AEM 6.0, accessing the ResourceResolver is deprecated using session = repository.loginAdministrative(null).
Don’t worry.
For this, AEM comes with the concept of Service based authentication to get the access to ResourceResolver using ResourceResolverFactory.getServiceResourceResolver() method.
When switching over to ResourceResolverFactory.getServiceResourceResolver(), remember to close your resource resolver as soon as you’re finished with it.
Thanks