Skip to content

Commit

Permalink
Merge branch 'master' into classlink
Browse files Browse the repository at this point in the history
  • Loading branch information
hhashwooly committed Apr 3, 2024
2 parents 15a535b + 1a48a9a commit 0c89e86
Show file tree
Hide file tree
Showing 154 changed files with 3,786 additions and 441 deletions.
1 change: 1 addition & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
042f5311fcab71f9bd8ac33c1e25597799eb34d7
11 changes: 6 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,32 +5,33 @@ on:
pull_request:
branches:
- master
workflow_dispatch:

name: ci

jobs:
test:
strategy:
matrix:
go-version: [ 1.15.x, 1.16.x, 1.17.x, 1.18.x, 1.19.x ]
go-version: [ 1.18.x, 1.19.x, 1.20.x, 1.21.x, 1.22.x ]
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Install Go
uses: actions/setup-go@v2
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Restore cache
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Format
run: if [ "$(gofmt -s -l . | wc -l)" -gt 0 ]; then exit 1; fi
if: matrix.os != 'windows-latest' && matrix.go-version == '1.19.x'
if: matrix.os != 'windows-latest' && matrix.go-version == '1.22.x'
- name: Test
run: go test -race ./...
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Package goth provides a simple, clean, and idiomatic way to write authentication
packages for Go web applications.

