Commit Graph

44 Commits

Author SHA1 Message Date
Doug Lauder
6a27ed4a1d MM-22785 audit server CLI (#14144)
Add auditing to server CLI.

Also:
- simplify auditing in API layer
- reduce number of AddMeta calls
- have models serialize themselves
- more consistent field naming
2020-04-08 00:52:30 -04:00
Doug Lauder
4ac0619c90 MM-22273 New auditing system (phase 1) (#13967)
* New auditing API outputting to syslog via TLS

* New config section for specifying remote syslog server IP, port, and cert.

* Legacy audit API retained for access history feature
2020-03-12 15:50:21 -04:00
Eli Yukelzon
17523fa5d9 MM-21898 - Part 1: Generate and use an interface instead of *A… (#13840)
* Generate and use an interface instead of *App
2020-02-13 13:26:58 +01:00
Claudio Costa
7a6c0f607b [MM-21359] Add extra permission check when updating an OAuth app (#13445)
* Add permission check

* Add additional check in tests
2020-01-02 20:56:09 +01:00
Jesús Espino
a63684fcb5 Consistent license message for all the go files (#13235)
* Consistent license message for all the go files

* Fixing the last set of unconsistencies with the license headers

* Addressing PR review comments

* Fixing busy.go and busy_test.go license header
2019-11-29 12:59:40 +01:00
Miguel de la Cruz
2259b7f2a8 [MM-19948] Set version on module file and internal paths (#13186)
* [MM-19948] Set version on module file and internal paths

* Fixes after merge

* Fix i18n checker error
2019-11-28 14:39:38 +01:00
Marc Argent
50011d5589 GH-11192 Move non-API OAuth endpoints from api4 to web package (#11327)
* GH-11192 WIP

* GH-11192 WIP

* GH-11192 tidy up

* GH-11192 rename handlers

* GH-11192 add TestAuthorizeOAuthApp

* GH-11192 WIP

* GH-11192 Tests mostly passing

* GH-11192 add missing closeBody function back

* GH-11192 add test api endpoint

* GH-11192 rename endpoint to oauth_test
2019-08-15 08:45:31 -04:00
Harrison Healey
803ce61ef8 MM-15889 Add unit tests for CSRF checks (#11058)
* MM-15889 Add unit tests for CSRF checks

* Moved CSRF token test to login tests

* Remove empty test

* Remove debug messages
2019-06-11 15:09:00 -04:00
Adrian
bf233dec77 Fix redirecting after oauth login (#10952)
fixes #10943
2019-06-05 08:53:38 -04:00
Jesús Espino
17e6297a15 Adding Content-Type header to the OAuth complete endpoint (#10961) 2019-05-30 13:38:21 -04:00
Joram Wilander
2ca222033c MM-10658 Change config fields to pointers (#9033)
* MM 10658 Change config fields to pointers (#8898)

* Change fields of config structs to pointers and set defaults

MM-10658 https://github.com/mattermost/mattermost-server/issues/8841

* Fix tests that go broken during switching config structs to pointers

MM-10658 https://github.com/mattermost/mattermost-server/issues/8841

* Apply changes of current master while switching config structs to pointers

MM-10658 https://github.com/mattermost/mattermost-server/issues/8841

* Fix new config pointer uses

* Fix app tests

* Fix mail test

* remove debugging statement

* fix TestUpdateConfig

* assign config consistently

* initialize AmazonS3Region in TestS3TestConnection

* initialize fields for TestEmailTest

* fix TestCheckMandatoryS3Fields
2019-01-31 08:12:01 -05:00
Christopher Speller
8429add371 Cleanup related to context refactor (#9988) 2018-12-17 08:51:46 -08:00
Christopher Speller
da265fbaf7 Moving app from singular to being created for every request (#9889)
* Moving app from singular to being created for every request.

* Automatic refactor

* Adding license header

* Feedback fixes
2018-11-28 10:56:21 -08:00
George Goldberg
fdbb6de3d5 MM-11520: Make entity ID checks consistent across api4. (#9395)
* MM-11520: Make entity ID checks consistent across api4.

* Update tests.
2018-09-14 08:21:05 -07:00
Harrison Healey
8afc529753 MM-10573 Add error page if user doesn't authorize Mattermost for OAuth (#9402) 2018-09-14 11:32:25 +01:00
Jesús Espino
d81a61398d Migrate all the api4 to handle errors in idiomatic way (#9143) 2018-08-01 16:55:18 +02:00
Joram Wilander
867416b0e6 Add OAuth2 login hint for SAML (#9194) 2018-07-31 07:29:19 -07:00
Joram Wilander
6ac82d5171 Implement OAuth2 implicit grant flow (#9178) 2018-07-27 17:35:43 -04:00
Jesse Hallam
dd35ad43ca MM-10370: serve subpath (#8968)
* factor out GetSubpathFromConfig

* mv web/subpath.go to utils/subpath.go

* serve up web, api and ws on /subpath if configured

* pass config to utils.RenderWeb(App)?Error

This allows the methods to extract the configured subpath and redirect
to the appropriate `/subpath/error` handler.

* ensure GetSubpathFromConfig returns trailing slashes deterministically

* fix error 404 handling

* redirect /subpath to /subpath/

This is necessary for the static handler to match, otherwise none of the
registered routes find anything. This also makes it no longer necessary
to add trailing slashes in the root router.
2018-06-21 11:31:51 -07:00
Balasankar C
d3ead7dc85 MM-10640 Set EnableUserCreation to true by default (#8815)
* Set EnableUserCreation to true by default

* Fix argument type to FormatBool

* Convert EnableUserCreation instances to pointer

* Convert to boolean in tests also

* Set value of pointer to be false

* Convert remaining EnableUserCreation instances to pointer
2018-05-18 09:57:30 -04:00
Christopher Speller
686c2fbab7 Structured logging (#8673)
* Implementing structured logging

* Changes to en.json to allow refactor to run.

* Fixing global logger

* Structured logger initalization.

* Add caller.

* Do some log redirection.

* Auto refactor

* Cleaning up l4g reference and removing dependancy.

* Removing junk.

* Copyright headers.

* Fixing tests

* Revert "Changes to en.json to allow refactor to run."

This reverts commit fd8249e99b.

* Fixing some auto refactor strangeness and typo.

* Making keys more human readable.
2018-04-27 12:49:45 -07:00
Jesse Hallam
9d701c7044 Fix various segfaults when running go test manually (#8448)
* failing to find i18n shouldn't segfault

The server was trying to handle the fact that it couldn't find the i18n
directory, by emitting a translated log message...

* fix utils.FindDir

The attempts to find the directory in the parent or grandparent directory
don't work if the current working directory was inside `enterprise`, with
`enterprise` itself being a symlink as per the usual developer setup.

Recurse to the root of the filesystem, cleaning the path along the way
to work around this limitation (and allow tests to be run from an
arbitrarily deep nesting level.)

Fix corresponding usages to employ filepath.Join.

* failing to find html templates shouldn't segfault

* fail fast if the test user cannot be created

* rework utils.FindDir to retain backwards compatibility
2018-03-21 18:27:14 +00:00
Chris
eff65aa05c ABC-132: sign error page parameters (#8197)
* sign error page parameters

* add comments
2018-02-07 12:05:46 -05:00
Saturnino Abril
4acc2238e9 redirect error uri when OAuth SSO is setup but account creation is disabled (#8086) 2018-01-11 19:18:16 -05:00
Chris
91bfc72a99 Reduce logging data races, fix MySQL test race condition (#7994)
* fix races

* revert unintentional change

* fix test as intended
2017-12-22 12:09:33 +00:00
Joram Wilander
239e8df3f4 Fix oauth app update (#7913) 2017-12-01 08:21:44 -05:00
Christopher Speller
4491b5ecdf Performance improvements for 40M posts (#7708)
* Optimizing get root posts SQL query

* Setting session invalidation to be reliable

* Adding app reciever to SessionHasPermissionToUser

* Adding app reciever to SessionHasPermissionToTeam

* Adding app reciever to SessionHasPermissionTo

* Clear session cache if permission was denied

* Fixing rebase issues

* Revert "Optimizing get root posts SQL query"

This reverts commit f364757e7015cfb4ec673d0a4fc3d57cd25d8dd7.

* Fixing build
2017-10-25 11:48:15 -07:00
Chris
8e19ba029f Reduce utils.Cfg references (#7650)
* app.UpdateConfig method

* test fix

* another test fix

* the config override option as-was is just error prone, remove it for now

* derp
2017-10-18 15:36:43 -07:00
Chris
dcf9e96a0b remove global refs from api/api4 (#7496) 2017-09-22 13:54:27 -04:00
Chris
2d322a4174 fix error message escaping (#7467) 2017-09-20 09:34:30 -04:00
n1aba
5a855e1ca1 Implement update OAuthApp endpoint for APIv4, add test (#7413) 2017-09-18 07:40:41 -04:00
Christopher Speller
29fca51821 Renaming repo 2017-09-06 23:11:59 -07:00
Christopher Speller
77709ccdda Merge release-4.2 2017-09-06 20:43:18 -07:00
Chris
1adfd0e9be app type transition (#7167) 2017-09-06 17:12:54 -05:00
JoramWilander
d38328976e Various patches 2017-09-06 16:24:34 -04:00
Harrison Healey
e30e4cfe3d PLT-7468 Moved more error pages to use predefined error types (#7378)
* PLT-7468 Moved more errors to use error types

* PLT-7468 Moved 404 error page to use error types

* Made helper function for rendering external links on error page
2017-09-05 17:40:35 -04:00
Joram Wilander
a12cf549cf Set charset for OAuth2 authorize page (#7304) 2017-08-28 10:04:52 -04:00
enahum
fa3dd6a84b If login is using mobile respond with JSON object (#7030) 2017-08-03 02:39:14 +08:00
Joram Wilander
f3acd34128 Redirect OAuth SSO errors to error page (#6898) 2017-07-11 02:52:59 +08:00
JoramWilander
15ad24d160 Minor fix 2017-07-06 17:28:38 -04:00
Harrison Healey
5c1049054e PLT-6471 Properly panic when translations can't be loaded (#6414)
* PLT-6471 Properly panic when translations can't be loaded

* Print usage messages when errors occur during CLI initialization

* Reverted behaviour of FindDir and added second return value to it

* Fixed merge conflict
2017-05-23 11:06:25 -04:00
enahum
5f9a28ed6f Ability to use OAuth login from mobile (#6432) 2017-05-17 17:33:44 -04:00
Joram Wilander
8d1a132eda Fix OAuth SSO first account creation, add mobile support, and fix refresh tokens (#6181) 2017-04-25 09:38:33 -07:00
Joram Wilander
be9624e2ad Implement v4 endpoints for OAuth (#6040)
* Implement POST /oauth/apps endpoint for APIv4

* Implement GET /oauth/apps endpoint for APIv4

* Implement GET /oauth/apps/{app_id} and /oauth/apps/{app_id}/info endpoints for APIv4

* Refactor API version independent oauth endpoints

* Implement DELETE /oauth/apps/{app_id} endpoint for APIv4

* Implement /oauth/apps/{app_id}/regen_secret endpoint for APIv4

* Implement GET /user/{user_id}/oauth/apps/authorized endpoint for APIv4

* Implement POST /oauth/deauthorize endpoint
2017-04-20 09:55:02 -04:00