Commit Graph

75 Commits (a5ef6a720b4f4784f3b3fc468f2338972998eb13)

Author SHA1 Message Date
Theo Diefenthal b462d4b8f5
-Less restrictive key equalness check in OAuth due to providers like Microsoft Azure who do not provide "alg" claim 2018-07-09 19:37:17 +02:00
Jared Scheib 3ad9ea1a33 partial revert(43c5afe7) to fix GitHub Enterprise via Generic Oauth
The above commit was over-applied in #3168 to Generic Oauth in
addition to GitHub Oauth based on an assumption. It should only
have been applied to GitHub-specific OAuth. This over-application
introduced a bug where GitHub Enterprise did not work anymore.
2018-05-07 11:27:04 -07:00
Jonathan A. Sternberg 43c5afe70e Fix the github oauth2 implementation with multiple emails
If an account had multiple emails, the current implementation would
always select the first one regardless of any other settings. This fixes
it so it only chooses the primary email address that is verified.

This also fixes the generic oauth2 to require verified and primary to be
true if they are present. If they are not present, they are not
required.
2018-04-11 13:27:15 -05:00
Jared Scheib 9913a615b0 Fix tests for 0a98d1c7b 2018-03-28 15:27:11 -07:00
Benjamin Schweizer 2aeb0f7c8a added USE_ID_TOKEN option, defaulting off 2018-03-28 15:51:10 +02:00
Benjamin Schweizer 68f8e95034 gofmt 2018-03-28 13:34:30 +02:00
Benjamin Schweizer 0a98d1c7b7 Merge branch 'master' of https://github.com/influxdata/chronograf 2018-03-28 13:30:05 +02:00
Brandon Farmer 5004b51dd4 Fix oauth callback test, broken by 2fe13e
Co-authored-by: Brandon Farmer <bthesorceror@gmail.com>
Co-authored-by: Jared Scheib <jared.scheib@gmail.com>
2018-03-08 14:59:50 -08:00
Jared Scheib 03e966a44a Log error if Heroku API req responds with non-200-range code 2018-03-02 17:16:03 -06:00
Jared Scheib 32632f5790 Fix Heroku OAuth by adding required HTTP req header to API GET 2018-03-02 17:07:03 -06:00
Michael Desa f4c3e66d52 Use Generic APIKey for Oauth2 group lookup 2018-02-22 12:54:20 -05:00
Benjamin Schweizer ea16b12e5b
Merge branch 'master' into master 2018-02-20 09:52:34 +01:00
Benjamin Schweizer 47dac13cae merged upstream, updated comments, added GroupFromClaims() 2018-02-20 09:47:42 +01:00
Benjamin Schweizer 39f7819877 fixed handling of empty id_tokens 2018-01-12 08:46:25 +01:00
Benjamin Schweizer 8dfc71a6c9 added test case for mux/oauth2 id_token processing 2018-01-12 08:45:18 +01:00
Michael Desa 2e694aee4c Use github group login for mapping 2018-01-10 16:38:55 -05:00
Michael Desa 8dc60c21ff Add group to oauth2.Principal 2018-01-10 15:56:13 -05:00
Benjamin Schweizer 6c9fef1afd added test cases for ValidClaims() 2017-12-13 16:00:21 +01:00
Benjamin Schweizer 5f6a67583c updated existing test cases to interface changes 2017-12-13 15:55:21 +01:00
Benjamin Schweizer fbb71b6721 fixed initialization, added expressive error message 2017-12-13 15:51:20 +01:00
Benjamin Schweizer 7d4b8317e1 go fmt + got vet 2017-12-13 09:13:11 +01:00
Benjamin Schweizer 691f1710a2 handle extra id_token in callback 2017-12-10 18:33:50 +01:00
Benjamin Schweizer 645923a168 add support for RS256 signatures using JWKS 2017-12-10 18:26:27 +01:00
Jared Scheib 93f11e1325 Merge remote-tracking branch 'origin/master' into multitenancy 2017-12-05 11:43:23 -08:00
Chris Goller c87bfe1678 Add GENERIC_API_KEY to override of oauth2 responses to support azure 2017-11-21 16:55:03 -06:00
Michael Desa 06fa9d0e2a Add comment of how to generate JWT tokens 2017-11-01 16:05:56 -04:00
Michael Desa 6fbfde5060 Add comments throughout codebase 2017-11-01 12:30:42 -04:00
Michael Desa dd7dac6a5f Remove setting default org on Principal 2017-11-01 09:21:35 -04:00
Michael Desa a9d5bf9c05 WIP cleanup 2017-10-31 20:58:40 -04:00
Michael Desa bf6c77ee5f Provide route to change current users organization
Add current Organization to JWT.
Use OrganizationUsersStore to retrieve Users that are not me.