Unlike other similar packages, Goth, lets you write OAuth, OAuth2, or any other
protocol providers, as long as they implement the `Provider` and `Session` interfaces.
protocol providers, as long as they implement the [Provider](https://github.com/markbates/goth/blob/master/provider.go#L13-L22) and [Session](https://github.com/markbates/goth/blob/master/session.go#L13-L21) interfaces.

This package was inspired by [https://github.com/intridea/omniauth](https://github.com/intridea/omniauth).

Expand Down Expand Up @@ -44,8 +44,8 @@ $ go get github.com/markbates/goth
* Intercom
* Kakao
* Lastfm
* Linkedin
* LINE
* Linkedin
* Mailru
* Meetup
* MicrosoftOnline
Expand All @@ -55,6 +55,7 @@ $ go get github.com/markbates/goth
* OneDrive
* OpenID Connect (auto discovery)
* Oura
* Patreon
* Paypal
* SalesForce
* Shopify
Expand All @@ -71,8 +72,8 @@ $ go get github.com/markbates/goth
* Typetalk
* Uber
* VK
* Wepay
* WeCom
* Wepay
* Xero
* Yahoo
* Yammer
Expand Down
135 changes: 69 additions & 66 deletions examples/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ import (
"github.com/markbates/goth/providers/okta"
"github.com/markbates/goth/providers/onedrive"
"github.com/markbates/goth/providers/openidConnect"
"github.com/markbates/goth/providers/patreon"
"github.com/markbates/goth/providers/paypal"
"github.com/markbates/goth/providers/salesforce"
"github.com/markbates/goth/providers/seatalk"
Expand Down Expand Up @@ -112,15 +113,15 @@ func main() {
eveonline.New(os.Getenv("EVEONLINE_KEY"), os.Getenv("EVEONLINE_SECRET"), "http://localhost:3000/auth/eveonline/callback"),
kakao.New(os.Getenv("KAKAO_KEY"), os.Getenv("KAKAO_SECRET"), "http://localhost:3000/auth/kakao/callback"),

//Pointed localhost.com to http://localhost:3000/auth/yahoo/callback through proxy as yahoo
// Pointed localhost.com to http://localhost:3000/auth/yahoo/callback through proxy as yahoo
// does not allow to put custom ports in redirection uri
yahoo.New(os.Getenv("YAHOO_KEY"), os.Getenv("YAHOO_SECRET"), "http://localhost.com"),
typetalk.New(os.Getenv("TYPETALK_KEY"), os.Getenv("TYPETALK_SECRET"), "http://localhost:3000/auth/typetalk/callback", "my"),
slack.New(os.Getenv("SLACK_KEY"), os.Getenv("SLACK_SECRET"), "http://localhost:3000/auth/slack/callback"),
stripe.New(os.Getenv("STRIPE_KEY"), os.Getenv("STRIPE_SECRET"), "http://localhost:3000/auth/stripe/callback"),
wepay.New(os.Getenv("WEPAY_KEY"), os.Getenv("WEPAY_SECRET"), "http://localhost:3000/auth/wepay/callback", "view_user"),
//By default paypal production auth urls will be used, please set PAYPAL_ENV=sandbox as environment variable for testing
//in sandbox environment
// By default paypal production auth urls will be used, please set PAYPAL_ENV=sandbox as environment variable for testing
// in sandbox environment
paypal.New(os.Getenv("PAYPAL_KEY"), os.Getenv("PAYPAL_SECRET"), "http://localhost:3000/auth/paypal/callback"),
steam.New(os.Getenv("STEAM_KEY"), "http://localhost:3000/auth/steam/callback"),
heroku.New(os.Getenv("HEROKU_KEY"), os.Getenv("HEROKU_SECRET"), "http://localhost:3000/auth/heroku/callback"),
Expand All @@ -132,7 +133,7 @@ func main() {
discord.New(os.Getenv("DISCORD_KEY"), os.Getenv("DISCORD_SECRET"), "http://localhost:3000/auth/discord/callback", discord.ScopeIdentify, discord.ScopeEmail),
meetup.New(os.Getenv("MEETUP_KEY"), os.Getenv("MEETUP_SECRET"), "http://localhost:3000/auth/meetup/callback"),

//Auth0 allocates domain per customer, a domain must be provided for auth0 to work
// Auth0 allocates domain per customer, a domain must be provided for auth0 to work
auth0.New(os.Getenv("AUTH0_KEY"), os.Getenv("AUTH0_SECRET"), "http://localhost:3000/auth/auth0/callback", os.Getenv("AUTH0_DOMAIN")),
xero.New(os.Getenv("XERO_KEY"), os.Getenv("XERO_SECRET"), "http://localhost:3000/auth/xero/callback"),
vk.New(os.Getenv("VK_KEY"), os.Getenv("VK_SECRET"), "http://localhost:3000/auth/vk/callback"),
Expand All @@ -147,77 +148,79 @@ func main() {
mastodon.New(os.Getenv("MASTODON_KEY"), os.Getenv("MASTODON_SECRET"), "http://localhost:3000/auth/mastodon/callback", "read:accounts"),
wecom.New(os.Getenv("WECOM_CORP_ID"), os.Getenv("WECOM_SECRET"), os.Getenv("WECOM_AGENT_ID"), "http://localhost:3000/auth/wecom/callback"),
zoom.New(os.Getenv("ZOOM_KEY"), os.Getenv("ZOOM_SECRET"), "http://localhost:3000/auth/zoom/callback", "read:user"),
patreon.New(os.Getenv("PATREON_KEY"), os.Getenv("PATREON_SECRET"), "http://localhost:3000/auth/patreon/callback"),
)

// OpenID Connect is based on OpenID Connect Auto Discovery URL (https://openid.net/specs/openid-connect-discovery-1_0-17.html)
// because the OpenID Connect provider initialize it self in the New(), it can return an error which should be handled or ignored
// because the OpenID Connect provider initialize itself in the New(), it can return an error which should be handled or ignored
// ignore the error for now
openidConnect, _ := openidConnect.New(os.Getenv("OPENID_CONNECT_KEY"), os.Getenv("OPENID_CONNECT_SECRET"), "http://localhost:3000/auth/openid-connect/callback", os.Getenv("OPENID_CONNECT_DISCOVERY_URL"))
if openidConnect != nil {
goth.UseProviders(openidConnect)
}

m := make(map[string]string)
m["amazon"] = "Amazon"
m["bitbucket"] = "Bitbucket"
m["box"] = "Box"
m["dailymotion"] = "Dailymotion"
m["deezer"] = "Deezer"
m["digitalocean"] = "Digital Ocean"
m["discord"] = "Discord"
m["dropbox"] = "Dropbox"
m["eveonline"] = "Eve Online"
m["facebook"] = "Facebook"
m["fitbit"] = "Fitbit"
m["gitea"] = "Gitea"
m["github"] = "Github"
m["gitlab"] = "Gitlab"
m["google"] = "Google"
m["gplus"] = "Google Plus"
m["shopify"] = "Shopify"
m["soundcloud"] = "SoundCloud"
m["spotify"] = "Spotify"
m["steam"] = "Steam"
m["stripe"] = "Stripe"
m["tiktok"] = "TikTok"
m["twitch"] = "Twitch"
m["uber"] = "Uber"
m["wepay"] = "Wepay"
m["yahoo"] = "Yahoo"
m["yammer"] = "Yammer"
m["heroku"] = "Heroku"
m["instagram"] = "Instagram"
m["intercom"] = "Intercom"
m["kakao"] = "Kakao"
m["lastfm"] = "Last FM"
m["linkedin"] = "Linkedin"
m["line"] = "LINE"
m["onedrive"] = "Onedrive"
m["azuread"] = "Azure AD"
m["microsoftonline"] = "Microsoft Online"
m["battlenet"] = "Battlenet"
m["paypal"] = "Paypal"
m["twitter"] = "Twitter"
m["twitterv2"] = "Twitter"
m["salesforce"] = "Salesforce"
m["typetalk"] = "Typetalk"
m["slack"] = "Slack"
m["meetup"] = "Meetup.com"
m["auth0"] = "Auth0"
m["openid-connect"] = "OpenID Connect"
m["xero"] = "Xero"
m["vk"] = "VK"
m["naver"] = "Naver"
m["yandex"] = "Yandex"
m["nextcloud"] = "NextCloud"
m["seatalk"] = "SeaTalk"
m["apple"] = "Apple"
m["strava"] = "Strava"
m["okta"] = "Okta"
m["mastodon"] = "Mastodon"
m["wecom"] = "WeCom"
m["zoom"] = "Zoom"

m := map[string]string{
"amazon": "Amazon",
"apple": "Apple",
"auth0": "Auth0",
"azuread": "Azure AD",
"battlenet": "Battle.net",
"bitbucket": "Bitbucket",
"box": "Box",
"dailymotion": "Dailymotion",
"deezer": "Deezer",
"digitalocean": "Digital Ocean",
"discord": "Discord",
"dropbox": "Dropbox",
"eveonline": "Eve Online",
"facebook": "Facebook",
"fitbit": "Fitbit",
"gitea": "Gitea",
"github": "Github",
"gitlab": "Gitlab",
"google": "Google",
"gplus": "Google Plus",
"heroku": "Heroku",
"instagram": "Instagram",
"intercom": "Intercom",
"kakao": "Kakao",
"lastfm": "Last FM",
"line": "LINE",
"linkedin": "LinkedIn",
"mastodon": "Mastodon",
"meetup": "Meetup.com",
"microsoftonline": "Microsoft Online",
"naver": "Naver",
"nextcloud": "NextCloud",
"okta": "Okta",
"onedrive": "Onedrive",
"openid-connect": "OpenID Connect",
"patreon": "Patreon",
"paypal": "Paypal",
"salesforce": "Salesforce",
"seatalk": "SeaTalk",
"shopify": "Shopify",
"slack": "Slack",
"soundcloud": "SoundCloud",
"spotify": "Spotify",
"steam": "Steam",
"strava": "Strava",
"stripe": "Stripe",
"tiktok": "TikTok",
"twitch": "Twitch",
"twitter": "Twitter",
"twitterv2": "Twitter",
"typetalk": "Typetalk",
"uber": "Uber",
"vk": "VK",
"wecom": "WeCom",
"wepay": "Wepay",
"xero": "Xero",
"yahoo": "Yahoo",
"yammer": "Yammer",
"yandex": "Yandex",
"zoom": "Zoom",
}
var keys []string
for k := range m {
keys = append(keys, k)
Expand Down
35 changes: 29 additions & 6 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,18 +1,41 @@
module github.com/markbates/goth

go 1.15
go 1.18

require (
cloud.google.com/go v0.67.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/golang-jwt/jwt/v4 v4.2.0
github.com/gorilla/mux v1.6.2
github.com/gorilla/pat v0.0.0-20180118222023-199c85a7f6d1
github.com/gorilla/sessions v1.1.1
github.com/jarcoal/httpmock v0.0.0-20180424175123-9c70cfe4a1da
github.com/lestrrat-go/jwx v1.2.21
github.com/lestrrat-go/jwx v1.2.28
github.com/markbates/going v1.0.0
github.com/mrjones/oauth v0.0.0-20180629183705-f4e24b6d100c
github.com/stretchr/testify v1.7.1
golang.org/x/oauth2 v0.0.0-20200902213428-5d25da1a8d43
github.com/stretchr/testify v1.8.4
golang.org/x/oauth2 v0.17.0
)

require (
cloud.google.com/go/compute v1.20.1 // indirect
cloud.google.com/go/compute/metadata v0.2.3 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 // indirect
github.com/goccy/go-json v0.10.2 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/gorilla/context v1.1.1 // indirect
github.com/gorilla/securecookie v1.1.1 // indirect
github.com/kr/pretty v0.3.1 // indirect
github.com/lestrrat-go/backoff/v2 v2.0.8 // indirect
github.com/lestrrat-go/blackmagic v1.0.2 // indirect
github.com/lestrrat-go/httpcc v1.0.1 // indirect
github.com/lestrrat-go/iter v1.0.2 // indirect
github.com/lestrrat-go/option v1.0.1 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/rogpeppe/go-internal v1.12.0 // indirect
golang.org/x/crypto v0.19.0 // indirect
google.golang.org/appengine v1.6.8 // indirect
google.golang.org/protobuf v1.32.0 // indirect
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)

0 comments on commit 0c89e86

Please sign in to comment.