Commit Graph

27 Commits (e81a569de57aaec0c53927c0fe12a7c90c1c05f4)

Author SHA1 Message Date
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
Chris Goller e0d8e683f2 Merge branch 'master' into feature/generic-oauth 2017-04-06 14:44:44 -05:00
Jared Scheib 9df1630cf8 Add new auth duration CLI option; add client heartbeat; fix logout (#1119)
* User can now set oauth cookie session duration via the CLI to any duration or to expire on browser close

* Refactor GET 'me' into heartbeat at constant interval

* Add ping route to all routes

* Add /chronograf/v1/ping endpoint for server status

* Refactor cookie generation to use an interface

* WIP adding refreshable tokens

* Add reminder to review index.js Login error handling

* Refactor Authenticator interface to accommodate cookie duration and logout delay

* Update make run-dev to be more TICKStack compliant

* Remove heartbeat/logout duration from authentication

* WIP Refactor tests to accommodate cookie and auth refactor

* Update oauth2 tests to newly refactored design

* Update oauth provider tests

* Remove unused oauth2/consts.go

* Move authentication middleware to server package

* Fix authentication comment

* Update authenication documentation to mention AUTH_DURATION

* Update /chronograf/v1/ping to simply return 204

* Fix Makefile run-dev target

* Remove spurious ping route

* Update auth docs to clarify authentication duration

* Revert "Refactor GET 'me' into heartbeat at constant interval"

This reverts commit 298a8c47e1.

Conflicts:
ui/src/index.js

* Add auth test for JWT signing method

* Add comments for why coverage isn't written for some areas of jwt code

* Update auth docs to explicitly mention how to require re-auth for all users on server restart

* Add Duration to Validation interface for Tokens

* Make auth duration of zero yield a everlasting token

* Revert "Revert "Refactor GET 'me' into heartbeat at constant interval""

This reverts commit b4773c15af.

* Rename http status constants and add FORBIDDEN

* Heartbeat only when logged in, notify user if heartbeat fails

* Update changelog

* Fix minor word semantics

* Update oauth2 tests to be in the oauth2_test package

* Add check at compile time that JWT implements Tokenizer

* Rename CookieMux to AuthMux for consistency with earlier refactor

* Fix logout middleware

* Fix logout button not showing due to obsolete data shape expectations

* Update changelog

* Fix proptypes for logout button data shape in SideNav
2017-04-06 11:40:57 -07:00
Chris Goller 2febc70cb2 Add implementation of generic oauth2 provider based on github concepts 2017-04-06 10:19:07 -05:00
Chris Goller 8dc012aeac Update to fix go linter issues 2017-03-06 10:11:52 -06:00
Chris Goller 46b1a08aa5 Merge branch 'master' into feature/#54-tr-enterprise-client
Conflicts:
	Makefile
	chronograf.go
	server/routes.go
	server/users.go
2017-02-23 23:26:09 -06:00
Tim Raymond 3af13aa490 Add organization restriction on Heroku provider
This allows operators to permit access to Chronograf only to users belonging
to a set of specific Heroku organizations. This is controlled using the
HEROKU_ORGS env or the --heroku-organizations switch.
2017-02-21 13:09:42 -05:00
Tim Raymond c3ada06c93 Update/Cleanup OAuth2 documentation
Information on setting up Heroku and Google authentication has been
added. Also, the information about the design has been updated and moved
to the oauth2 package docs along with updated diagrams to match with
developer expectations about where design-related documentation should
be found.
2017-02-21 11:04:01 -05:00
Tim Raymond 6e366e082e Improve documentation for oauth2 package
Adds a diagram showing how all the pieces fit together and a short
description.
2017-02-17 17:08:11 -05:00
Tim Raymond d17507a8cd Rename JWTMux to CookieMux
JWTMux was a disingenuous name because while JWTs are a very good choice
for a cookie encoding, they were not strictly required for use with this
mux. To better indicate the responsibilities of this mux, it's been
renamed "CookieMux," since its responsibilities end with persisting the
oauth2.Authenticator's encoded state in the browser. It is up to the
oauth2.Authenticator to choose the encoding.
2017-02-17 12:57:08 -05:00
Tim Raymond a527b90636 Add test for oauth2.Callback() handler
This test ensures that the Callback handler sets a cookie in its
response to the browser when the provider returns a 200
2017-02-17 12:41:14 -05:00
Tim Raymond e5457e7e5b Add test for (*JWTMux).Login()
Ensures that state is send properly to Provider.
2017-02-16 17:29:34 -05:00
Tim Raymond 15e1700fda Reorganize OAuth2 Test Helpers
Moved all test helper structs and funcs under oauth2/oauth2_test.go
2017-02-16 17:27:55 -05:00
Tim Raymond bdd59a4a64 Add tests around oauth2.JWTMux
Adds a test for Logout() handler.
2017-02-16 16:42:43 -05:00
Chris Goller 29e71d5bd6 Add google OAuth2 principal domain/email test 2017-02-16 13:36:37 -06:00
Chris Goller 2e24e1f3ae Add Github OAuth2 principal email/org tests 2017-02-16 13:26:08 -06:00
Tim Raymond d6b89e500e Configure Heroku OAuth2 properly
This was erroneously left unconfigured during dev.
2017-02-16 12:56:01 -05:00
Tim Raymond 510d5b1a4b Add Heroku Oauth2 Provider
This adds an Oauth2 Provider for authenticating users against Heroku's
API. In contrast to other Providers, a maintained client library for
interacting with the Heroku API was not available, so direct HTTP calls
are made instead. This follows with their documentation posted here:
https://devcenter.heroku.com/articles/oauth2-heroku-go
2017-02-16 12:05:55 -05:00
Chris Goller 2017944b68 Add unified OAuth2 logout route redirecting to provider logout
Signed-off-by: Tim Raymond <tim@timraymond.com>
2017-02-15 16:29:13 -06:00
Chris Goller b48851ee2b Fix go test failures from code moving 2017-02-14 23:38:43 -06:00
Chris Goller 7b4a649130 Add --public-url CLI option to support google oauth redirect uri 2017-02-14 23:34:15 -06:00
Chris Goller b9b37f3b90 Add google oauth provider. Need redirect_uri 2017-02-14 23:11:11 -06:00
Chris Goller 3eb39d85a8 Remove unneeded authenticator from github 2017-02-14 23:09:34 -06:00
Tim Raymond e1db393864 Doc++ 2017-02-14 17:28:38 -05:00
Tim Raymond f01e3b18fe Add Name to oauth2.Provider
Providers should be able to tell us their name. This will help construct
routes.
2017-02-14 17:28:05 -05:00
Tim Raymond d07c7ca1d6 Reorganize OAuth2 Logic
Created an oauth2 package which encapsulates all oauth2 providers,
utility functions, types, and interfaces. Previously some methods of the
Github provider were used as http.HandlerFuncs. These have now been
pulled into a concrete type called a JWTMux to implement other Oauth2
providers.

JWTMux has all of the functionality required to take a token from any
provider and store it as a JWT in a browser, and that is the extent of
its responsibilities. It implements the oauth2.Mux interface which would
potentially allow other strategies of oauth2 credential storage.
2017-02-14 16:18:41 -05:00