Signed-off-by: Michael de Sa <mjdesa@gmail.com>
2017-10-26 18:06:52 -04:00
Tim Raymond 6be0cafd3a Merge master into feature/tr-auth0-organizations
Conflicts were the addition of CLI flags from a concurrent branch.
2017-07-07 16:18:01 -04:00
Tim Raymond a296bad62c Add test coverage for Auth0 organizations
This covers cases where users are or are not members of organizations as
well as whether or not they should have access to the application based
on their organization membership.
2017-06-28 16:29:52 -04:00
Tim Raymond 734414c479 Support Organizations in Auth0
It's useful for operators to classify users into separate groups which
we have termed "organizations". For other OAuth providers, the notion of
an organization typically fell along company lines. For example,
MegaCorp might have a "MegaCorp" GitHub organiztion, and all email
addresses would have the domain "megacorp.com".

Auth0 is slightly different in that MegaCorp would likely run their own
Auth0 provider for their internal services, so "organizations" in Auth0
are no longer synonymous with "large organizations" (or companies).
Instead, Auth0 organizations could be used to restrict access to
Chronograf instances based on team membership within an organization.

To make use of Auth0 organizations, operators should modify users'
app_metadata to include the key "organization". Its value should be the
organization which that user belongs to. This can be done automatically
through arbitrary rules using Auth0 Rules.
2017-06-28 16:29:52 -04:00
Jade McGough 0436dbd0e3 add email to auth0 required scopes 2017-06-27 16:29:51 -07:00
Tim Raymond 07a3dceb2f Add Auth0 to supported OAuth2 providers
Auth0 is an OpenID Connect compliant OAuth2 provider, so we're able to
re-use the generic OAuth2 provider to implement it. The routes required
by Auth0 have been hardcoded for user convenience.

Also, Auth0 requires users to register a subdomain of auth0.com when
signing up. This must be provided to chronograf through the
`--auth0-domain` parameter (or `AUTH0_DOMAIN` ENV). This is **distinct**
from the `PUBLIC_URL`. For example, for a Chronograf hosted at
`http://www.example.com`, and an Auth0 domain of
`http://oceanic-airlines.auth0.com`, a client-id of `notpennysboat` and a
client-secret of `4-8-15-16-23-42`, the command line options would look
like:

```
chronograf \
  --auth0-domain=http://oceanic-airlines.auth0.com \
  --auth0-client-id=notpennysboat \
  --auth0-secret=4-8-15-16-23-24
  --public-url=http://www.example.com
  -t `uuidgen`
```
2017-06-21 10:20:46 -04:00
Kent Wang b4627983b9 Add redirect url to generic oauth 2017-06-16 17:35:57 +08:00
Tim Raymond 5897e62928 Remove broken path.Join logic
It is entirely unclear why this doesn't work.
2017-05-08 14:40:50 -07:00
Tim Raymond & Jared Scheib 337c7b16a5 Fix OAuth when using Basepath
Updated the logout link in the UI to use a link provided by the
/chronograf/v1/ endpoint. We also replaced many instances of string
concatenation of URL paths with path.Join, which better handles cases
where prefixed and suffixed "/" characters may be present in provided
basepaths. We also refactored how Basepath was being prefixed when using
Auth. Documentation was also updated to warn users that basepaths should
be applied to the OAuth callback link when configuring OAuth with their
provider.
2017-05-08 14:40:50 -07:00
Chris Goller d31fe90c42 Fix JWTs for auth-durations less than 5 mins (#1318)
* WIP

* Fix JWTs for auth-durations less than 5 mins

For auth-duration = 0 the JWT now understands that there does not
need to be duration checks.

For auth-duration < 5 minutes > 0 the JWT lifespan will be 1/2
of auth-duration to allow one extension

There is likely a range of very short auth-duration times like, say,
less than 5 seconds that would never allow a person to login simply
because the time of issue and request is longer.

* Update changelog
2017-04-20 17:33:08 -07:00
Chris Goller 7b26eb3f00 Add tests for token extend 2017-04-17 14:49:05 -05:00
Chris Goller 8804d9d4fb Add comment about tokens in extending 2017-04-17 12:22:49 -05:00
Chris Goller 3c6f0db623 Update oauth2 Authenticator signatures to use extend 2017-04-17 11:49:45 -05:00
Chris Goller f5930fd4b5 Update JWT to use Extended rather than Extend 2017-04-17 10:57:33 -05:00
Chris Goller db9a15bbe4 Update oauth2 now time calculation to ensure UTC time 2017-04-17 10:39:01 -05:00
Chris Goller d2012e4c8e Add default now time func to return UTC 2017-04-17 10:38:46 -05:00
Chris Goller 017b01d384 Update tests for refreshing jwts 2017-04-14 02:35:30 -05:00
Chris Goller 7c048e8135 Add JWT refresh on validation.
JWTs will only life five minutes into the future.  Any time
the server receives an authenicated request, the JWT's expire at
will be extended into the future.
2017-04-14 02:12:52 -05:00
Chris Goller 84f1263357 Add configurable scopes to generic oauth2 support 2017-04-07 14:58:35 -05:00
Chris Goller e27a50e25c Add renaming of generic oauth2 provider 2017-04-06 16:45:13 -05:00
Chris Goller f39fd31d00 Add test for generic oauth2 provider 2017-04-06 15:06:22 -05:00