Skip to content

Instantly share code, notes, and snippets.

@mlescaille
Created September 14, 2020 23:05
Show Gist options
  • Save mlescaille/92ddb6a1b5594d7649893333c17c1032 to your computer and use it in GitHub Desktop.
Save mlescaille/92ddb6a1b5594d7649893333c17c1032 to your computer and use it in GitHub Desktop.
package com.tutorial.googleeoauth
import com.google.api.client.util.store.DataStore
import com.google.api.client.util.store.DataStoreFactory
import com.tutorial.googleeoauth.repository.GoogleCredentialDetailsRepository
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.stereotype.Component
/**
* Data store factory class required for implementing a custom data store to store credential
* details in Google OAuth Authentication process.
* @see {@link DbDataStore}
*/
@Component
class DbDataStoreFactory implements DataStoreFactory {
GoogleCredentialDetailsRepository repository
public DbDataStoreFactory(@Autowired GoogleCredentialDetailsRepository repository) {
this.repository = repository
}
@Override
def <V extends Serializable> DataStore<V> getDataStore(String id) throws IOException {
return new DbDataStore(this, id, repository)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment