You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

143 lines
2.8 KiB

Oauth2 consumer (#679) * initial stuff for oauth2 login, fails on: * login button on the signIn page to start the OAuth2 flow and a callback for each provider Only GitHub is implemented for now * show login button only when the OAuth2 consumer is configured (and activated) * create macaron group for oauth2 urls * prevent net/http in modules (other then oauth2) * use a new data sessions oauth2 folder for storing the oauth2 session data * add missing 2FA when this is enabled on the user * add password option for OAuth2 user , for use with git over http and login to the GUI * add tip for registering a GitHub OAuth application * at startup of Gitea register all configured providers and also on adding/deleting of new providers * custom handling of errors in oauth2 request init + show better tip * add ExternalLoginUser model and migration script to add it to database * link a external account to an existing account (still need to handle wrong login and signup) and remove if user is removed * remove the linked external account from the user his settings * if user is unknown we allow him to register a new account or link it to some existing account * sign up with button on signin page (als change OAuth2Provider structure so we can store basic stuff about providers) * from gorilla/sessions docs: "Important Note: If you aren't using gorilla/mux, you need to wrap your handlers with context.ClearHandler as or else you will leak memory!" (we're using gorilla/sessions for storing oauth2 sessions) * use updated goth lib that now supports getting the OAuth2 user if the AccessToken is still valid instead of re-authenticating (prevent flooding the OAuth2 provider)
7 years ago
  1. # Goth: Multi-Provider Authentication for Go [![GoDoc](https://godoc.org/github.com/markbates/goth?status.svg)](https://godoc.org/github.com/markbates/goth) [![Build Status](https://travis-ci.org/markbates/goth.svg)](https://travis-ci.org/markbates/goth)
  2. Package goth provides a simple, clean, and idiomatic way to write authentication
  3. packages for Go web applications.
  4. Unlike other similar packages, Goth, lets you write OAuth, OAuth2, or any other
  5. protocol providers, as long as they implement the `Provider` and `Session` interfaces.
  6. This package was inspired by [https://github.com/intridea/omniauth](https://github.com/intridea/omniauth).
  7. ## Installation
  8. ```text
  9. $ go get github.com/markbates/goth
  10. ```
  11. ## Supported Providers
  12. * Amazon
  13. * Auth0
  14. * Bitbucket
  15. * Box
  16. * Cloud Foundry
  17. * Dailymotion
  18. * Deezer
  19. * Digital Ocean
  20. * Discord
  21. * Dropbox
  22. * Facebook
  23. * Fitbit
  24. * GitHub
  25. * Gitlab
  26. * Google+
  27. * Heroku
  28. * InfluxCloud
  29. * Instagram
  30. * Intercom
  31. * Lastfm
  32. * Linkedin
  33. * Meetup
  34. * OneDrive
  35. * OpenID Connect (auto discovery)
  36. * Paypal
  37. * SalesForce
  38. * Slack
  39. * Soundcloud
  40. * Spotify
  41. * Steam
  42. * Stripe
  43. * Twitch
  44. * Twitter
  45. * Uber
  46. * Wepay
  47. * Yahoo
  48. * Yammer
  49. ## Examples
  50. See the [examples](examples) folder for a working application that lets users authenticate
  51. through Twitter, Facebook, Google Plus etc.
  52. To run the example either clone the source from GitHub
  53. ```text
  54. $ git clone git@github.com:markbates/goth.git
  55. ```
  56. or use
  57. ```text
  58. $ go get github.com/markbates/goth
  59. ```
  60. ```text
  61. $ cd goth/examples
  62. $ go get -v
  63. $ go build
  64. $ ./examples
  65. ```
  66. Now open up your browser and go to [http://localhost:3000](http://localhost:3000) to see the example.
  67. To actually use the different providers, please make sure you configure them given the system environments as defined in the examples/main.go file
  68. ## Issues
  69. Issues always stand a significantly better chance of getting fixed if the are accompanied by a
  70. pull request.
  71. ## Contributing
  72. Would I love to see more providers? Certainly! Would you love to contribute one? Hopefully, yes!
  73. 1. Fork it
  74. 2. Create your feature branch (git checkout -b my-new-feature)
  75. 3. Write Tests!
  76. 4. Commit your changes (git commit -am 'Add some feature')
  77. 5. Push to the branch (git push origin my-new-feature)
  78. 6. Create new Pull Request
  79. ## Contributors
  80. * Mark Bates
  81. * Tyler Bunnell
  82. * Corey McGrillis
  83. * willemvd
  84. * Rakesh Goyal
  85. * Andy Grunwald
  86. * Glenn Walker
  87. * Kevin Fitzpatrick
  88. * Ben Tranter
  89. * Sharad Ganapathy
  90. * Andrew Chilton
  91. * sharadgana
  92. * Aurorae
  93. * Craig P Jolicoeur
  94. * Zac Bergquist
  95. * Geoff Franks
  96. * Raphael Geronimi
  97. * Noah Shibley
  98. * lumost
  99. * oov
  100. * Felix Lamouroux
  101. * Rafael Quintela
  102. * Tyler
  103. * DenSm
  104. * Samy KACIMI
  105. * dante gray
  106. * Noah
  107. * Jacob Walker
  108. * Marin Martinic
  109. * Roy
  110. * Omni Adams
  111. * Sasa Brankovic
  112. * dkhamsing
  113. * Dante Swift
  114. * Attila Domokos
  115. * Albin Gilles
  116. * Syed Zubairuddin
  117. * Johnny Boursiquot
  118. * Jerome Touffe-Blin
  119. * bryanl
  120. * Masanobu YOSHIOKA
  121. * Jonathan Hall
  122. * HaiMing.Yin
  123. * Sairam Kunala