Kinetic Bridgehub Adapter Googledrive
This adapter is used to make bridge calls to the Google drive api endpoints.
Google Drive Bridge Information
Configuration Values
Name | Description |
---|---|
Service Account Email | an account that belongs to your application instead of to an individual end user |
Authorization Type | Select P12 File or Private Key |
Private Key | Instructions for getting private key in notes below |
P12 File Location | The path to the P12 File |
Impersonated User Email | The email of the user that the request will be impersonating |
Google Apps Expiration Script Url | ??? |
Example Configuration
Name | Value |
---|---|
Service Account Email | acme-integrator@service-account-test-55555.iam.gserviceaccount.com |
Authorization Type | Private Key |
Private Key | Private Key Example Below |
P12 File Location | /path/to/file |
Impersonated User Email | joe.foo@acme.com |
Supported Structures
Name | Description |
---|---|
Files | Search for a file |
Folders | Search for a folder |
Fields
Fields that will be returned with the record. If no fields are provided then no fields will be returned. For a list of valid fields visit Google Drive API
Qualification (Query)
ex: title contains 'joe'. Visit Google Drive API v2 for additional query options.
Google project setup
Setting up a Google API Project is required. To complete all of the Google project setup steps the user should have Google super admin privileges. The ability to access the Google developer console is required to create the project. Adding domain wide delegation to the service account requires super users privileges.
Create project
- Go to the Google API Console.
- Click Create project
- Enter a name
- Select an organization (if applicable)
- Click Create
Add Service Account to project
A Service account is required for the adapter configuration.
- Open the API Console Dashboard and ensure the newly created project is selected from the top navigation bar.
- Click on Credentials the left side to bring up the credentials page.
- Click + CREATE CREDENTIALS button near the top of the screen.
- Choose Service Account from the dropdown.
- Give the account a name.
- An email for the Service Account is generated. This will be a configuration value for the Plugin later.
- Add a description (optional)
- Click CREATE.
- Click DONE.
- Give the account a name.
- Once the DONE button is clicked you will be redirect to the Service Account table. Continue to Create access key.
Create access key
The adapter has two methods for adding access credentials; P12 file or Private key. The Private Key is generated from the P12 file
- From the Service Account table select the service account to add a key to.
- The Service Account table can be found on the credentials page.
- On the Grant users access to this service account screen
- Scroll down to the Keys key section.
- Click ADD KEY.
- Choose Create new key from the options.
- Choose P12 as the key type and click CREATE.
- This will download a P12 file to your local machine. Store the Private key password in a secure location.
- To configure the bridge adapter to use the P12 file, access to the file system that the Agent is running on is required.
- If you don't have access to the Agent's file system the the P12 file needs to be converted to a Private Key.
Extract Private Key from P12 file
Not all machines are capable of running these commands. Access to the openssl command (which includes OSX and most versions of Linux by default) is required.
- In the terminal run
openssl pkcs12 -info -in INFILE.p12 -nodes -nocerts
command.- Visit Private Key from the P12 file for more information.
- Copy the Private Key to config (Do not edit)
- The Private Key will be used in the configuration of the adapter.
- Below is an example of a successful extraction of the Private Key.
Enable API access for project
- Open the API Console Dashboard and ensure the newly created project is selected from the top navigation bar.
- Click + ENABLE APIS AND SERVICES button near the top of the screen.
- Search for GOOGLE DRIVE and select it from the list.
- Click on the ENABLE button.
Give Service Account Domain-Wide Delegation
Set Delegate domain-wide authority to your service account.
- Open the API Console Credentials
- Select the Service Account from the table to get to the Grant users access to this service account screen.
- Copy the Unique ID. This is used in step 8.
- Go to your domain's Admin Console.
- Open the Admin Console API Controls (hamburger) Main menu > Security > API controls.
- In the Domain wide delegation pane, select Manage Domain Wide Delegation.
- Click Add new.
- In the Client ID field, enter the client ID copied from step 3.
- In the OAuth Scopes field add
https://www.googleapis.com/auth/drive
.- More info is available from the google developer documentation for OAuth Scopes.
Notes
- The files that can be requested are limited to the files that the impersonated users has access to.
- The adapter is not currently setup to use JSON keys.
- All of the steps above are referencing Google API console. These steps could also be done in a similar way using the Google Cloud Platform consoles.
- It is important to keep the key's tags. Private Key Example: -----BEGIN PRIVATE KEY----- MIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkw8gSlAgEAAoIBAQCZ7VJdnuZR2w5P ... TP62zYhLwBIKTVg9+3VQQmc1Lw== -----END PRIVATE KEY-----
Google Drive (2020-10-27)
- Added Private Key support
- Updated dependency, kinetic-agent-adapter to 1.1.0
Google Drive (2020-12-15)
- Updated configurable properties. The P12 File Location and Private Key fields should be conditionally required based on the Authorization Type value.