Skip to content

Commit

Permalink
Merge remote-tracking branch 'grafana/master' into circular-vector
Browse files Browse the repository at this point in the history
* grafana/master:
  OAuth: Support JMES path lookup when retrieving user email (grafana#14683)
  Emails: resurrect template notification (grafana#18686)
  Email: add reply-to and direct attachment (grafana#18715)
  • Loading branch information
ryantxu committed Aug 26, 2019
2 parents 09ac4d1 + 056dbc7 commit 66d5ae5
Show file tree
Hide file tree
Showing 16 changed files with 3,418 additions and 44 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ awsconfig
/public/views/index.html
/public/views/error.html
/emails/dist

# Enterprise emails
/emails/templates/enterprise_*
/public/emails/enterprise_*

/public_gen
/public/vendor/npm
/tmp
Expand Down
1 change: 1 addition & 0 deletions conf/defaults.ini
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,7 @@ client_id = some_id
client_secret = some_secret
scopes = user:email
email_attribute_name = email:primary
email_attribute_path =
auth_url =
token_url =
api_url =
Expand Down
2 changes: 2 additions & 0 deletions conf/sample.ini
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,8 @@
;client_id = some_id
;client_secret = some_secret
;scopes = user:email,read:org
;email_attribute_name = email:primary
;email_attribute_path =
;auth_url = https://foo.bar/login/oauth/authorize
;token_url = https://foo.bar/login/oauth/access_token
;api_url = https://foo.bar/user
Expand Down
8 changes: 5 additions & 3 deletions docs/sources/auth/generic-oauth.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,11 @@ Set `api_url` to the resource that returns [OpenID UserInfo](https://connect2id.
Grafana will attempt to determine the user's e-mail address by querying the OAuth provider as described below in the following order until an e-mail address is found:

1. Check for the presence of an e-mail address via the `email` field encoded in the OAuth `id_token` parameter.
2. Check for the presence of an e-mail address in the `attributes` map encoded in the OAuth `id_token` parameter. By default Grafana will perform a lookup into the attributes map using the `email:primary` key, however, this is configurable and can be adjusted by using the `email_attribute_name` configuration option.
3. Query the `/emails` endpoint of the OAuth provider's API (configured with `api_url`) and check for the presence of an e-mail address marked as a primary address.
4. If no e-mail address is found in steps (1-3), then the e-mail address of the user is set to the empty string.
2. Check for the presence of an e-mail address using the [JMES path](http://jmespath.org/examples.html) specified via the `email_attribute_path` configuration option. The JSON used for the path lookup is the HTTP response obtained from querying the UserInfo endpoint specified via the `api_url` configuration option.
**Note**: Only available in Grafana v6.4+.
3. Check for the presence of an e-mail address in the `attributes` map encoded in the OAuth `id_token` parameter. By default Grafana will perform a lookup into the attributes map using the `email:primary` key, however, this is configurable and can be adjusted by using the `email_attribute_name` configuration option.
4. Query the `/emails` endpoint of the OAuth provider's API (configured with `api_url`) and check for the presence of an e-mail address marked as a primary address.
5. If no e-mail address is found in steps (1-4), then the e-mail address of the user is set to the empty string.

## Set up OAuth2 with Okta

Expand Down
14 changes: 10 additions & 4 deletions emails/README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
## Prerequisites

- npm install
- gem install premailer
- grunt (default task will build new inlines email templates)
- grunt watch (will build on source html or css change)

assembled email templates will be in dist/ and final
inlined templates will be in ../public/emails/
## Tasks

- npm run build (default task will build new inlines email templates)
- npm start (will build on source html or css change)

## Result

Assembled email templates will be in `dist/` and final
inlined templates will be in `../public/emails/`

9 changes: 7 additions & 2 deletions emails/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,15 @@
"email": "delder@riester.com",
"url": "https://github.com/dnnsldr"
},
"scripts": {
"build": "grunt",
"start": "grunt watch"
},

"devDependencies": {
"grunt": "^0.4.5",
"grunt-premailer": "^0.2.10",
"grunt-processhtml": "^0.3.3",
"grunt-premailer": "^1.1.10",
"grunt-processhtml": "^0.4.2",
"grunt-uncss": "^0.3.7",
"load-grunt-config": "^0.14.0",
"grunt-contrib-watch": "^0.6.1",
Expand Down
Loading

0 comments on commit 66d5ae5

Please sign in to comment.