This repository has been archived by the owner on Apr 7, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 100
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding support for Google Suite Directory Groups
Google Suite Directory Groups can be fetched for the user. A white list of group emails can be defined grant access. The list of groups can be passed to an NGINX variable which can be passed to the applications for fine grained access control. A service account with Google Suite Domain-Wide Delegation of Authority is required to access Google Directory API. Added the possibility to extract also user email and name from the Oauth profile data and pass them on as NGINX variables.
- Loading branch information
Showing
2 changed files
with
175 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -65,6 +65,32 @@ variables are: | |
returned from Google (portion left of '@' in email). | ||
- **$ngo_email_as_user** If set and `$ngo_user` is defined, username | ||
returned will be full email address. | ||
- **$ngo_email** Optional, boolean. If set to true, it will be populated with | ||
the OAuth email returned from Google. | ||
- **$ngo_name** Optional, boolean. If set to true, it will be populated with | ||
the OAuth name returned from Google. | ||
- **$ngo_groups** Optional, boolean. If set to true, it will be populated with | ||
the Google Directory Groups of which the user is a member, within the Google | ||
Suite domain defined in variable **$ngo_groups_domain**. | ||
Requires the definition of **$ngo_service_account_json_file**, | ||
**$ngo_organization_admin_email** and **$ngo_groups_domain**. | ||
- **$ngo_allowed_groups** Optional, space separated list of email addresses of | ||
Google Directory Groups. If set, will be used for access control, so that | ||
only members of the defined groups will be authorized. | ||
Requires the definition of **$ngo_service_account_json_file**, | ||
**$ngo_organization_admin_email** and **$ngo_groups_domain**. | ||
- **$ngo_service_account_json_file** Optional, path to JSON credentials file of the Google Service Account which has been granted domain-wide-delegation of the Google Suite Domain. | ||
Please follow the [official documentation](https://developers.google.com/admin-sdk/directory/v1/guides/delegation) to setup Google Suite Domain-Wide Delegation of Authority and define at least the following scopes: | ||
``` | ||
https://www.googleapis.com/auth/admin.directory.user.readonly | ||
https://www.googleapis.com/auth/admin.directory.group.readonly | ||
https://www.googleapis.com/auth/admin.directory.group.member.readonly | ||
``` | ||
- **$ngo_organization_admin_email** Optional, the email of a Google Suite | ||
administrator account. The Service Account will impersonate this user to | ||
access Google Directory API. | ||
- **ngo_groups_domain** Optional, the domain of the Google Suite account where | ||
groups are fetched from. | ||
|
||
## Available endpoints | ||
|
||
|
@@ -80,6 +106,8 @@ Endpoint that reports your OAuth token in a JSON object: | |
```json | ||
{ | ||
"email": "[email protected]", | ||
"name": "Foo Name", | ||
"groups": "[email protected] [email protected]", | ||
"token": "abc..xyz", | ||
"expires": 1445455680 | ||
} | ||
|
@@ -91,6 +119,8 @@ Endpoint that reports your OAuth token in text format: | |
|
||
``` | ||
email: [email protected] | ||
name: Foo Name | ||
groups: [email protected] [email protected] | ||
token: abc..xyz | ||
expires: 1445455680 | ||
``` | ||
|
@@ -100,7 +130,7 @@ expires: 1445455680 | |
Endpoint that reports your OAuth token as `curl` arguments for header auth: | ||
|
||
``` | ||
-H "OauthEmail: [email protected]" -H "OauthAccessToken: abc..xyz" -H "OauthExpires: 1445455680" | ||
-H "OauthEmail: [email protected]" -H "OauthName: Foo Name" -H "OauthGroups: [email protected] [email protected]" -H "OauthAccessToken: abc..xyz" -H "OauthExpires: 1445455680" | ||
``` | ||
|
||
You can add it to your `curl` command to make it work with OAuth. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters