summaryrefslogtreecommitdiffstats
path: root/models/oauth2.go
Commit message (Collapse)AuthorAgeFilesLines
* Move login related structs and functions to models/login (#17093)Lunny Xiao2021-09-241-27/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Move login related structs and functions to models/login * Fix test * Fix lint * Fix lint * Fix lint of windows * Fix lint * Fix test * Fix test * Only load necessary fixtures when preparing unit tests envs * Fix lint * Fix test * Fix test * Fix error log * Fix error log * Fix error log * remove unnecessary change * fix error log * merge main branch
* DBContext is just a Context (#17100)zeripath2021-09-231-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | * DBContext is just a Context This PR removes some of the specialness from the DBContext and makes it context This allows us to simplify the GetEngine code to wrap around any context in future and means that we can change our loadRepo(e Engine) functions to simply take contexts. Signed-off-by: Andrew Thornton <art27@cantab.net> * fix unit tests Signed-off-by: Andrew Thornton <art27@cantab.net> * another place that needs to set the initial context Signed-off-by: Andrew Thornton <art27@cantab.net> * avoid race Signed-off-by: Andrew Thornton <art27@cantab.net> * change attachment error Signed-off-by: Andrew Thornton <art27@cantab.net>
* Move db related basic functions to models/db (#17075)Lunny Xiao2021-09-191-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | * Move db related basic functions to models/db * Fix lint * Fix lint * Fix test * Fix lint * Fix lint * revert unnecessary change * Fix test * Fix wrong replace string * Use *Context * Correct committer spelling and fix wrong replaced words Co-authored-by: zeripath <art27@cantab.net>
* Refactor: Move login out of models (#16199)zeripath2021-07-241-152/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `models` does far too much. In particular it handles all `UserSignin`. It shouldn't be responsible for calling LDAP, SMTP or PAM for signing in. Therefore we should move this code out of `models`. This code has to depend on `models` - therefore it belongs in `services`. There is a package in `services` called `auth` and clearly this functionality belongs in there. Plan: - [x] Change `auth.Auth` to `auth.Method` - as they represent methods of authentication. - [x] Move `models.UserSignIn` into `auth` - [x] Move `models.ExternalUserLogin` - [x] Move most of the `LoginVia*` methods to `auth` or subpackages - [x] Move Resynchronize functionality to `auth` - Involved some restructuring of `models/ssh_key.go` to reduce the size of this massive file and simplify its files. - [x] Move the rest of the LDAP functionality in to the ldap subpackage - [x] Re-factor the login sources to express an interfaces `auth.Source`? - I've done this through some smaller interfaces Authenticator and Synchronizable - which would allow us to extend things in future - [x] Now LDAP is out of models - need to think about modules/auth/ldap and I think all of that functionality might just be moveable - [x] Similarly a lot Oauth2 functionality need not be in models too and should be moved to services/auth/source/oauth2 - [x] modules/auth/oauth2/oauth2.go uses xorm... This is naughty - probably need to move this into models. - [x] models/oauth2.go - mostly should be in modules/auth/oauth2 or services/auth/source/oauth2 - [x] More simplifications of login_source.go may need to be done - Allow wiring in of notify registration - *this can now easily be done - but I think we should do it in another PR* - see #16178 - More refactors...? - OpenID should probably become an auth Method but I think that can be left for another PR - Methods should also probably be cleaned up - again another PR I think. - SSPI still needs more refactors.* Rename auth.Auth auth.Method * Restructure ssh_key.go - move functions from models/user.go that relate to ssh_key to ssh_key - split ssh_key.go to try create clearer function domains for allow for future refactors here. Signed-off-by: Andrew Thornton <art27@cantab.net>
* Add asymmetric JWT signing (#16010)KN4CK3R2021-06-171-0/+3
| | | | | | | | | | | * Added asymmetric token signing. * Load signing key from settings. * Added optional kid parameter. * Updated documentation. * Add "kid" to token header.
* add `/assets` as root dir of public files (#15219)a10121127962021-04-281-13/+13
| | | | | | | | | | | | | | | | | | | | | | | | | * add `/assets` as root dir of public files Signed-off-by: a1012112796 <1012112796@qq.com> * move serviceworker.js * make fmt * fix some link * fix test * Apply suggestions from code review Co-authored-by: silverwind <me@silverwind.io> * Apply suggestions from code review Co-authored-by: silverwind <me@silverwind.io> Co-authored-by: silverwind <me@silverwind.io> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: zeripath <art27@cantab.net>
* chore(models): rewrite code format. (#14754)Bo-Yi Wu2021-03-141-5/+10
| | | | | | | | | | | | | | | * chore: rewrite format. * chore: update format Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com> * chore: update format Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com> * chore: Adjacent parameters with the same type should be grouped together * chore: update format.
* Disable broken OAuth2 providers at startup (#14802)zeripath2021-02-251-1/+7
| | | | | | | | | | Instead of causing a log.Fatal, we should handle broken OAuth2 providers by disabling them. Fix #8930 Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
* Custom icons for OAuth sources (#14161)Timo Ley2020-12-281-1/+5
| | | | | | | | | | | | | * Add Icon URL to Backend * Template for Icon URL * Localization & Edit Icon URL * Improve Custom Icon URL * Removed not working else Co-authored-by: 6543 <6543@obermui.de>
* Fix creating OAuth2 auth source from CLI (#14116)Daniil Pankratov2020-12-241-1/+11
| | | | | | | | Fix creation OAuth2 auth source from CLI. Fix #8356 Co-authored-by: Daniil Pankratov <daniil.pankratov@t-systems.com>
* #12897 - add mastodon provider (#13293)Divyam Bhasin2020-10-251-0/+6
| | | | | | | | | | | | | | | | | | | | | | | * added mastodon provider to oauth code * changed go.mod and vendor/modules.txt to add updated goth * vendored mastodon and new goth * committing result of go mod tidy && go mod vendor * added pic and mastodon to oauth models * handled instance url * applied lafriks suggestion * Update web_src/js/index.js Co-authored-by: techknowlogick <matti@mdranta.net> Co-authored-by: techknowlogick <techknowlogick@gitea.io> Co-authored-by: Lauris BH <lauris@nix.lv> Co-authored-by: techknowlogick <matti@mdranta.net>
* Changed image of openid-connect logo for better look on arc-green theme (#11312)Leo2020-05-101-1/+1
| | | | | | | | | | | | | | | | | | | | | * Set background of openIDConnect logo to white in arc-green theme * Fixed linting off arc-green theme Signed-off-by: Leo Maroni <git@em0lar.de> * Revert changes of first commit (white background) and replaced the image * Updated openid_connect (part 2) * Update public/img/auth/openid_connect.svg Now in one line Co-authored-by: silverwind <me@silverwind.io> Co-authored-by: silverwind <me@silverwind.io> Co-authored-by: zeripath <art27@cantab.net> Co-authored-by: Lauris BH <lauris@nix.lv>
* OAuth2: add Yandex provider (#8335) (#10564)Lauris BH2020-03-051-0/+1
| | | | | | | | | | | | | | | | | | | | | | * OAuth2: add Yandex provider (#8335) * remove changes from locale ru-RU * fmt modules/auth/oauth2/oauth2.go Co-Authored-By: 6543 <6543@obermui.de> * fix fmt * Update templates/admin/auth/new.tmpl * fix fmt Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: guillep2k <18600385+guillep2k@users.noreply.github.com> Co-authored-by: techknowlogick <matti@mdranta.net> Co-authored-by: Lauris BH <lauris@nix.lv>
* nextcloud oauth (#10562)techknowlogick2020-03-021-3/+11
| | | Fix #7078
* migrate gplus to google oauth2 provider (#7885)techknowlogick2019-09-141-1/+1
| | | | | | | | | | * migrate gplus to google oauth2 provider. this still provides support for old gplus connections. * Update models/oauth2.go Co-Authored-By: Antoine GIRARD <sapk@users.noreply.github.com> * make vendor
* oauth2 with remote Gitea - Fix #8093 (#8149)techknowlogick2019-09-121-0/+8
|
* Add golangci (#6418)kolaente2019-06-121-1/+4
|
* Discord Oauth2 support (#4476)techknowlogick2019-01-131-0/+1
| | | | | | | | | | | | | | * add discord auth * add vendor for discord * fix syntax error * make fmt * update version of goth in use * update markbates/goth
* Store OAuth2 session data in database (#3660)Lauris BH2018-04-291-2/+5
| | | | | | * Store OAuth2 session data in database * Rename table to `oauth2_session` and do not skip xormstorage initialization error
* Replace calls to xorm UseBool with Where (#2237)G2017-08-011-8/+3
|
* gofmt (#1662)Ethan Koenig2017-05-041-6/+6
|
* Additional OAuth2 providers (#1010)Willem van Dreumel2017-05-011-0/+122
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * add google+ * sort signin oauth2 providers based on the name so order is always the same * update auth tip for google+ * add gitlab provider * add bitbucket provider (and some go fmt) * add twitter provider * add facebook provider * add dropbox provider * add openid connect provider incl. new format of tips section in "Add New Source" * lower the amount of disk storage for each session to prevent issues while building cross platform (and disk overflow) * imports according to goimport and code style * make it possible to set custom urls to gitlab and github provider (only these could have a different host) * split up oauth2 into multiple files * small typo in comment * fix indention * fix indentation * fix new line before external import * fix layout of signin part * update "broken" dependency
* drop oauth2 feature supportUnknwon2015-09-171-106/+0
|
* WIP: create PR - choose branchUnknwon2015-08-081-1/+1
|
* Fix spelling errors in comments.Joseph Crail2014-12-061-1/+1
|
* Page: Manage social accountsUnknwon2014-08-091-9/+27
|
* Fix #165Unknown2014-06-211-16/+16
|
* Batch of mirror fixesUnknown2014-05-061-0/+6
|
* User code clean and ui improveUnknown2014-05-051-0/+6
|
* Add weibo oauthUnknown2014-04-131-0/+6
|
* Clean oauth codeUnknown2014-04-131-12/+13
|
* add oauth2 qq supportskyblue2014-04-131-0/+1
|
* add google oauth2 supportskyblue2014-04-121-2/+2
|
* clean oauth2 codeskyblue2014-04-121-5/+1
|
* finish github oauth2 supportskyblue2014-04-121-4/+27
|
* fixzhsso2014-04-101-0/+49
|
* mistakeszhsso2014-04-101-49/+0
|
* Merge branch 'dev' of github.com:gogits/gogs into devUnknown2014-04-091-1/+2
|\ | | | | | | | | Conflicts: models/oauth2.go
| * remove martini oauth2 dependskyblue2014-04-101-2/+2
| |
* | Mirror fixUnknown2014-04-091-10/+10
|/
* clean tailskyblue2014-04-091-6/+2
|
* add id for oauth2skyblue2014-04-091-6/+19
|
* first works oauth2(github). need to login with /user/login/githubskyblue2014-04-071-6/+27
|
* add oauth2 modelsskyblue2014-04-031-0/+18