diff --git a/go.mod b/go.mod index 7614f7604..605b1fe16 100644 --- a/go.mod +++ b/go.mod @@ -3,27 +3,25 @@ module github.com/markbates/goth go 1.18 require ( - 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/golang-jwt/jwt/v4 v4.5.0 + github.com/gorilla/mux v1.8.1 + github.com/gorilla/pat v1.0.2 + github.com/gorilla/sessions v1.2.2 + github.com/jarcoal/httpmock v1.3.1 github.com/lestrrat-go/jwx v1.2.29 - github.com/markbates/going v1.0.0 - github.com/mrjones/oauth v0.0.0-20180629183705-f4e24b6d100c + github.com/markbates/going v1.0.3 + github.com/mrjones/oauth v0.0.0-20190623134757-126b35219450 github.com/stretchr/testify v1.9.0 - golang.org/x/oauth2 v0.17.0 + golang.org/x/oauth2 v0.21.0 ) require ( - cloud.google.com/go/compute v1.20.1 // indirect - cloud.google.com/go/compute/metadata v0.2.3 // indirect + cloud.google.com/go/compute/metadata v0.3.0 // 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/decred/dcrd/dcrec/secp256k1/v4 v4.3.0 // indirect + github.com/goccy/go-json v0.10.3 // indirect + github.com/gorilla/context v1.1.2 // indirect + github.com/gorilla/securecookie v1.1.2 // 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 @@ -33,9 +31,7 @@ require ( 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.21.0 // indirect - google.golang.org/appengine v1.6.8 // indirect - google.golang.org/protobuf v1.32.0 // indirect + golang.org/x/crypto v0.24.0 // indirect gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index 9aedbc5db..9756d4c50 100644 --- a/go.sum +++ b/go.sum @@ -1,7 +1,5 @@ -cloud.google.com/go/compute v1.20.1 h1:6aKEtlUiwEpJzM001l0yFkpXmUVXaN8W+fbkb2AZNbg= -cloud.google.com/go/compute v1.20.1/go.mod h1:4tCnrn48xsqlwSAiLf1HXMQk8CONslYbdiEZc9FEIbM= -cloud.google.com/go/compute/metadata v0.2.3 h1:mg4jlk7mCAj6xXp9UJ4fjI9VUI5rubuGBW5aJ7UnBMY= -cloud.google.com/go/compute/metadata v0.2.3/go.mod h1:VAV5nSsACxMJvgaAuX6Pk2AawlZn8kiOGuCv6gTkwuA= +cloud.google.com/go/compute/metadata v0.3.0 h1:Tz+eQXMEqDIKRsmY3cHTL6FVaynIjX2QxYC4trgAKZc= +cloud.google.com/go/compute/metadata v0.3.0/go.mod h1:zFmK7XCadkQkj6TtorcaGlCW1hT1fIilQDwofLpJ20k= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= @@ -9,28 +7,44 @@ github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs github.com/decred/dcrd/crypto/blake256 v1.0.1/go.mod h1:2OfgNZ5wDpcsFmHmCK5gZTPcCXqlm2ArzUIkw9czNJo= github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 h1:8UrgZ3GkP4i/CLijOJx79Yu+etlyjdBU4sfcs2WYQMs= github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0/go.mod h1:v57UDF4pDQJcEfFUCRop3lJL149eHGSe9Jvczhzjo/0= +github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0 h1:rpfIENRNNilwHwZeG5+P150SMrnNEcHYvcCuK6dPZSg= +github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0/go.mod h1:v57UDF4pDQJcEfFUCRop3lJL149eHGSe9Jvczhzjo/0= +github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/goccy/go-json v0.10.2 h1:CrxCmQqYDkv1z7lO7Wbh2HN93uovUHgrECaO5ZrCXAU= github.com/goccy/go-json v0.10.2/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I= +github.com/goccy/go-json v0.10.3 h1:KZ5WoDbxAIgm2HNbYckL0se1fHD6rz5j4ywS6ebzDqA= +github.com/goccy/go-json v0.10.3/go.mod h1:oq7eo15ShAhp70Anwd5lgX2pLfOS3QCiwU/PULtXL6M= github.com/golang-jwt/jwt/v4 v4.2.0 h1:besgBTC8w8HjP6NzQdxwKH9Z5oQMZ24ThTrHp3cZ8eU= github.com/golang-jwt/jwt/v4 v4.2.0/go.mod h1:/xlHOz8bRuivTWchD4jCa+NbatV+wEUSzwAxVc6locg= -github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= -github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= -github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/golang-jwt/jwt/v4 v4.5.0 h1:7cYmW1XlMY7h7ii7UhUyChSgS5wUJEnm9uZVTGqOWzg= +github.com/golang-jwt/jwt/v4 v4.5.0/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= +github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/gorilla/context v1.1.1 h1:AWwleXJkX/nhcU9bZSnZoi3h/qGYqQAGhq6zZe/aQW8= github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg= +github.com/gorilla/context v1.1.2 h1:WRkNAv2uoa03QNIc1A6u4O7DAGMUVoopZhkiXWA2V1o= +github.com/gorilla/context v1.1.2/go.mod h1:KDPwT9i/MeWHiLl90fuTgrt4/wPcv75vFAZLaOOcbxM= github.com/gorilla/mux v1.6.2 h1:Pgr17XVTNXAk3q/r4CpKzC5xBM/qW1uVLV+IhRZpIIk= github.com/gorilla/mux v1.6.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= +github.com/gorilla/mux v1.8.1 h1:TuBL49tXwgrFYWhqrNgrUNEY92u81SPhu7sTdzQEiWY= +github.com/gorilla/mux v1.8.1/go.mod h1:AKf9I4AEqPTmMytcMc0KkNouC66V3BtZ4qD5fmWSiMQ= github.com/gorilla/pat v0.0.0-20180118222023-199c85a7f6d1 h1:LqbZZ9sNMWVjeXS4NN5oVvhMjDyLhmA1LG86oSo+IqY= github.com/gorilla/pat v0.0.0-20180118222023-199c85a7f6d1/go.mod h1:YeAe0gNeiNT5hoiZRI4yiOky6jVdNvfO2N6Kav/HmxY= +github.com/gorilla/pat v1.0.2 h1:TDh/RulbnPxMQACcwbgMF5Bf00jaGoeYBNu+XUFuwtE= +github.com/gorilla/pat v1.0.2/go.mod h1:ioQ7dFQ2KXmOmWLJs6vZAfRikcm2D2JyuLrL9b5wVCg= github.com/gorilla/securecookie v1.1.1 h1:miw7JPhV+b/lAHSXz4qd/nN9jRiAFV5FwjeKyCS8BvQ= github.com/gorilla/securecookie v1.1.1/go.mod h1:ra0sb63/xPlUeL+yeDciTfxMRAA+MP+HVt/4epWDjd4= +github.com/gorilla/securecookie v1.1.2 h1:YCIWL56dvtr73r6715mJs5ZvhtnY73hBvEF8kXD8ePA= +github.com/gorilla/securecookie v1.1.2/go.mod h1:NfCASbcHqRSY+3a8tlWJwsQap2VX5pwzwo4h3eOamfo= github.com/gorilla/sessions v1.1.1 h1:YMDmfaK68mUixINzY/XjscuJ47uXFWSSHzFbBQM0PrE= github.com/gorilla/sessions v1.1.1/go.mod h1:8KCfur6+4Mqcc6S0FEfKuN15Vl5MgXW92AE8ovaJD0w= +github.com/gorilla/sessions v1.2.2 h1:lqzMYz6bOfvn2WriPUjNByzeXIlVzURcPmgMczkmTjY= +github.com/gorilla/sessions v1.2.2/go.mod h1:ePLdVu+jbEgHH+KWw8I1z2wqd0BAdAQh/8LRvBeoNcQ= +github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/jarcoal/httpmock v0.0.0-20180424175123-9c70cfe4a1da h1:FjHUJJ7oBW4G/9j1KzlHaXL09LyMVM9rupS39lncbXk= github.com/jarcoal/httpmock v0.0.0-20180424175123-9c70cfe4a1da/go.mod h1:ks+b9deReOc7jgqp+e7LuFiCBH6Rm5hL32cLcEAArb4= +github.com/jarcoal/httpmock v1.3.1 h1:iUx3whfZWVf3jT01hQTO/Eo5sAYtB2/rqaUuOtpInww= +github.com/jarcoal/httpmock v1.3.1/go.mod h1:3yb8rc4BI7TCBhFY8ng0gjuLKJNquuDNiPaZjnENuYg= github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= @@ -53,8 +67,15 @@ github.com/lestrrat-go/option v1.0.1 h1:oAzP2fvZGQKWkvHa1/SAcFolBEca1oN+mQ7eooNB github.com/lestrrat-go/option v1.0.1/go.mod h1:5ZHFbivi4xwXxhxY9XHDe2FHo6/Z7WWmtT7T5nBBp3I= github.com/markbates/going v1.0.0 h1:DQw0ZP7NbNlFGcKbcE/IVSOAFzScxRtLpd0rLMzLhq0= github.com/markbates/going v1.0.0/go.mod h1:I6mnB4BPnEeqo85ynXIx1ZFLLbtiLHNXVgWeFO9OGOA= +github.com/markbates/going v1.0.3 h1:mY45T5TvW+Xz5A6jY7lf4+NLg9D8+iuStIHyR7M8qsE= +github.com/markbates/going v1.0.3/go.mod h1:fQiT6v6yQar9UD6bd/D4Z5Afbk9J6BBVBtLiyY4gp2o= github.com/mrjones/oauth v0.0.0-20180629183705-f4e24b6d100c h1:3wkDRdxK92dF+c1ke2dtj7ZzemFWBHB9plnJOtlwdFA= github.com/mrjones/oauth v0.0.0-20180629183705-f4e24b6d100c/go.mod h1:skjdDftzkFALcuGzYSklqYd8gvat6F1gZJ4YPVbkZpM= +github.com/mrjones/oauth v0.0.0-20190623134757-126b35219450 h1:j2kD3MT1z4PXCiUllUJF9mWUESr9TWKS7iEKsQ/IipM= +github.com/mrjones/oauth v0.0.0-20190623134757-126b35219450/go.mod h1:skjdDftzkFALcuGzYSklqYd8gvat6F1gZJ4YPVbkZpM= +github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= @@ -63,10 +84,12 @@ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZN github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8= github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4= +github.com/serenize/snaker v0.0.0-20171204205717-a683aaf2d516/go.mod h1:Yow6lPLSAXx2ifx470yD/nUe22Dv5vBvxK/UK9UUTVs= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= @@ -79,19 +102,24 @@ golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5y golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU= golang.org/x/crypto v0.21.0 h1:X31++rzVUdKhX5sWmSOFZxx8UW/ldWx55cbf08iNAMA= golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs= +golang.org/x/crypto v0.24.0 h1:mnl8DM0o513X8fdIkmyFE/5hTYxbwYOjDS/+rK6qpRI= +golang.org/x/crypto v0.24.0/go.mod h1:Z1PMYSOR5nyMcyAVAIQSKCDwalqy85Aqn1x3Ws4L5DM= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= -golang.org/x/oauth2 v0.17.0 h1:6m3ZPmLEFdVxKKWnKq4VqZ60gutO35zm+zrAHVmHyDQ= -golang.org/x/oauth2 v0.17.0/go.mod h1:OzPDGQiuQMguemayvdylqddI7qcD9lnSDb+1FiwQ5HA= +golang.org/x/oauth2 v0.21.0 h1:tsimM75w1tF/uws5rbeHzIWxEqElMehnc+iW793zsZs= +golang.org/x/oauth2 v0.21.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= +golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -110,7 +138,6 @@ golang.org/x/term v0.18.0/go.mod h1:ILwASektA3OnRv7amZ1xhE/KTR+u50pbXfZ03+6Nx58= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= @@ -119,16 +146,12 @@ golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtn golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/appengine v1.6.8 h1:IhEN5q69dyKagZPYMSdIjS2HqprW324FRQZJcGqPAsM= -google.golang.org/appengine v1.6.8/go.mod h1:1jJ3jBArFh5pcgW8gCtRJnepW8FzD1V44FJffLiz/Ds= -google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= -google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I= -google.golang.org/protobuf v1.32.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= +gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= +gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= +gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/gothic/gothic.go b/gothic/gothic.go index 86adf58e9..eddb3f69b 100644 --- a/gothic/gothic.go +++ b/gothic/gothic.go @@ -365,3 +365,10 @@ func updateSessionValue(session *sessions.Session, key, value string) error { session.Values[key] = b.String() return nil } + +func FetchUserInfoWithToken(token string) (goth.User, error) { + + result := goth.User{} + + return result, nil +} diff --git a/provider.go b/provider.go index 4635a4203..349b39718 100644 --- a/provider.go +++ b/provider.go @@ -19,6 +19,10 @@ type Provider interface { Debug(bool) RefreshToken(refreshToken string) (*oauth2.Token, error) // Get new access token based on the refresh token RefreshTokenAvailable() bool // Refresh token is provided by auth provider or not + // IsEmailProvided() bool + // IsPhoneProvided() bool + FetchUserWithToken(string) (User, error) + CreateSession(interface{}) (Session, error) } const NoAuthUrlErrorMessage = "an AuthURL has not been set" diff --git a/providers/amazon/amazon.go b/providers/amazon/amazon.go index 7061e4d7a..349e7723f 100644 --- a/providers/amazon/amazon.go +++ b/providers/amazon/amazon.go @@ -5,6 +5,7 @@ package amazon import ( "bytes" "encoding/json" + "errors" "fmt" "io" "io/ioutil" @@ -165,3 +166,7 @@ func (p *Provider) RefreshToken(refreshToken string) (*oauth2.Token, error) { } return newToken, err } + +func (p *Provider) FetchUserWithToken(token string) (goth.User, error) { + return goth.User{}, errors.New("not implemented") +} diff --git a/providers/amazon/session.go b/providers/amazon/session.go index 173f2a5b4..dbe4d0053 100644 --- a/providers/amazon/session.go +++ b/providers/amazon/session.go @@ -61,3 +61,7 @@ func (p *Provider) UnmarshalSession(data string) (goth.Session, error) { err := json.NewDecoder(strings.NewReader(data)).Decode(s) return s, err } + +func (p *Provider) CreateSession(sessionValue interface{}) (goth.Session, error) { + return &Session{}, errors.New("not implemented") +} diff --git a/providers/apple/apple.go b/providers/apple/apple.go index 9ab85b4cd..48c0f57d6 100644 --- a/providers/apple/apple.go +++ b/providers/apple/apple.go @@ -19,8 +19,9 @@ import ( ) const ( - authEndpoint = "https://appleid.apple.com/auth/authorize" - tokenEndpoint = "https://appleid.apple.com/auth/token" + authEndpoint = "https://appleid.apple.com/auth/authorize" + tokenEndpoint = "https://appleid.apple.com/auth/token" + revokeEndpoint = "https://appleid.apple.com/auth/revoke" ScopeEmail = "email" ScopeName = "name" @@ -51,7 +52,7 @@ func New(clientId, secret, redirectURL string, httpClient *http.Client, scopes . return p } -func (p Provider) Name() string { +func (p *Provider) Name() string { return p.providerName } @@ -59,7 +60,7 @@ func (p *Provider) SetName(name string) { p.providerName = name } -func (p Provider) ClientId() string { +func (p *Provider) ClientId() string { return p.clientId } @@ -89,15 +90,15 @@ func MakeSecret(sp SecretParams) (*string, error) { return &ss, err } -func (p Provider) Secret() string { +func (p *Provider) Secret() string { return p.secret } -func (p Provider) RedirectURL() string { +func (p *Provider) RedirectURL() string { return p.redirectURL } -func (p Provider) BeginAuth(state string) (goth.Session, error) { +func (p *Provider) BeginAuth(state string) (goth.Session, error) { opts := make([]oauth2.AuthCodeOption, 0, 1) if p.formPostResponseMode { opts = append(opts, oauth2.SetAuthURLParam("response_mode", "form_post")) @@ -128,11 +129,22 @@ func (Provider) UnmarshalSession(data string) (goth.Session, error) { // to the redirect page following authentication, if the name and email scopes are requested. // Additionally, if the response type is form_post and the email scope is requested, the email // will be encoded into the ID token in the email claim. -func (p Provider) FetchUser(session goth.Session) (goth.User, error) { +func (p *Provider) FetchUser(session goth.Session) (goth.User, error) { s := session.(*Session) if s.AccessToken == "" { return goth.User{}, fmt.Errorf("no access token obtained for session with provider %s", p.Name()) } + + raw_data := make(map[string]interface{}) + + raw_data["access_token"] = s.AccessToken + raw_data["refresh_token"] = s.RefreshToken + raw_data["expires_at"] = s.ExpiresAt + raw_data["is_private_email"] = s.ID.IsPrivateEmail + raw_data["email_verified"] = s.ID.EmailVerified + raw_data["sub"] = s.ID.Sub + raw_data["email"] = s.ID.Email + return goth.User{ Provider: p.Name(), UserID: s.ID.Sub, @@ -140,17 +152,18 @@ func (p Provider) FetchUser(session goth.Session) (goth.User, error) { AccessToken: s.AccessToken, RefreshToken: s.RefreshToken, ExpiresAt: s.ExpiresAt, + RawData: raw_data, }, nil } // Debug is a no-op for the apple package. func (Provider) Debug(bool) {} -func (p Provider) Client() *http.Client { +func (p *Provider) Client() *http.Client { return goth.HTTPClientWithFallBack(p.httpClient) } -func (p Provider) RefreshToken(refreshToken string) (*oauth2.Token, error) { +func (p *Provider) RefreshToken(refreshToken string) (*oauth2.Token, error) { token := &oauth2.Token{RefreshToken: refreshToken} ts := p.config.TokenSource(goth.ContextForClient(p.Client()), token) newToken, err := ts.Token() @@ -185,3 +198,50 @@ func (p *Provider) configure(scopes []string) { p.config = c } + +func (p *Provider) RevokeToken(token string) error { + target_url := "https://appleid.apple.com/auth/revoke" + method := "POST" + + type RevokePayload struct { + ClientId string `json:"client_id"` + ClientSecret string `json:"client_secret"` + Token string `json:"token"` + } + + payload := &RevokePayload{ + ClientId: p.clientId, + ClientSecret: p.secret, + Token: token, + } + + // Make a x-www-form-urlencoded POST request + body := url.Values{} + body.Set("client_id", payload.ClientId) + body.Set("client_secret", payload.ClientSecret) + body.Set("token", payload.Token) + + req, err := http.NewRequest(method, target_url, strings.NewReader(body.Encode())) + if err != nil { + return err + } + + req.Header.Set("Content-Type", "application/x-www-form-urlencoded") + + resp, err := p.Client().Do(req) + if err != nil { + return err + } + defer resp.Body.Close() + + if resp.StatusCode != http.StatusOK { + return fmt.Errorf("revoke token request failed with status code: %d", resp.StatusCode) + } + + return nil +} + +func (p *Provider) FetchUserWithToken(token string) (goth.User, error) { + //TODO: + return goth.User{}, errors.New("not implemented") +} diff --git a/providers/apple/session.go b/providers/apple/session.go index e80e1bab7..c2500cae2 100644 --- a/providers/apple/session.go +++ b/providers/apple/session.go @@ -169,3 +169,7 @@ func (bs *BoolString) Value() bool { } return bs.StringValue == "true" } + +func (p *Provider) CreateSession(sessionValue interface{}) (goth.Session, error) { + return &Session{}, errors.New("not implemented") +} diff --git a/providers/auth0/auth0.go b/providers/auth0/auth0.go index c07b9db47..34e23bf90 100644 --- a/providers/auth0/auth0.go +++ b/providers/auth0/auth0.go @@ -5,6 +5,7 @@ package auth0 import ( "bytes" "encoding/json" + "errors" "fmt" "io" "net/http" @@ -181,3 +182,7 @@ func (p *Provider) RefreshToken(refreshToken string) (*oauth2.Token, error) { } return newToken, err } + +func (p *Provider) FetchUserWithToken(token string) (goth.User, error) { + return goth.User{}, errors.New("not implemented") +} diff --git a/providers/auth0/session.go b/providers/auth0/session.go index ad2f7e29b..f3a97d649 100644 --- a/providers/auth0/session.go +++ b/providers/auth0/session.go @@ -62,3 +62,7 @@ func (p *Provider) UnmarshalSession(data string) (goth.Session, error) { err := json.NewDecoder(strings.NewReader(data)).Decode(s) return s, err } + +func (p *Provider) CreateSession(sessionValue interface{}) (goth.Session, error) { + return &Session{}, errors.New("not implemented") +} diff --git a/providers/azuread/azuread.go b/providers/azuread/azuread.go index 8717ddf37..6c987aa44 100644 --- a/providers/azuread/azuread.go +++ b/providers/azuread/azuread.go @@ -5,6 +5,7 @@ package azuread import ( "encoding/json" + "errors" "fmt" "io" "net/http" @@ -185,3 +186,7 @@ func userFromReader(r io.Reader, user *goth.User) error { func authorizationHeader(session *Session) (string, string) { return "Authorization", fmt.Sprintf("Bearer %s", session.AccessToken) } + +func (p *Provider) FetchUserWithToken(token string) (goth.User, error) { + return goth.User{}, errors.New("not implemented") +} diff --git a/providers/azuread/session.go b/providers/azuread/session.go index 098a9dc6d..38affbb2b 100644 --- a/providers/azuread/session.go +++ b/providers/azuread/session.go @@ -61,3 +61,7 @@ func (p *Provider) UnmarshalSession(data string) (goth.Session, error) { err := json.NewDecoder(strings.NewReader(data)).Decode(session) return session, err } + +func (p *Provider) CreateSession(sessionValue interface{}) (goth.Session, error) { + return &Session{}, errors.New("not implemented") +} diff --git a/providers/azureadv2/azureadv2.go b/providers/azureadv2/azureadv2.go index 523f79cce..2b9b11a55 100644 --- a/providers/azureadv2/azureadv2.go +++ b/providers/azureadv2/azureadv2.go @@ -2,6 +2,7 @@ package azureadv2 import ( "encoding/json" + "errors" "fmt" "io" "io/ioutil" @@ -231,3 +232,7 @@ func scopesToStrings(scopes ...ScopeType) []string { } return strs } + +func (p *Provider) FetchUserWithToken(token string) (goth.User, error) { + return goth.User{}, errors.New("not implemented") +} diff --git a/providers/azureadv2/session.go b/providers/azureadv2/session.go index f2f0cd07c..b53332549 100644 --- a/providers/azureadv2/session.go +++ b/providers/azureadv2/session.go @@ -61,3 +61,7 @@ func (p *Provider) UnmarshalSession(data string) (goth.Session, error) { err := json.NewDecoder(strings.NewReader(data)).Decode(session) return session, err } + +func (p *Provider) CreateSession(sessionValue interface{}) (goth.Session, error) { + return &Session{}, errors.New("not implemented") +} diff --git a/providers/battlenet/battlenet.go b/providers/battlenet/battlenet.go index 3a52b47e7..05c718dc6 100644 --- a/providers/battlenet/battlenet.go +++ b/providers/battlenet/battlenet.go @@ -5,6 +5,7 @@ package battlenet import ( "bytes" "encoding/json" + "errors" "fmt" "io/ioutil" "net/http" @@ -151,3 +152,7 @@ func (p *Provider) RefreshTokenAvailable() bool { func (p *Provider) RefreshToken(refreshToken string) (*oauth2.Token, error) { return nil, nil } + +func (p *Provider) FetchUserWithToken(token string) (goth.User, error) { + return goth.User{}, errors.New("not implemented") +} diff --git a/providers/battlenet/session.go b/providers/battlenet/session.go index 98fff650f..b204fe984 100644 --- a/providers/battlenet/session.go +++ b/providers/battlenet/session.go @@ -61,3 +61,7 @@ func (p *Provider) UnmarshalSession(data string) (goth.Session, error) { err := json.NewDecoder(strings.NewReader(data)).Decode(s) return s, err } + +func (p *Provider) CreateSession(sessionValue interface{}) (goth.Session, error) { + return &Session{}, errors.New("not implemented") +} diff --git a/providers/bitbucket/bitbucket.go b/providers/bitbucket/bitbucket.go index 06f2c9607..33859acd4 100644 --- a/providers/bitbucket/bitbucket.go +++ b/providers/bitbucket/bitbucket.go @@ -4,6 +4,7 @@ package bitbucket import ( "bytes" "encoding/json" + "errors" "fmt" "io/ioutil" "net/http" @@ -239,3 +240,7 @@ func (p *Provider) RefreshToken(refreshToken string) (*oauth2.Token, error) { } return newToken, err } + +func (p *Provider) FetchUserWithToken(token string) (goth.User, error) { + return goth.User{}, errors.New("not implemented") +} diff --git a/providers/bitbucket/session.go b/providers/bitbucket/session.go index a65242151..b79577974 100644 --- a/providers/bitbucket/session.go +++ b/providers/bitbucket/session.go @@ -59,3 +59,7 @@ func (p *Provider) UnmarshalSession(data string) (goth.Session, error) { func (s Session) String() string { return s.Marshal() } + +func (p *Provider) CreateSession(sessionValue interface{}) (goth.Session, error) { + return &Session{}, errors.New("not implemented") +} diff --git a/providers/bitly/bitly.go b/providers/bitly/bitly.go index f302d5fe4..753bb87f4 100644 --- a/providers/bitly/bitly.go +++ b/providers/bitly/bitly.go @@ -169,3 +169,7 @@ func getEmail(emails []struct { return "", fmt.Errorf("The user does not have a verified, primary email address on Bitly") } + +func (p *Provider) FetchUserWithToken(token string) (goth.User, error) { + return goth.User{}, errors.New("not implemented") +} diff --git a/providers/bitly/session.go b/providers/bitly/session.go index dbe876af7..cfcbc042f 100644 --- a/providers/bitly/session.go +++ b/providers/bitly/session.go @@ -57,3 +57,7 @@ func (p *Provider) UnmarshalSession(data string) (goth.Session, error) { err := json.NewDecoder(strings.NewReader(data)).Decode(s) return s, err } + +func (p *Provider) CreateSession(sessionValue interface{}) (goth.Session, error) { + return &Session{}, errors.New("not implemented") +} diff --git a/providers/box/box.go b/providers/box/box.go index 92b8b730b..e53a23034 100644 --- a/providers/box/box.go +++ b/providers/box/box.go @@ -4,6 +4,7 @@ package box import ( "encoding/json" + "errors" "fmt" "io" "net/http" @@ -156,3 +157,7 @@ func (p *Provider) RefreshToken(refreshToken string) (*oauth2.Token, error) { } return newToken, err } + +func (p *Provider) FetchUserWithToken(token string) (goth.User, error) { + return goth.User{}, errors.New("not implemented") +} diff --git a/providers/box/session.go b/providers/box/session.go index 69925ea5c..a25aab415 100644 --- a/providers/box/session.go +++ b/providers/box/session.go @@ -61,3 +61,7 @@ func (p *Provider) UnmarshalSession(data string) (goth.Session, error) { err := json.NewDecoder(strings.NewReader(data)).Decode(s) return s, err } + +func (p *Provider) CreateSession(sessionValue interface{}) (goth.Session, error) { + return &Session{}, errors.New("not implemented") +} diff --git a/providers/classlink/provider.go b/providers/classlink/provider.go index a64a67cae..deaaf5715 100644 --- a/providers/classlink/provider.go +++ b/providers/classlink/provider.go @@ -154,3 +154,7 @@ func newConfig(provider *Provider, scopes []string) *oauth2.Config { return c } + +func (p *Provider) FetchUserWithToken(token string) (goth.User, error) { + return goth.User{}, errors.New("not implemented") +} diff --git a/providers/classlink/session.go b/providers/classlink/session.go index bbb2d5d05..298a38994 100644 --- a/providers/classlink/session.go +++ b/providers/classlink/session.go @@ -47,3 +47,7 @@ func (s *Session) Authorize(provider goth.Provider, params goth.Params) (string, func (s *Session) String() string { return s.Marshal() } + +func (p *Provider) CreateSession(sessionValue interface{}) (goth.Session, error) { + return &Session{}, errors.New("not implemented") +} diff --git a/providers/cloudfoundry/cf.go b/providers/cloudfoundry/cf.go index 31eb63f2e..338258dfd 100644 --- a/providers/cloudfoundry/cf.go +++ b/providers/cloudfoundry/cf.go @@ -6,6 +6,7 @@ import ( "bytes" "context" "encoding/json" + "errors" "fmt" "io" "io/ioutil" @@ -175,3 +176,7 @@ func (p *Provider) RefreshToken(refreshToken string) (*oauth2.Token, error) { } return newToken, err } + +func (p *Provider) FetchUserWithToken(token string) (goth.User, error) { + return goth.User{}, errors.New("not implemented") +} diff --git a/providers/cloudfoundry/session.go b/providers/cloudfoundry/session.go index 896d4631e..172ac746d 100644 --- a/providers/cloudfoundry/session.go +++ b/providers/cloudfoundry/session.go @@ -64,3 +64,7 @@ func (p *Provider) UnmarshalSession(data string) (goth.Session, error) { err := json.NewDecoder(strings.NewReader(data)).Decode(s) return s, err } + +func (p *Provider) CreateSession(sessionValue interface{}) (goth.Session, error) { + return &Session{}, errors.New("not implemented") +} diff --git a/providers/cognito/cognito.go b/providers/cognito/cognito.go index ff4bee58d..ba03ec2fb 100644 --- a/providers/cognito/cognito.go +++ b/providers/cognito/cognito.go @@ -3,6 +3,7 @@ package cognito import ( "bytes" "encoding/json" + "errors" "fmt" "io" "io/ioutil" @@ -237,3 +238,7 @@ func (p *Provider) RefreshToken(refreshToken string) (*oauth2.Token, error) { } return newToken, err } + +func (p *Provider) FetchUserWithToken(token string) (goth.User, error) { + return goth.User{}, errors.New("not implemented") +} diff --git a/providers/cognito/session.go b/providers/cognito/session.go index 8aebda8bb..4790db0ed 100644 --- a/providers/cognito/session.go +++ b/providers/cognito/session.go @@ -62,3 +62,7 @@ func (p *Provider) UnmarshalSession(data string) (goth.Session, error) { err := json.NewDecoder(strings.NewReader(data)).Decode(s) return s, err } + +func (p *Provider) CreateSession(sessionValue interface{}) (goth.Session, error) { + return &Session{}, errors.New("not implemented") +} diff --git a/providers/dailymotion/dailymotion.go b/providers/dailymotion/dailymotion.go index d3c1e1d24..17b18ac01 100644 --- a/providers/dailymotion/dailymotion.go +++ b/providers/dailymotion/dailymotion.go @@ -5,6 +5,7 @@ package dailymotion import ( "bytes" "encoding/json" + "errors" "fmt" "io" "io/ioutil" @@ -187,3 +188,7 @@ func (p *Provider) RefreshToken(refreshToken string) (*oauth2.Token, error) { } return newToken, err } + +func (p *Provider) FetchUserWithToken(token string) (goth.User, error) { + return goth.User{}, errors.New("not implemented") +} diff --git a/providers/dailymotion/session.go b/providers/dailymotion/session.go index 5bf27e821..8ba0f31aa 100644 --- a/providers/dailymotion/session.go +++ b/providers/dailymotion/session.go @@ -60,3 +60,7 @@ func (p *Provider) UnmarshalSession(data string) (goth.Session, error) { err := json.NewDecoder(strings.NewReader(data)).Decode(sess) return sess, err } + +func (p *Provider) CreateSession(sessionValue interface{}) (goth.Session, error) { + return &Session{}, errors.New("not implemented") +} diff --git a/providers/deezer/deezer.go b/providers/deezer/deezer.go index a0f9b9d1d..ec5e0a92b 100644 --- a/providers/deezer/deezer.go +++ b/providers/deezer/deezer.go @@ -178,3 +178,7 @@ func (p *Provider) RefreshTokenAvailable() bool { func (p *Provider) RefreshToken(refreshToken string) (*oauth2.Token, error) { return nil, errors.New("Refresh token is not provided by deezer") } + +func (p *Provider) FetchUserWithToken(token string) (goth.User, error) { + return goth.User{}, errors.New("not implemented") +} diff --git a/providers/deezer/session.go b/providers/deezer/session.go index 83f8c8074..0bd175cab 100644 --- a/providers/deezer/session.go +++ b/providers/deezer/session.go @@ -64,3 +64,7 @@ func (p *Provider) UnmarshalSession(data string) (goth.Session, error) { err := json.NewDecoder(strings.NewReader(data)).Decode(sess) return sess, err } + +func (p *Provider) CreateSession(sessionValue interface{}) (goth.Session, error) { + return &Session{}, errors.New("not implemented") +} diff --git a/providers/digitalocean/digitalocean.go b/providers/digitalocean/digitalocean.go index 69a7a639e..a49ef865b 100644 --- a/providers/digitalocean/digitalocean.go +++ b/providers/digitalocean/digitalocean.go @@ -5,6 +5,7 @@ package digitalocean import ( "bytes" "encoding/json" + "errors" "fmt" "io" "io/ioutil" @@ -176,3 +177,7 @@ func (p *Provider) RefreshToken(refreshToken string) (*oauth2.Token, error) { } return newToken, err } + +func (p *Provider) FetchUserWithToken(token string) (goth.User, error) { + return goth.User{}, errors.New("not implemented") +} diff --git a/providers/digitalocean/session.go b/providers/digitalocean/session.go index 5d0045a3b..29265fd8e 100644 --- a/providers/digitalocean/session.go +++ b/providers/digitalocean/session.go @@ -61,3 +61,7 @@ func (p *Provider) UnmarshalSession(data string) (goth.Session, error) { err := json.NewDecoder(strings.NewReader(data)).Decode(sess) return sess, err } + +func (p *Provider) CreateSession(sessionValue interface{}) (goth.Session, error) { + return &Session{}, errors.New("not implemented") +} diff --git a/providers/discord/discord.go b/providers/discord/discord.go index 9b3030f2d..71edcdcd7 100644 --- a/providers/discord/discord.go +++ b/providers/discord/discord.go @@ -5,6 +5,7 @@ package discord import ( "bytes" "encoding/json" + "errors" "fmt" "io" "io/ioutil" @@ -235,3 +236,7 @@ func (p *Provider) RefreshToken(refreshToken string) (*oauth2.Token, error) { } return newToken, err } + +func (p *Provider) FetchUserWithToken(token string) (goth.User, error) { + return goth.User{}, errors.New("not implemented") +} diff --git a/providers/discord/session.go b/providers/discord/session.go index 228237e8d..828dc5829 100644 --- a/providers/discord/session.go +++ b/providers/discord/session.go @@ -64,3 +64,7 @@ func (p *Provider) UnmarshalSession(data string) (goth.Session, error) { err := json.NewDecoder(strings.NewReader(data)).Decode(s) return s, err } + +func (p *Provider) CreateSession(sessionValue interface{}) (goth.Session, error) { + return &Session{}, errors.New("not implemented") +} diff --git a/providers/dropbox/dropbox.go b/providers/dropbox/dropbox.go index da55dba15..87eb6b3b3 100644 --- a/providers/dropbox/dropbox.go +++ b/providers/dropbox/dropbox.go @@ -210,3 +210,11 @@ func (p *Provider) RefreshToken(refreshToken string) (*oauth2.Token, error) { func (p *Provider) RefreshTokenAvailable() bool { return false } + +func (p *Provider) FetchUserWithToken(token string) (goth.User, error) { + return goth.User{}, errors.New("not implemented") +} + +func (p *Provider) CreateSession(sessionValue interface{}) (goth.Session, error) { + return &Session{}, errors.New("not implemented") +} diff --git a/providers/eveonline/eveonline.go b/providers/eveonline/eveonline.go index ad18776b6..b15280672 100644 --- a/providers/eveonline/eveonline.go +++ b/providers/eveonline/eveonline.go @@ -5,6 +5,7 @@ package eveonline import ( "bytes" "encoding/json" + "errors" "fmt" "io/ioutil" "net/http" @@ -160,3 +161,7 @@ func (p *Provider) RefreshToken(refreshToken string) (*oauth2.Token, error) { } return newToken, err } + +func (p *Provider) FetchUserWithToken(token string) (goth.User, error) { + return goth.User{}, errors.New("not implemented") +} diff --git a/providers/eveonline/session.go b/providers/eveonline/session.go index d07d0ec47..61b556675 100644 --- a/providers/eveonline/session.go +++ b/providers/eveonline/session.go @@ -61,3 +61,7 @@ func (p *Provider) UnmarshalSession(data string) (goth.Session, error) { err := json.NewDecoder(strings.NewReader(data)).Decode(s) return s, err } + +func (p *Provider) CreateSession(sessionValue interface{}) (goth.Session, error) { + return &Session{}, errors.New("not implemented") +} diff --git a/providers/facebook/facebook.go b/providers/facebook/facebook.go index 23773ca34..252afd722 100644 --- a/providers/facebook/facebook.go +++ b/providers/facebook/facebook.go @@ -214,3 +214,8 @@ func (p *Provider) RefreshToken(refreshToken string) (*oauth2.Token, error) { func (p *Provider) RefreshTokenAvailable() bool { return false } + +func (p *Provider) FetchUserWithToken(token string) (goth.User, error) { + // TODO: + return goth.User{}, errors.New("not implemented") +} diff --git a/providers/facebook/session.go b/providers/facebook/session.go index 5cdcca443..553388ec7 100644 --- a/providers/facebook/session.go +++ b/providers/facebook/session.go @@ -57,3 +57,7 @@ func (p *Provider) UnmarshalSession(data string) (goth.Session, error) { err := json.NewDecoder(strings.NewReader(data)).Decode(sess) return sess, err } + +func (p *Provider) CreateSession(sessionValue interface{}) (goth.Session, error) { + return &Session{}, errors.New("not implemented") +} diff --git a/providers/faux/faux.go b/providers/faux/faux.go index 4b0cc5dd1..c0a4b9fd0 100644 --- a/providers/faux/faux.go +++ b/providers/faux/faux.go @@ -4,6 +4,7 @@ package faux import ( "encoding/json" + "errors" "fmt" "net/http" "strings" @@ -108,3 +109,11 @@ func (s *Session) Marshal() string { func (s *Session) GetAuthURL() (string, error) { return s.AuthURL, nil } + +func (p *Provider) FetchUserWithToken(token string) (goth.User, error) { + return goth.User{}, errors.New("not implemented") +} + +func (p *Provider) CreateSession(sessionValue interface{}) (goth.Session, error) { + return &Session{}, errors.New("not implemented") +} diff --git a/providers/fitbit/fitbit.go b/providers/fitbit/fitbit.go index 8f402ada7..776fcb75d 100644 --- a/providers/fitbit/fitbit.go +++ b/providers/fitbit/fitbit.go @@ -4,6 +4,7 @@ package fitbit import ( "encoding/json" + "errors" "fmt" "io" "net/http" @@ -193,3 +194,7 @@ func (p *Provider) RefreshToken(refreshToken string) (*oauth2.Token, error) { func (p *Provider) RefreshTokenAvailable() bool { return true } + +func (p *Provider) FetchUserWithToken(token string) (goth.User, error) { + return goth.User{}, errors.New("not implemented") +} diff --git a/providers/fitbit/session.go b/providers/fitbit/session.go index 4a499d2dd..3309f1f4a 100644 --- a/providers/fitbit/session.go +++ b/providers/fitbit/session.go @@ -59,3 +59,7 @@ func (p *Provider) UnmarshalSession(data string) (goth.Session, error) { err := json.Unmarshal([]byte(data), &s) return &s, err } + +func (p *Provider) CreateSession(sessionValue interface{}) (goth.Session, error) { + return &Session{}, errors.New("not implemented") +} diff --git a/providers/gitea/gitea.go b/providers/gitea/gitea.go index 6156df176..45d29093b 100644 --- a/providers/gitea/gitea.go +++ b/providers/gitea/gitea.go @@ -5,6 +5,7 @@ package gitea import ( "bytes" "encoding/json" + "errors" "fmt" "io" "io/ioutil" @@ -185,3 +186,7 @@ func (p *Provider) RefreshToken(refreshToken string) (*oauth2.Token, error) { } return newToken, err } + +func (p *Provider) FetchUserWithToken(token string) (goth.User, error) { + return goth.User{}, errors.New("not implemented") +} diff --git a/providers/gitea/session.go b/providers/gitea/session.go index 18c3fff7e..7bef60b1a 100644 --- a/providers/gitea/session.go +++ b/providers/gitea/session.go @@ -61,3 +61,7 @@ func (p *Provider) UnmarshalSession(data string) (goth.Session, error) { err := json.NewDecoder(strings.NewReader(data)).Decode(s) return s, err } + +func (p *Provider) CreateSession(sessionValue interface{}) (goth.Session, error) { + return &Session{}, errors.New("not implemented") +} diff --git a/providers/github/github.go b/providers/github/github.go index 962d07a33..561df678f 100644 --- a/providers/github/github.go +++ b/providers/github/github.go @@ -243,3 +243,7 @@ func (p *Provider) RefreshToken(refreshToken string) (*oauth2.Token, error) { func (p *Provider) RefreshTokenAvailable() bool { return false } + +func (p *Provider) FetchUserWithToken(token string) (goth.User, error) { + return goth.User{}, errors.New("not implemented") +} diff --git a/providers/github/session.go b/providers/github/session.go index cd19e8705..b8c03f310 100644 --- a/providers/github/session.go +++ b/providers/github/session.go @@ -54,3 +54,7 @@ func (p *Provider) UnmarshalSession(data string) (goth.Session, error) { err := json.NewDecoder(strings.NewReader(data)).Decode(sess) return sess, err } + +func (p *Provider) CreateSession(sessionValue interface{}) (goth.Session, error) { + return &Session{}, errors.New("not implemented") +} diff --git a/providers/gitlab/gitlab.go b/providers/gitlab/gitlab.go index e5457cf0a..b278bd41b 100644 --- a/providers/gitlab/gitlab.go +++ b/providers/gitlab/gitlab.go @@ -5,6 +5,7 @@ package gitlab import ( "bytes" "encoding/json" + "errors" "fmt" "io" "io/ioutil" @@ -186,3 +187,7 @@ func (p *Provider) RefreshToken(refreshToken string) (*oauth2.Token, error) { } return newToken, err } + +func (p *Provider) FetchUserWithToken(token string) (goth.User, error) { + return goth.User{}, errors.New("not implemented") +} diff --git a/providers/gitlab/session.go b/providers/gitlab/session.go index a2f90647c..f54fdc820 100644 --- a/providers/gitlab/session.go +++ b/providers/gitlab/session.go @@ -61,3 +61,7 @@ func (p *Provider) UnmarshalSession(data string) (goth.Session, error) { err := json.NewDecoder(strings.NewReader(data)).Decode(s) return s, err } + +func (p *Provider) CreateSession(sessionValue interface{}) (goth.Session, error) { + return &Session{}, errors.New("not implemented") +} diff --git a/providers/google/google.go b/providers/google/google.go index a266c91a2..a05a704c9 100644 --- a/providers/google/google.go +++ b/providers/google/google.go @@ -4,6 +4,7 @@ package google import ( "encoding/json" + "errors" "fmt" "io/ioutil" "net/http" @@ -209,3 +210,8 @@ func (p *Provider) SetAccessType(at string) { } p.authCodeOptions = append(p.authCodeOptions, oauth2.SetAuthURLParam("access_type", at)) } + +func (p *Provider) FetchUserWithToken(token string) (goth.User, error) { + //TODO: Implement this + return goth.User{}, errors.New("not implemented") +} diff --git a/providers/google/session.go b/providers/google/session.go index f2791df59..42ad7fa6c 100644 --- a/providers/google/session.go +++ b/providers/google/session.go @@ -61,3 +61,7 @@ func (p *Provider) UnmarshalSession(data string) (goth.Session, error) { err := json.NewDecoder(strings.NewReader(data)).Decode(sess) return sess, err } + +func (p *Provider) CreateSession(sessionValue interface{}) (goth.Session, error) { + return &Session{}, errors.New("not implemented") +} diff --git a/providers/gplus/gplus.go b/providers/gplus/gplus.go index 61e9a0ea0..87a930228 100644 --- a/providers/gplus/gplus.go +++ b/providers/gplus/gplus.go @@ -5,6 +5,7 @@ package gplus import ( "bytes" "encoding/json" + "errors" "fmt" "io" "io/ioutil" @@ -193,3 +194,8 @@ func (p *Provider) SetPrompt(prompt ...string) { } p.prompt = oauth2.SetAuthURLParam("prompt", strings.Join(prompt, " ")) } + +func (p *Provider) FetchUserWithToken(token string) (goth.User, error) { + //TODO + return goth.User{}, errors.New("not implemented") +} diff --git a/providers/gplus/session.go b/providers/gplus/session.go index 9710031f4..63ee4048a 100644 --- a/providers/gplus/session.go +++ b/providers/gplus/session.go @@ -59,3 +59,7 @@ func (p *Provider) UnmarshalSession(data string) (goth.Session, error) { err := json.NewDecoder(strings.NewReader(data)).Decode(sess) return sess, err } + +func (p *Provider) CreateSession(sessionValue interface{}) (goth.Session, error) { + return &Session{}, errors.New("not implemented") +} diff --git a/providers/heroku/heroku.go b/providers/heroku/heroku.go index 3df805463..aa2ab823c 100644 --- a/providers/heroku/heroku.go +++ b/providers/heroku/heroku.go @@ -4,6 +4,7 @@ package heroku import ( "encoding/json" + "errors" "fmt" "io" "net/http" @@ -155,3 +156,7 @@ func (p *Provider) RefreshToken(refreshToken string) (*oauth2.Token, error) { } return newToken, err } + +func (p *Provider) FetchUserWithToken(token string) (goth.User, error) { + return goth.User{}, errors.New("not implemented") +} diff --git a/providers/heroku/session.go b/providers/heroku/session.go index 2cd9ec9bc..aa85eb893 100644 --- a/providers/heroku/session.go +++ b/providers/heroku/session.go @@ -61,3 +61,7 @@ func (p *Provider) UnmarshalSession(data string) (goth.Session, error) { err := json.NewDecoder(strings.NewReader(data)).Decode(s) return s, err } + +func (p *Provider) CreateSession(sessionValue interface{}) (goth.Session, error) { + return &Session{}, errors.New("not implemented") +} diff --git a/providers/hubspot/hubspot.go b/providers/hubspot/hubspot.go index 10b292ddc..0a3764a0d 100644 --- a/providers/hubspot/hubspot.go +++ b/providers/hubspot/hubspot.go @@ -2,14 +2,16 @@ package hubspot import ( "encoding/json" + "errors" "fmt" - "github.com/markbates/goth" - "golang.org/x/oauth2" - "io" + "io/ioutil" "net/http" "net/url" "strconv" "time" + + "github.com/markbates/goth" + "golang.org/x/oauth2" ) // These vars define the Authentication and Token URLS for Hubspot. @@ -109,7 +111,7 @@ func (p *Provider) FetchUser(session goth.Session) (goth.User, error) { return user, fmt.Errorf("%s responded with a %d trying to fetch user information", p.providerName, response.StatusCode) } - responseBytes, err := io.ReadAll(response.Body) + responseBytes, err := ioutil.ReadAll(response.Body) if err != nil { return user, err } @@ -171,3 +173,7 @@ func (p *Provider) RefreshToken(refreshToken string) (*oauth2.Token, error) { } return newToken, err } + +func (p *Provider) FetchUserWithToken(token string) (goth.User, error) { + return goth.User{}, errors.New("not implemented") +} diff --git a/providers/hubspot/session.go b/providers/hubspot/session.go index 8cb3361f4..22d514c07 100644 --- a/providers/hubspot/session.go +++ b/providers/hubspot/session.go @@ -3,8 +3,9 @@ package hubspot import ( "encoding/json" "errors" - "github.com/markbates/goth" "strings" + + "github.com/markbates/goth" ) // Session stores data during the auth process with Hubspot. @@ -58,3 +59,7 @@ func (p *Provider) UnmarshalSession(data string) (goth.Session, error) { err := json.NewDecoder(strings.NewReader(data)).Decode(s) return s, err } + +func (p *Provider) CreateSession(sessionValue interface{}) (goth.Session, error) { + return &Session{}, errors.New("not implemented") +} diff --git a/providers/influxcloud/influxcloud.go b/providers/influxcloud/influxcloud.go index 7f7ad94c6..7a7d11d9c 100644 --- a/providers/influxcloud/influxcloud.go +++ b/providers/influxcloud/influxcloud.go @@ -179,3 +179,7 @@ func (p *Provider) RefreshToken(refreshToken string) (*oauth2.Token, error) { func (p *Provider) RefreshTokenAvailable() bool { return false } + +func (p *Provider) FetchUserWithToken(token string) (goth.User, error) { + return goth.User{}, errors.New("not implemented") +} diff --git a/providers/influxcloud/session.go b/providers/influxcloud/session.go index ce1420650..f8fc001f7 100644 --- a/providers/influxcloud/session.go +++ b/providers/influxcloud/session.go @@ -56,3 +56,7 @@ func (p *Provider) UnmarshalSession(data string) (goth.Session, error) { err := json.NewDecoder(strings.NewReader(data)).Decode(sess) return sess, err } + +func (p *Provider) CreateSession(sessionValue interface{}) (goth.Session, error) { + return &Session{}, errors.New("not implemented") +} diff --git a/providers/instagram/instagram.go b/providers/instagram/instagram.go index b4703dc44..4434688dc 100644 --- a/providers/instagram/instagram.go +++ b/providers/instagram/instagram.go @@ -172,3 +172,7 @@ func (p *Provider) RefreshToken(refreshToken string) (*oauth2.Token, error) { func (p *Provider) RefreshTokenAvailable() bool { return false } + +func (p *Provider) FetchUserWithToken(token string) (goth.User, error) { + return goth.User{}, errors.New("not implemented") +} diff --git a/providers/instagram/session.go b/providers/instagram/session.go index f6cfffe9f..f417deff1 100644 --- a/providers/instagram/session.go +++ b/providers/instagram/session.go @@ -54,3 +54,7 @@ func (p *Provider) UnmarshalSession(data string) (goth.Session, error) { err := json.NewDecoder(strings.NewReader(data)).Decode(sess) return sess, err } + +func (p *Provider) CreateSession(sessionValue interface{}) (goth.Session, error) { + return &Session{}, errors.New("not implemented") +} diff --git a/providers/intercom/intercom.go b/providers/intercom/intercom.go index b58e864ae..8670c756a 100644 --- a/providers/intercom/intercom.go +++ b/providers/intercom/intercom.go @@ -180,3 +180,7 @@ func (p *Provider) RefreshToken(refreshToken string) (*oauth2.Token, error) { func (p *Provider) RefreshTokenAvailable() bool { return false } + +func (p *Provider) FetchUserWithToken(token string) (goth.User, error) { + return goth.User{}, errors.New("not implemented") +} diff --git a/providers/intercom/session.go b/providers/intercom/session.go index c7a954663..480898aea 100644 --- a/providers/intercom/session.go +++ b/providers/intercom/session.go @@ -58,3 +58,7 @@ func (p *Provider) UnmarshalSession(data string) (goth.Session, error) { err := json.NewDecoder(strings.NewReader(data)).Decode(sess) return sess, err } + +func (p *Provider) CreateSession(sessionValue interface{}) (goth.Session, error) { + return &Session{}, errors.New("not implemented") +} diff --git a/providers/kakao/kakao.go b/providers/kakao/kakao.go index f19e35ad8..544aad035 100644 --- a/providers/kakao/kakao.go +++ b/providers/kakao/kakao.go @@ -5,6 +5,7 @@ package kakao import ( "bytes" "encoding/json" + "errors" "fmt" "io/ioutil" "net/http" @@ -160,3 +161,7 @@ func (p *Provider) RefreshTokenAvailable() bool { func (p *Provider) RefreshToken(refreshToken string) (*oauth2.Token, error) { return nil, nil } + +func (p *Provider) FetchUserWithToken(token string) (goth.User, error) { + return goth.User{}, errors.New("not implemented") +} diff --git a/providers/kakao/session.go b/providers/kakao/session.go index 3eb401e77..e9916c4bf 100644 --- a/providers/kakao/session.go +++ b/providers/kakao/session.go @@ -63,3 +63,7 @@ func (p *Provider) UnmarshalSession(data string) (goth.Session, error) { err := json.NewDecoder(strings.NewReader(data)).Decode(s) return s, err } + +func (p *Provider) CreateSession(sessionValue interface{}) (goth.Session, error) { + return &Session{}, errors.New("not implemented") +} diff --git a/providers/lastfm/lastfm.go b/providers/lastfm/lastfm.go index ad30e8d07..a2e6669da 100644 --- a/providers/lastfm/lastfm.go +++ b/providers/lastfm/lastfm.go @@ -228,3 +228,7 @@ func (p *Provider) RefreshToken(refreshToken string) (*oauth2.Token, error) { func (p *Provider) RefreshTokenAvailable() bool { return false } + +func (p *Provider) FetchUserWithToken(token string) (goth.User, error) { + return goth.User{}, errors.New("not implemented") +} diff --git a/providers/lastfm/session.go b/providers/lastfm/session.go index 43cb70b43..5aedeb2e3 100644 --- a/providers/lastfm/session.go +++ b/providers/lastfm/session.go @@ -52,3 +52,7 @@ func (p *Provider) UnmarshalSession(data string) (goth.Session, error) { err := json.NewDecoder(strings.NewReader(data)).Decode(sess) return sess, err } + +func (p *Provider) CreateSession(sessionValue interface{}) (goth.Session, error) { + return &Session{}, errors.New("not implemented") +} diff --git a/providers/line/line.go b/providers/line/line.go index e4d2e9555..b8721faa7 100644 --- a/providers/line/line.go +++ b/providers/line/line.go @@ -5,6 +5,7 @@ package line import ( "bytes" "encoding/json" + "errors" "fmt" "io/ioutil" "net/http" @@ -167,3 +168,7 @@ func (p *Provider) SetBotPrompt(botPrompt string) { } p.authCodeOptions = append(p.authCodeOptions, oauth2.SetAuthURLParam("bot_prompt", botPrompt)) } + +func (p *Provider) FetchUserWithToken(token string) (goth.User, error) { + return goth.User{}, errors.New("not implemented") +} diff --git a/providers/line/session.go b/providers/line/session.go index 158a2dde1..25fecc3e8 100644 --- a/providers/line/session.go +++ b/providers/line/session.go @@ -61,3 +61,7 @@ func (p *Provider) UnmarshalSession(data string) (goth.Session, error) { err := json.NewDecoder(strings.NewReader(data)).Decode(s) return s, err } + +func (p *Provider) CreateSession(sessionValue interface{}) (goth.Session, error) { + return &Session{}, errors.New("not implemented") +} diff --git a/providers/linkedin/linkedin.go b/providers/linkedin/linkedin.go index 5719911d7..9eb37749d 100644 --- a/providers/linkedin/linkedin.go +++ b/providers/linkedin/linkedin.go @@ -276,3 +276,7 @@ func (p *Provider) RefreshToken(refreshToken string) (*oauth2.Token, error) { func (p *Provider) RefreshTokenAvailable() bool { return false } + +func (p *Provider) FetchUserWithToken(token string) (goth.User, error) { + return goth.User{}, errors.New("not implemented") +} diff --git a/providers/linkedin/session.go b/providers/linkedin/session.go index 51dee95d1..ec997d71f 100644 --- a/providers/linkedin/session.go +++ b/providers/linkedin/session.go @@ -56,3 +56,7 @@ func (p *Provider) UnmarshalSession(data string) (goth.Session, error) { err := json.Unmarshal([]byte(data), &s) return &s, err } + +func (p *Provider) CreateSession(sessionValue interface{}) (goth.Session, error) { + return &Session{}, errors.New("not implemented") +} diff --git a/providers/mailru/mailru.go b/providers/mailru/mailru.go index db38280e2..36b908344 100644 --- a/providers/mailru/mailru.go +++ b/providers/mailru/mailru.go @@ -4,6 +4,7 @@ package mailru import ( "encoding/json" + "errors" "fmt" "io/ioutil" "net/http" @@ -136,3 +137,7 @@ func (p *Provider) RefreshToken(refreshToken string) (*oauth2.Token, error) { func (p *Provider) RefreshTokenAvailable() bool { return true } + +func (p *Provider) FetchUserWithToken(token string) (goth.User, error) { + return goth.User{}, errors.New("not implemented") +} diff --git a/providers/mailru/session.go b/providers/mailru/session.go index 0487d3efc..3bb7a2b00 100644 --- a/providers/mailru/session.go +++ b/providers/mailru/session.go @@ -57,3 +57,7 @@ func (p *Provider) UnmarshalSession(data string) (goth.Session, error) { err := json.NewDecoder(strings.NewReader(data)).Decode(&sess) return sess, err } + +func (p *Provider) CreateSession(sessionValue interface{}) (goth.Session, error) { + return &Session{}, errors.New("not implemented") +} diff --git a/providers/mastodon/mastodon.go b/providers/mastodon/mastodon.go index a69788d20..4f9d4e3bc 100644 --- a/providers/mastodon/mastodon.go +++ b/providers/mastodon/mastodon.go @@ -5,6 +5,7 @@ package mastodon import ( "bytes" "encoding/json" + "errors" "fmt" "io" "io/ioutil" @@ -183,3 +184,7 @@ func (p *Provider) RefreshToken(refreshToken string) (*oauth2.Token, error) { } return newToken, err } + +func (p *Provider) FetchUserWithToken(token string) (goth.User, error) { + return goth.User{}, errors.New("not implemented") +} diff --git a/providers/mastodon/session.go b/providers/mastodon/session.go index b975c0805..92a241827 100644 --- a/providers/mastodon/session.go +++ b/providers/mastodon/session.go @@ -61,3 +61,7 @@ func (p *Provider) UnmarshalSession(data string) (goth.Session, error) { err := json.NewDecoder(strings.NewReader(data)).Decode(s) return s, err } + +func (p *Provider) CreateSession(sessionValue interface{}) (goth.Session, error) { + return &Session{}, errors.New("not implemented") +} diff --git a/providers/meetup/meetup.go b/providers/meetup/meetup.go index 3d1ef0c8c..0c86849b7 100644 --- a/providers/meetup/meetup.go +++ b/providers/meetup/meetup.go @@ -5,6 +5,7 @@ package meetup import ( "bytes" "encoding/json" + "errors" "fmt" "io" "io/ioutil" @@ -195,3 +196,7 @@ func (p *Provider) RefreshToken(refreshToken string) (*oauth2.Token, error) { } return newToken, err } + +func (p *Provider) FetchUserWithToken(token string) (goth.User, error) { + return goth.User{}, errors.New("not implemented") +} diff --git a/providers/meetup/session.go b/providers/meetup/session.go index 611339592..77c0d4618 100644 --- a/providers/meetup/session.go +++ b/providers/meetup/session.go @@ -61,3 +61,7 @@ func (p *Provider) UnmarshalSession(data string) (goth.Session, error) { err := json.NewDecoder(strings.NewReader(data)).Decode(s) return s, err } + +func (p *Provider) CreateSession(sessionValue interface{}) (goth.Session, error) { + return &Session{}, errors.New("not implemented") +} diff --git a/providers/microsoftonline/microsoftonline.go b/providers/microsoftonline/microsoftonline.go index abf5db21c..e85e2e17d 100644 --- a/providers/microsoftonline/microsoftonline.go +++ b/providers/microsoftonline/microsoftonline.go @@ -6,6 +6,7 @@ package microsoftonline import ( "bytes" "encoding/json" + "errors" "fmt" "io" "net/http" @@ -188,3 +189,7 @@ func userFromReader(r io.Reader, user *goth.User) error { func authorizationHeader(session *Session) (string, string) { return "Authorization", fmt.Sprintf("Bearer %s", session.AccessToken) } + +func (p *Provider) FetchUserWithToken(token string) (goth.User, error) { + return goth.User{}, errors.New("not implemented") +} diff --git a/providers/microsoftonline/session.go b/providers/microsoftonline/session.go index 0747ab523..bb2110454 100644 --- a/providers/microsoftonline/session.go +++ b/providers/microsoftonline/session.go @@ -60,3 +60,7 @@ func (p *Provider) UnmarshalSession(data string) (goth.Session, error) { err := json.NewDecoder(strings.NewReader(data)).Decode(session) return session, err } + +func (p *Provider) CreateSession(sessionValue interface{}) (goth.Session, error) { + return &Session{}, errors.New("not implemented") +} diff --git a/providers/naver/naver.go b/providers/naver/naver.go index dad6beb89..23485f641 100644 --- a/providers/naver/naver.go +++ b/providers/naver/naver.go @@ -3,6 +3,7 @@ package naver import ( "bytes" "encoding/json" + "errors" "fmt" "io" "io/ioutil" @@ -171,3 +172,7 @@ func userFromReader(reader io.Reader, user *goth.User) error { return nil } + +func (p *Provider) FetchUserWithToken(token string) (goth.User, error) { + return goth.User{}, errors.New("not implemented") +} diff --git a/providers/naver/session.go b/providers/naver/session.go index 01ad71359..972ccbf76 100644 --- a/providers/naver/session.go +++ b/providers/naver/session.go @@ -59,3 +59,7 @@ func (p *Provider) UnmarshalSession(data string) (goth.Session, error) { err := json.NewDecoder(strings.NewReader(data)).Decode(s) return s, err } + +func (p *Provider) CreateSession(sessionValue interface{}) (goth.Session, error) { + return &Session{}, errors.New("not implemented") +} diff --git a/providers/nextcloud/nextcloud.go b/providers/nextcloud/nextcloud.go index 23d3ee896..72672469b 100644 --- a/providers/nextcloud/nextcloud.go +++ b/providers/nextcloud/nextcloud.go @@ -5,6 +5,7 @@ package nextcloud import ( "bytes" "encoding/json" + "errors" "fmt" "io" "io/ioutil" @@ -204,3 +205,7 @@ func (p *Provider) RefreshToken(refreshToken string) (*oauth2.Token, error) { } return newToken, err } + +func (p *Provider) FetchUserWithToken(token string) (goth.User, error) { + return goth.User{}, errors.New("not implemented") +} diff --git a/providers/nextcloud/session.go b/providers/nextcloud/session.go index 568f3d6d4..4256e41ff 100644 --- a/providers/nextcloud/session.go +++ b/providers/nextcloud/session.go @@ -61,3 +61,7 @@ func (p *Provider) UnmarshalSession(data string) (goth.Session, error) { err := json.NewDecoder(strings.NewReader(data)).Decode(s) return s, err } + +func (p *Provider) CreateSession(sessionValue interface{}) (goth.Session, error) { + return &Session{}, errors.New("not implemented") +} diff --git a/providers/okta/okta.go b/providers/okta/okta.go index b53eae2b4..7a339b8db 100644 --- a/providers/okta/okta.go +++ b/providers/okta/okta.go @@ -5,6 +5,7 @@ package okta import ( "bytes" "encoding/json" + "errors" "fmt" "io" "io/ioutil" @@ -196,3 +197,7 @@ func (p *Provider) RefreshToken(refreshToken string) (*oauth2.Token, error) { } return newToken, err } + +func (p *Provider) FetchUserWithToken(token string) (goth.User, error) { + return goth.User{}, errors.New("not implemented") +} diff --git a/providers/okta/session.go b/providers/okta/session.go index e0951fe0f..6bd2e6d3c 100644 --- a/providers/okta/session.go +++ b/providers/okta/session.go @@ -62,3 +62,7 @@ func (p *Provider) UnmarshalSession(data string) (goth.Session, error) { err := json.NewDecoder(strings.NewReader(data)).Decode(s) return s, err } + +func (p *Provider) CreateSession(sessionValue interface{}) (goth.Session, error) { + return &Session{}, errors.New("not implemented") +} diff --git a/providers/onedrive/onedrive.go b/providers/onedrive/onedrive.go index dcb96e9cb..a5c174de5 100644 --- a/providers/onedrive/onedrive.go +++ b/providers/onedrive/onedrive.go @@ -5,6 +5,7 @@ package onedrive import ( "bytes" "encoding/json" + "errors" "fmt" "io" "io/ioutil" @@ -162,3 +163,7 @@ func (p *Provider) RefreshToken(refreshToken string) (*oauth2.Token, error) { } return newToken, err } + +func (p *Provider) FetchUserWithToken(token string) (goth.User, error) { + return goth.User{}, errors.New("not implemented") +} diff --git a/providers/onedrive/session.go b/providers/onedrive/session.go index fec401d4c..2097c4c4f 100644 --- a/providers/onedrive/session.go +++ b/providers/onedrive/session.go @@ -61,3 +61,7 @@ func (p *Provider) UnmarshalSession(data string) (goth.Session, error) { err := json.NewDecoder(strings.NewReader(data)).Decode(s) return s, err } + +func (p *Provider) CreateSession(sessionValue interface{}) (goth.Session, error) { + return &Session{}, errors.New("not implemented") +} diff --git a/providers/openidConnect/openidConnect.go b/providers/openidConnect/openidConnect.go index 4a7215948..99034bdc0 100644 --- a/providers/openidConnect/openidConnect.go +++ b/providers/openidConnect/openidConnect.go @@ -518,3 +518,7 @@ func unMarshal(payload []byte) (map[string]interface{}, error) { return data, json.NewDecoder(bytes.NewBuffer(payload)).Decode(&data) } + +func (p *Provider) FetchUserWithToken(token string) (goth.User, error) { + return goth.User{}, errors.New("not implemented") +} diff --git a/providers/openidConnect/session.go b/providers/openidConnect/session.go index b5d38f22b..5b8ae5c5f 100644 --- a/providers/openidConnect/session.go +++ b/providers/openidConnect/session.go @@ -77,3 +77,7 @@ func (p *Provider) UnmarshalSession(data string) (goth.Session, error) { err := json.NewDecoder(strings.NewReader(data)).Decode(sess) return sess, err } + +func (p *Provider) CreateSession(sessionValue interface{}) (goth.Session, error) { + return &Session{}, errors.New("not implemented") +} diff --git a/providers/oura/oura.go b/providers/oura/oura.go index a62e89470..afe5d7553 100644 --- a/providers/oura/oura.go +++ b/providers/oura/oura.go @@ -3,6 +3,7 @@ package oura import ( "encoding/json" + "errors" "fmt" "io" "net/http" @@ -189,3 +190,7 @@ func (p *Provider) RefreshToken(refreshToken string) (*oauth2.Token, error) { func (p *Provider) RefreshTokenAvailable() bool { return true } + +func (p *Provider) FetchUserWithToken(token string) (goth.User, error) { + return goth.User{}, errors.New("not implemented") +} diff --git a/providers/oura/session.go b/providers/oura/session.go index b164293bf..16cfe7d86 100644 --- a/providers/oura/session.go +++ b/providers/oura/session.go @@ -62,3 +62,7 @@ func (p *Provider) UnmarshalSession(data string) (goth.Session, error) { err := json.Unmarshal([]byte(data), &s) return &s, err } + +func (p *Provider) CreateSession(sessionValue interface{}) (goth.Session, error) { + return &Session{}, errors.New("not implemented") +} diff --git a/providers/patreon/patreon.go b/providers/patreon/patreon.go index a599b75e1..ebe9dbc76 100644 --- a/providers/patreon/patreon.go +++ b/providers/patreon/patreon.go @@ -3,6 +3,7 @@ package patreon import ( "bytes" "encoding/json" + "errors" "fmt" "io" "io/ioutil" @@ -218,3 +219,7 @@ func userFromReader(r io.Reader, user *goth.User) error { user.AvatarURL = u.Data.Attributes.ImageURL return nil } + +func (p *Provider) FetchUserWithToken(token string) (goth.User, error) { + return goth.User{}, errors.New("not implemented") +} diff --git a/providers/patreon/session.go b/providers/patreon/session.go index 7e5f22f03..33c2af886 100644 --- a/providers/patreon/session.go +++ b/providers/patreon/session.go @@ -61,3 +61,7 @@ func (p *Provider) UnmarshalSession(data string) (goth.Session, error) { err := json.Unmarshal([]byte(data), &s) return &s, err } + +func (p *Provider) CreateSession(sessionValue interface{}) (goth.Session, error) { + return &Session{}, errors.New("not implemented") +} diff --git a/providers/paypal/paypal.go b/providers/paypal/paypal.go index bca0b8b77..536d2339f 100644 --- a/providers/paypal/paypal.go +++ b/providers/paypal/paypal.go @@ -5,6 +5,7 @@ package paypal import ( "bytes" "encoding/json" + "errors" "fmt" "io" "io/ioutil" @@ -198,3 +199,7 @@ func (p *Provider) RefreshToken(refreshToken string) (*oauth2.Token, error) { } return newToken, err } + +func (p *Provider) FetchUserWithToken(token string) (goth.User, error) { + return goth.User{}, errors.New("not implemented") +} diff --git a/providers/paypal/session.go b/providers/paypal/session.go index 0e099b3f2..35daddf24 100644 --- a/providers/paypal/session.go +++ b/providers/paypal/session.go @@ -61,3 +61,7 @@ func (p *Provider) UnmarshalSession(data string) (goth.Session, error) { err := json.NewDecoder(strings.NewReader(data)).Decode(s) return s, err } + +func (p *Provider) CreateSession(sessionValue interface{}) (goth.Session, error) { + return &Session{}, errors.New("not implemented") +} diff --git a/providers/reddit/reddit.go b/providers/reddit/reddit.go index 2843c2f57..cb1dce44b 100644 --- a/providers/reddit/reddit.go +++ b/providers/reddit/reddit.go @@ -2,12 +2,14 @@ package reddit import ( "encoding/json" + "errors" "fmt" - "github.com/markbates/goth" - "golang.org/x/oauth2" - "io" + "io/ioutil" "net/http" "time" + + "github.com/markbates/goth" + "golang.org/x/oauth2" ) const ( @@ -105,7 +107,7 @@ func (p *Provider) FetchUser(s goth.Session) (goth.User, error) { return goth.User{}, fmt.Errorf("%s responded with a %d trying to fetch user profile", p.providerName, res.StatusCode) } - bits, err := io.ReadAll(res.Body) + bits, err := ioutil.ReadAll(res.Body) if err != nil { return goth.User{}, err } @@ -134,3 +136,7 @@ func (p *Provider) FetchUser(s goth.Session) (goth.User, error) { return gothUser, nil } + +func (p *Provider) FetchUserWithToken(token string) (goth.User, error) { + return goth.User{}, errors.New("not implemented") +} diff --git a/providers/reddit/session.go b/providers/reddit/session.go index 1d646992f..da86d74f6 100644 --- a/providers/reddit/session.go +++ b/providers/reddit/session.go @@ -4,9 +4,10 @@ import ( "context" "encoding/json" "errors" + "time" + "github.com/markbates/goth" "golang.org/x/oauth2" - "time" ) type Session struct { @@ -44,3 +45,7 @@ func (s *Session) Authorize(provider goth.Provider, params goth.Params) (string, return s.AccessToken, nil } + +func (p *Provider) CreateSession(sessionValue interface{}) (goth.Session, error) { + return &Session{}, errors.New("not implemented") +} diff --git a/providers/salesforce/salesforce.go b/providers/salesforce/salesforce.go index d4a1c3f50..7d7369fff 100644 --- a/providers/salesforce/salesforce.go +++ b/providers/salesforce/salesforce.go @@ -5,6 +5,7 @@ package salesforce import ( "bytes" "encoding/json" + "errors" "fmt" "io" "net/http" @@ -189,3 +190,7 @@ func (p *Provider) RefreshToken(refreshToken string) (*oauth2.Token, error) { } return newToken, err } + +func (p *Provider) FetchUserWithToken(token string) (goth.User, error) { + return goth.User{}, errors.New("not implemented") +} diff --git a/providers/salesforce/session.go b/providers/salesforce/session.go index 1d2ffd12e..ae20a37fd 100644 --- a/providers/salesforce/session.go +++ b/providers/salesforce/session.go @@ -70,3 +70,7 @@ func (p *Provider) UnmarshalSession(data string) (goth.Session, error) { err := json.NewDecoder(strings.NewReader(data)).Decode(s) return s, err } + +func (p *Provider) CreateSession(sessionValue interface{}) (goth.Session, error) { + return &Session{}, errors.New("not implemented") +} diff --git a/providers/seatalk/seatalk.go b/providers/seatalk/seatalk.go index fd6161be6..278e3a3a9 100644 --- a/providers/seatalk/seatalk.go +++ b/providers/seatalk/seatalk.go @@ -3,6 +3,7 @@ package seatalk import ( "context" "encoding/json" + "errors" "fmt" "io/ioutil" "net/http" @@ -159,3 +160,7 @@ func newConfig(provider *Provider, scopes []string) *oauth2.Config { func (p *Provider) RefreshTokenAvailable() bool { return true } + +func (p *Provider) FetchUserWithToken(token string) (goth.User, error) { + return goth.User{}, errors.New("not implemented") +} diff --git a/providers/seatalk/session.go b/providers/seatalk/session.go index e0e474a93..232b4be93 100644 --- a/providers/seatalk/session.go +++ b/providers/seatalk/session.go @@ -52,3 +52,7 @@ func (s *Session) Marshal() string { func (s Session) String() string { return s.Marshal() } + +func (p *Provider) CreateSession(sessionValue interface{}) (goth.Session, error) { + return &Session{}, errors.New("not implemented") +} diff --git a/providers/shopify/session.go b/providers/shopify/session.go index ba9e7e95a..c50501450 100755 --- a/providers/shopify/session.go +++ b/providers/shopify/session.go @@ -101,3 +101,7 @@ func (p *Provider) UnmarshalSession(data string) (goth.Session, error) { err := json.NewDecoder(strings.NewReader(data)).Decode(s) return s, err } + +func (p *Provider) CreateSession(sessionValue interface{}) (goth.Session, error) { + return &Session{}, errors.New("not implemented") +} diff --git a/providers/shopify/shopify.go b/providers/shopify/shopify.go index 9b1450680..a72d44f38 100755 --- a/providers/shopify/shopify.go +++ b/providers/shopify/shopify.go @@ -190,3 +190,7 @@ func newConfig(p *Provider, scopes []string) *oauth2.Config { return c } + +func (p *Provider) FetchUserWithToken(token string) (goth.User, error) { + return goth.User{}, errors.New("not implemented") +} diff --git a/providers/slack/session.go b/providers/slack/session.go index 83d66f9e9..bba352c01 100644 --- a/providers/slack/session.go +++ b/providers/slack/session.go @@ -61,3 +61,7 @@ func (p *Provider) UnmarshalSession(data string) (goth.Session, error) { err := json.NewDecoder(strings.NewReader(data)).Decode(s) return s, err } + +func (p *Provider) CreateSession(sessionValue interface{}) (goth.Session, error) { + return &Session{}, errors.New("not implemented") +} diff --git a/providers/slack/slack.go b/providers/slack/slack.go index 84036ea96..daadb5209 100644 --- a/providers/slack/slack.go +++ b/providers/slack/slack.go @@ -5,6 +5,7 @@ package slack import ( "bytes" "encoding/json" + "errors" "fmt" "io" "io/ioutil" @@ -235,3 +236,7 @@ func (p *Provider) RefreshTokenAvailable() bool { func (p *Provider) RefreshToken(refreshToken string) (*oauth2.Token, error) { return nil, nil } + +func (p *Provider) FetchUserWithToken(token string) (goth.User, error) { + return goth.User{}, errors.New("not implemented") +} diff --git a/providers/soundcloud/session.go b/providers/soundcloud/session.go index f06bd0edd..2a972c88a 100644 --- a/providers/soundcloud/session.go +++ b/providers/soundcloud/session.go @@ -61,3 +61,7 @@ func (p *Provider) UnmarshalSession(data string) (goth.Session, error) { err := json.NewDecoder(strings.NewReader(data)).Decode(s) return s, err } + +func (p *Provider) CreateSession(sessionValue interface{}) (goth.Session, error) { + return &Session{}, errors.New("not implemented") +} diff --git a/providers/soundcloud/soundcloud.go b/providers/soundcloud/soundcloud.go index 2e11ee624..b0d947231 100644 --- a/providers/soundcloud/soundcloud.go +++ b/providers/soundcloud/soundcloud.go @@ -5,6 +5,7 @@ package soundcloud import ( "bytes" "encoding/json" + "errors" "fmt" "io" "io/ioutil" @@ -168,3 +169,7 @@ func (p *Provider) RefreshToken(refreshToken string) (*oauth2.Token, error) { } return newToken, err } + +func (p *Provider) FetchUserWithToken(token string) (goth.User, error) { + return goth.User{}, errors.New("not implemented") +} diff --git a/providers/spotify/session.go b/providers/spotify/session.go index 3d106faf1..07457c1f6 100644 --- a/providers/spotify/session.go +++ b/providers/spotify/session.go @@ -61,3 +61,7 @@ func (p *Provider) UnmarshalSession(data string) (goth.Session, error) { err := json.Unmarshal([]byte(data), &s) return &s, err } + +func (p *Provider) CreateSession(sessionValue interface{}) (goth.Session, error) { + return &Session{}, errors.New("not implemented") +} diff --git a/providers/spotify/spotify.go b/providers/spotify/spotify.go index f36512c0c..ed214636d 100644 --- a/providers/spotify/spotify.go +++ b/providers/spotify/spotify.go @@ -4,6 +4,7 @@ package spotify import ( "encoding/json" + "errors" "fmt" "io" "net/http" @@ -222,3 +223,7 @@ func (p *Provider) RefreshToken(refreshToken string) (*oauth2.Token, error) { } return newToken, err } + +func (p *Provider) FetchUserWithToken(token string) (goth.User, error) { + return goth.User{}, errors.New("not implemented") +} diff --git a/providers/steam/session.go b/providers/steam/session.go index 8f60dc296..d0333922e 100644 --- a/providers/steam/session.go +++ b/providers/steam/session.go @@ -98,3 +98,7 @@ func (p *Provider) UnmarshalSession(data string) (goth.Session, error) { err := json.NewDecoder(strings.NewReader(data)).Decode(s) return s, err } + +func (p *Provider) CreateSession(sessionValue interface{}) (goth.Session, error) { + return &Session{}, errors.New("not implemented") +} diff --git a/providers/steam/steam.go b/providers/steam/steam.go index 79679defe..23bff4514 100644 --- a/providers/steam/steam.go +++ b/providers/steam/steam.go @@ -3,6 +3,7 @@ package steam import ( "encoding/json" + "errors" "fmt" "io" "net/http" @@ -197,3 +198,7 @@ func (p *Provider) RefreshToken(refreshToken string) (*oauth2.Token, error) { func (p *Provider) RefreshTokenAvailable() bool { return false } + +func (p *Provider) FetchUserWithToken(token string) (goth.User, error) { + return goth.User{}, errors.New("not implemented") +} diff --git a/providers/strava/session.go b/providers/strava/session.go index cc0cbd0d4..94d7115fa 100644 --- a/providers/strava/session.go +++ b/providers/strava/session.go @@ -59,3 +59,7 @@ func (p *Provider) UnmarshalSession(data string) (goth.Session, error) { err := json.NewDecoder(strings.NewReader(data)).Decode(s) return s, err } + +func (p *Provider) CreateSession(sessionValue interface{}) (goth.Session, error) { + return &Session{}, errors.New("not implemented") +} diff --git a/providers/strava/strava.go b/providers/strava/strava.go index 785cc7fb2..bdd8146f6 100644 --- a/providers/strava/strava.go +++ b/providers/strava/strava.go @@ -5,6 +5,7 @@ package strava import ( "bytes" "encoding/json" + "errors" "fmt" "io" "io/ioutil" @@ -181,3 +182,7 @@ func (p *Provider) RefreshToken(refreshToken string) (*oauth2.Token, error) { } return newToken, err } + +func (p *Provider) FetchUserWithToken(token string) (goth.User, error) { + return goth.User{}, errors.New("not implemented") +} diff --git a/providers/stripe/session.go b/providers/stripe/session.go index 24f5581ed..f1094234f 100644 --- a/providers/stripe/session.go +++ b/providers/stripe/session.go @@ -63,3 +63,7 @@ func (p *Provider) UnmarshalSession(data string) (goth.Session, error) { err := json.NewDecoder(strings.NewReader(data)).Decode(s) return s, err } + +func (p *Provider) CreateSession(sessionValue interface{}) (goth.Session, error) { + return &Session{}, errors.New("not implemented") +} diff --git a/providers/stripe/stripe.go b/providers/stripe/stripe.go index b2c2257ba..19874de63 100644 --- a/providers/stripe/stripe.go +++ b/providers/stripe/stripe.go @@ -4,6 +4,7 @@ package stripe import ( "encoding/json" + "errors" "fmt" "io" "net/http" @@ -162,3 +163,7 @@ func (p *Provider) RefreshToken(refreshToken string) (*oauth2.Token, error) { } return newToken, err } + +func (p *Provider) FetchUserWithToken(token string) (goth.User, error) { + return goth.User{}, errors.New("not implemented") +} diff --git a/providers/tiktok/session.go b/providers/tiktok/session.go index 2430b1749..4b6536071 100644 --- a/providers/tiktok/session.go +++ b/providers/tiktok/session.go @@ -102,3 +102,7 @@ func (s Session) Marshal() string { func (s Session) String() string { return s.Marshal() } + +func (p *Provider) CreateSession(sessionValue interface{}) (goth.Session, error) { + return &Session{}, errors.New("not implemented") +} diff --git a/providers/tiktok/tiktok.go b/providers/tiktok/tiktok.go index 1d3332188..d6ab32fe9 100644 --- a/providers/tiktok/tiktok.go +++ b/providers/tiktok/tiktok.go @@ -5,6 +5,7 @@ package tiktok import ( "bytes" "encoding/json" + "errors" "fmt" "io" "io/ioutil" @@ -277,3 +278,7 @@ func handleErrorResponse(data []byte) error { return fmt.Errorf("%s [%d]", errResp.Data.Description, errResp.Data.ErrorCode) } + +func (p *Provider) FetchUserWithToken(token string) (goth.User, error) { + return goth.User{}, errors.New("not implemented") +} diff --git a/providers/tumblr/session.go b/providers/tumblr/session.go index 10b5de8c0..f61be3c31 100644 --- a/providers/tumblr/session.go +++ b/providers/tumblr/session.go @@ -52,3 +52,7 @@ func (p *Provider) UnmarshalSession(data string) (goth.Session, error) { err := json.NewDecoder(strings.NewReader(data)).Decode(sess) return sess, err } + +func (p *Provider) CreateSession(sessionValue interface{}) (goth.Session, error) { + return &Session{}, errors.New("not implemented") +} diff --git a/providers/tumblr/tumblr.go b/providers/tumblr/tumblr.go index 07028c227..c7414ef55 100644 --- a/providers/tumblr/tumblr.go +++ b/providers/tumblr/tumblr.go @@ -150,3 +150,7 @@ func (p *Provider) RefreshToken(refreshToken string) (*oauth2.Token, error) { func (p *Provider) RefreshTokenAvailable() bool { return false } + +func (p *Provider) FetchUserWithToken(token string) (goth.User, error) { + return goth.User{}, errors.New("not implemented") +} diff --git a/providers/twitch/session.go b/providers/twitch/session.go index 109962d91..ccadc3d87 100644 --- a/providers/twitch/session.go +++ b/providers/twitch/session.go @@ -63,3 +63,7 @@ func (p *Provider) UnmarshalSession(data string) (goth.Session, error) { err := json.NewDecoder(strings.NewReader(data)).Decode(s) return s, err } + +func (p *Provider) CreateSession(sessionValue interface{}) (goth.Session, error) { + return &Session{}, errors.New("not implemented") +} diff --git a/providers/twitch/twitch.go b/providers/twitch/twitch.go index 1fe70702b..d8ba470b3 100644 --- a/providers/twitch/twitch.go +++ b/providers/twitch/twitch.go @@ -3,10 +3,12 @@ package twitch import ( + "bytes" "encoding/json" "errors" "fmt" "io" + "io/ioutil" "net/http" "github.com/markbates/goth" @@ -17,6 +19,7 @@ const ( authURL string = "https://id.twitch.tv/oauth2/authorize" tokenURL string = "https://id.twitch.tv/oauth2/token" userEndpoint string = "https://api.twitch.tv/helix/users" + validateURL string = "https://id.twitch.tv/oauth2/validate" ) const ( @@ -272,6 +275,7 @@ func (p *Provider) FetchUser(session goth.Session) (goth.User, error) { Provider: p.Name(), RefreshToken: s.RefreshToken, ExpiresAt: s.ExpiresAt, + RawData: make(map[string]interface{}), } if user.AccessToken == "" { @@ -279,6 +283,28 @@ func (p *Provider) FetchUser(session goth.Session) (goth.User, error) { return user, fmt.Errorf("%s cannot get user information without accessToken", p.providerName) } + validate_req, err := http.NewRequest("GET", validateURL, nil) + + if err == nil { + + validate_req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", s.AccessToken)) + validate_resp, err := p.Client().Do(validate_req) + + if err != nil { + return user, err + } + + if validate_resp != nil { + defer validate_resp.Body.Close() + } + + validate_info, err := validateInfoFromReader(validate_resp.Body) + + if err == nil { + user.RawData["validate_info"] = validate_info + } + } + req, err := http.NewRequest("GET", userEndpoint, nil) if err != nil { return user, err @@ -296,10 +322,17 @@ func (p *Provider) FetchUser(session goth.Session) (goth.User, error) { } err = userFromReader(resp.Body, &user) + return user, err } func userFromReader(r io.Reader, user *goth.User) error { + + body, err := ioutil.ReadAll(r) + if err != nil { + return err + } + var users struct { Data []struct { ID string `json:"id"` @@ -310,13 +343,17 @@ func userFromReader(r io.Reader, user *goth.User) error { Email string `json:"email"` } `json:"data"` } - err := json.NewDecoder(r).Decode(&users) + + err = json.NewDecoder(bytes.NewReader(body)).Decode(&users) + if err != nil { return err } + if len(users.Data) == 0 { return errors.New("user not found") } + u := users.Data[0] user.Name = u.Name user.Email = u.Email @@ -326,9 +363,33 @@ func userFromReader(r io.Reader, user *goth.User) error { user.Description = u.Description user.UserID = u.ID + raw_data := make(map[string]interface{}) + + err = json.NewDecoder(bytes.NewReader(body)).Decode(&raw_data) + + if err != nil { + return err + } + + user.RawData["user_info"] = raw_data + return nil } +func validateInfoFromReader(r io.Reader) (map[string]interface{}, error) { + + validate_info := make(map[string]interface{}) + + body, err := ioutil.ReadAll(r) + if err != nil { + return validate_info, err + } + + err = json.NewDecoder(bytes.NewReader(body)).Decode(&validate_info) + + return validate_info, err +} + func newConfig(p *Provider, scopes []string) *oauth2.Config { c := &oauth2.Config{ ClientID: p.ClientKey, @@ -367,3 +428,7 @@ func (p *Provider) RefreshToken(refreshToken string) (*oauth2.Token, error) { } return newToken, err } + +func (p *Provider) FetchUserWithToken(token string) (goth.User, error) { + return goth.User{}, errors.New("not implemented") +} diff --git a/providers/twitter/session.go b/providers/twitter/session.go index 049928ff2..d3ce3042f 100644 --- a/providers/twitter/session.go +++ b/providers/twitter/session.go @@ -52,3 +52,7 @@ func (p *Provider) UnmarshalSession(data string) (goth.Session, error) { err := json.NewDecoder(strings.NewReader(data)).Decode(sess) return sess, err } + +func (p *Provider) CreateSession(sessionValue interface{}) (goth.Session, error) { + return &Session{}, errors.New("not implemented") +} diff --git a/providers/twitter/twitter.go b/providers/twitter/twitter.go index 4e2e2c98a..aa4d1efdc 100644 --- a/providers/twitter/twitter.go +++ b/providers/twitter/twitter.go @@ -165,3 +165,7 @@ func (p *Provider) RefreshToken(refreshToken string) (*oauth2.Token, error) { func (p *Provider) RefreshTokenAvailable() bool { return false } + +func (p *Provider) FetchUserWithToken(token string) (goth.User, error) { + return goth.User{}, errors.New("not implemented") +} diff --git a/providers/twitterv2/session.go b/providers/twitterv2/session.go index ef298dde7..aa07293a4 100644 --- a/providers/twitterv2/session.go +++ b/providers/twitterv2/session.go @@ -52,3 +52,7 @@ func (p *Provider) UnmarshalSession(data string) (goth.Session, error) { err := json.NewDecoder(strings.NewReader(data)).Decode(sess) return sess, err } + +func (p *Provider) CreateSession(sessionValue interface{}) (goth.Session, error) { + return &Session{}, errors.New("not implemented") +} diff --git a/providers/twitterv2/twitterv2.go b/providers/twitterv2/twitterv2.go index 1dcb21292..1f5b8b8aa 100644 --- a/providers/twitterv2/twitterv2.go +++ b/providers/twitterv2/twitterv2.go @@ -171,3 +171,7 @@ func (p *Provider) RefreshToken(refreshToken string) (*oauth2.Token, error) { func (p *Provider) RefreshTokenAvailable() bool { return false } + +func (p *Provider) FetchUserWithToken(token string) (goth.User, error) { + return goth.User{}, errors.New("not implemented") +} diff --git a/providers/typetalk/session.go b/providers/typetalk/session.go index 9d5d5cf94..c8e16999e 100644 --- a/providers/typetalk/session.go +++ b/providers/typetalk/session.go @@ -61,3 +61,7 @@ func (p *Provider) UnmarshalSession(data string) (goth.Session, error) { err := json.NewDecoder(strings.NewReader(data)).Decode(s) return s, err } + +func (p *Provider) CreateSession(sessionValue interface{}) (goth.Session, error) { + return &Session{}, errors.New("not implemented") +} diff --git a/providers/typetalk/typetalk.go b/providers/typetalk/typetalk.go index 73aa755cd..afa52e1f0 100644 --- a/providers/typetalk/typetalk.go +++ b/providers/typetalk/typetalk.go @@ -7,6 +7,7 @@ package typetalk import ( "bytes" "encoding/json" + "errors" "fmt" "io" "io/ioutil" @@ -204,3 +205,7 @@ func (p *Provider) RefreshTokenAvailable() bool { func (p *Provider) RefreshToken(refreshToken string) (*oauth2.Token, error) { return nil, nil } + +func (p *Provider) FetchUserWithToken(token string) (goth.User, error) { + return goth.User{}, errors.New("not implemented") +} diff --git a/providers/uber/session.go b/providers/uber/session.go index 41dabc361..9abe2430b 100644 --- a/providers/uber/session.go +++ b/providers/uber/session.go @@ -61,3 +61,7 @@ func (p *Provider) UnmarshalSession(data string) (goth.Session, error) { err := json.NewDecoder(strings.NewReader(data)).Decode(s) return s, err } + +func (p *Provider) CreateSession(sessionValue interface{}) (goth.Session, error) { + return &Session{}, errors.New("not implemented") +} diff --git a/providers/uber/uber.go b/providers/uber/uber.go index de48df81c..b2a585fbd 100644 --- a/providers/uber/uber.go +++ b/providers/uber/uber.go @@ -4,6 +4,7 @@ package uber import ( "encoding/json" + "errors" "fmt" "io" "net/http" @@ -159,3 +160,7 @@ func (p *Provider) RefreshToken(refreshToken string) (*oauth2.Token, error) { } return newToken, err } + +func (p *Provider) FetchUserWithToken(token string) (goth.User, error) { + return goth.User{}, errors.New("not implemented") +} diff --git a/providers/vk/session.go b/providers/vk/session.go index 4331a4afa..40754319a 100644 --- a/providers/vk/session.go +++ b/providers/vk/session.go @@ -60,3 +60,7 @@ func (p *Provider) UnmarshalSession(data string) (goth.Session, error) { err := json.NewDecoder(strings.NewReader(data)).Decode(&sess) return sess, err } + +func (p *Provider) CreateSession(sessionValue interface{}) (goth.Session, error) { + return &Session{}, errors.New("not implemented") +} diff --git a/providers/vk/vk.go b/providers/vk/vk.go index 615c81fbd..004201b8f 100644 --- a/providers/vk/vk.go +++ b/providers/vk/vk.go @@ -182,3 +182,7 @@ func newConfig(provider *Provider, scopes []string) *oauth2.Config { return c } + +func (p *Provider) FetchUserWithToken(token string) (goth.User, error) { + return goth.User{}, errors.New("not implemented") +} diff --git a/providers/wechat/session.go b/providers/wechat/session.go index ab0330a77..42e52e8e7 100644 --- a/providers/wechat/session.go +++ b/providers/wechat/session.go @@ -65,3 +65,7 @@ func (p *Provider) UnmarshalSession(data string) (goth.Session, error) { err := json.NewDecoder(strings.NewReader(data)).Decode(s) return s, err } + +func (p *Provider) CreateSession(sessionValue interface{}) (goth.Session, error) { + return &Session{}, errors.New("not implemented") +} diff --git a/providers/wechat/wechat.go b/providers/wechat/wechat.go index 416b5eb04..0d88f133a 100644 --- a/providers/wechat/wechat.go +++ b/providers/wechat/wechat.go @@ -2,6 +2,7 @@ package wechat import ( "encoding/json" + "errors" "fmt" "io" "net/http" @@ -85,6 +86,7 @@ func (p *Provider) BeginAuth(state string) (goth.Session, error) { params.Add("state", state) params.Add("scope", ScopeSnsapiLogin) params.Add("redirect_uri", p.RedirectURL) + params.Add("lang", string(p.Lang)) session := &Session{ AuthURL: fmt.Sprintf("%s?%s", p.AuthURL, params.Encode()), } @@ -235,3 +237,7 @@ func (p *Provider) fetchToken(code string) (*oauth2.Token, string, error) { return token, obj.Openid, nil } + +func (p *Provider) FetchUserWithToken(token string) (goth.User, error) { + return goth.User{}, errors.New("not implemented") +} diff --git a/providers/wecom/session.go b/providers/wecom/session.go index 49ae5ba2a..1667161bc 100644 --- a/providers/wecom/session.go +++ b/providers/wecom/session.go @@ -53,3 +53,7 @@ func (p *Provider) UnmarshalSession(data string) (goth.Session, error) { err := json.NewDecoder(strings.NewReader(data)).Decode(sess) return sess, err } + +func (p *Provider) CreateSession(sessionValue interface{}) (goth.Session, error) { + return &Session{}, errors.New("not implemented") +} diff --git a/providers/wecom/wecom.go b/providers/wecom/wecom.go index c30cf5c0e..c2c398b00 100644 --- a/providers/wecom/wecom.go +++ b/providers/wecom/wecom.go @@ -215,3 +215,7 @@ func userFromReader(reader io.Reader, user *goth.User) error { return nil } + +func (p *Provider) FetchUserWithToken(token string) (goth.User, error) { + return goth.User{}, errors.New("not implemented") +} diff --git a/providers/wepay/session.go b/providers/wepay/session.go index 0316aec26..bc5ffe582 100644 --- a/providers/wepay/session.go +++ b/providers/wepay/session.go @@ -63,3 +63,7 @@ func (p *Provider) UnmarshalSession(data string) (goth.Session, error) { err := json.NewDecoder(strings.NewReader(data)).Decode(s) return s, err } + +func (p *Provider) CreateSession(sessionValue interface{}) (goth.Session, error) { + return &Session{}, errors.New("not implemented") +} diff --git a/providers/wepay/wepay.go b/providers/wepay/wepay.go index ad8fdf248..485dcc549 100644 --- a/providers/wepay/wepay.go +++ b/providers/wepay/wepay.go @@ -4,6 +4,7 @@ package wepay import ( "encoding/json" + "errors" "fmt" "io" "net/http" @@ -153,3 +154,7 @@ func (p *Provider) RefreshToken(refreshToken string) (*oauth2.Token, error) { return nil, nil } + +func (p *Provider) FetchUserWithToken(token string) (goth.User, error) { + return goth.User{}, errors.New("not implemented") +} diff --git a/providers/xero/session.go b/providers/xero/session.go index c4ed58cc5..50f6b7c8f 100644 --- a/providers/xero/session.go +++ b/providers/xero/session.go @@ -59,3 +59,7 @@ func (p *Provider) UnmarshalSession(data string) (goth.Session, error) { err := json.NewDecoder(strings.NewReader(data)).Decode(sess) return sess, err } + +func (p *Provider) CreateSession(sessionValue interface{}) (goth.Session, error) { + return &Session{}, errors.New("not implemented") +} diff --git a/providers/xero/xero.go b/providers/xero/xero.go index bb642c353..8428e9e59 100644 --- a/providers/xero/xero.go +++ b/providers/xero/xero.go @@ -258,3 +258,7 @@ func (p *Provider) RefreshToken(refreshToken string) (*oauth2.Token, error) { func (p *Provider) RefreshTokenAvailable() bool { return false } + +func (p *Provider) FetchUserWithToken(token string) (goth.User, error) { + return goth.User{}, errors.New("not implemented") +} diff --git a/providers/yahoo/session.go b/providers/yahoo/session.go index 3cacb5831..140548913 100644 --- a/providers/yahoo/session.go +++ b/providers/yahoo/session.go @@ -61,3 +61,7 @@ func (p *Provider) UnmarshalSession(data string) (goth.Session, error) { err := json.NewDecoder(strings.NewReader(data)).Decode(s) return s, err } + +func (p *Provider) CreateSession(sessionValue interface{}) (goth.Session, error) { + return &Session{}, errors.New("not implemented") +} diff --git a/providers/yahoo/yahoo.go b/providers/yahoo/yahoo.go index 0dd13ab01..30a3ef344 100644 --- a/providers/yahoo/yahoo.go +++ b/providers/yahoo/yahoo.go @@ -4,6 +4,7 @@ package yahoo import ( "encoding/json" + "errors" "fmt" "io" "net/http" @@ -162,3 +163,7 @@ func (p *Provider) RefreshToken(refreshToken string) (*oauth2.Token, error) { } return newToken, err } + +func (p *Provider) FetchUserWithToken(token string) (goth.User, error) { + return goth.User{}, errors.New("not implemented") +} diff --git a/providers/yammer/session.go b/providers/yammer/session.go index cd8fe781a..50b4803b4 100644 --- a/providers/yammer/session.go +++ b/providers/yammer/session.go @@ -108,3 +108,7 @@ func (p *Provider) UnmarshalSession(data string) (goth.Session, error) { err := json.NewDecoder(strings.NewReader(data)).Decode(s) return s, err } + +func (p *Provider) CreateSession(sessionValue interface{}) (goth.Session, error) { + return &Session{}, errors.New("not implemented") +} diff --git a/providers/yammer/yammer.go b/providers/yammer/yammer.go index f7e803ea2..542c96f26 100644 --- a/providers/yammer/yammer.go +++ b/providers/yammer/yammer.go @@ -158,3 +158,7 @@ func (p *Provider) RefreshToken(refreshToken string) (*oauth2.Token, error) { func (p *Provider) RefreshTokenAvailable() bool { return false } + +func (p *Provider) FetchUserWithToken(token string) (goth.User, error) { + return goth.User{}, errors.New("not implemented") +} diff --git a/providers/yandex/session.go b/providers/yandex/session.go index 587941664..8c8cb8486 100644 --- a/providers/yandex/session.go +++ b/providers/yandex/session.go @@ -62,3 +62,7 @@ func (p *Provider) UnmarshalSession(data string) (goth.Session, error) { err := json.NewDecoder(strings.NewReader(data)).Decode(s) return s, err } + +func (p *Provider) CreateSession(sessionValue interface{}) (goth.Session, error) { + return &Session{}, errors.New("not implemented") +} diff --git a/providers/yandex/yandex.go b/providers/yandex/yandex.go index e550a80f3..6231b7671 100644 --- a/providers/yandex/yandex.go +++ b/providers/yandex/yandex.go @@ -5,6 +5,7 @@ package yandex import ( "bytes" "encoding/json" + "errors" "fmt" "io" "io/ioutil" @@ -181,3 +182,7 @@ func (p *Provider) RefreshToken(refreshToken string) (*oauth2.Token, error) { } return newToken, err } + +func (p *Provider) FetchUserWithToken(token string) (goth.User, error) { + return goth.User{}, errors.New("not implemented") +} diff --git a/providers/zoom/session.go b/providers/zoom/session.go index 913f2d335..e3540632f 100644 --- a/providers/zoom/session.go +++ b/providers/zoom/session.go @@ -77,3 +77,7 @@ func (p *Provider) UnmarshalSession(data string) (goth.Session, error) { err := json.NewDecoder(strings.NewReader(data)).Decode(s) return s, err } + +func (p *Provider) CreateSession(sessionValue interface{}) (goth.Session, error) { + return &Session{}, errors.New("not implemented") +} diff --git a/providers/zoom/zoom.go b/providers/zoom/zoom.go index a563f1457..24bd15c1a 100644 --- a/providers/zoom/zoom.go +++ b/providers/zoom/zoom.go @@ -5,6 +5,7 @@ package zoom import ( "bytes" "encoding/json" + "errors" "fmt" "io" "net/http" @@ -176,3 +177,15 @@ func userFromReader(r io.Reader, user *goth.User) error { return nil } + +func (p *Provider) FetchUserWithToken(token string) (goth.User, error) { + return goth.User{}, errors.New("not implemented") +} + +func (p *Provider) IsEmailProvided() bool { + return false +} + +func (p *Provider) IsPhoneProvided() bool { + return false +}