All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.gu.googleauth.internal.DirectoryService.scala Maven / Gradle / Ivy

There is a newer version: 17.1.0
Show newest version
package com.gu.googleauth.internal

import com.google.api.client.googleapis.javanet.GoogleNetHttpTransport
import com.google.api.client.json.gson.GsonFactory
import com.google.api.services.directory.Directory
import com.google.auth.http.HttpCredentialsAdapter
import com.google.auth.oauth2.GoogleCredentials

object DirectoryService {
  def apply(googleCredentials: GoogleCredentials, scope: String): Directory = {
    val credentials = googleCredentials.createScoped(scope)
    val transport = GoogleNetHttpTransport.newTrustedTransport()
    val jsonFactory = GsonFactory.getDefaultInstance
    new Directory.Builder(transport, jsonFactory, new HttpCredentialsAdapter(credentials))
      .setApplicationName("play-googleauth").build()
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy