rename oauth server

This commit is contained in:
tsmethurst 2021-03-27 16:28:24 +01:00
commit cd0a1829d4

View file

@ -20,17 +20,16 @@ package oauth
import ( import (
"context" "context"
"fmt"
"net/http" "net/http"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
"github.com/sirupsen/logrus"
"github.com/superseriousbusiness/gotosocial/internal/db" "github.com/superseriousbusiness/gotosocial/internal/db"
"github.com/superseriousbusiness/gotosocial/internal/db/model" "github.com/superseriousbusiness/gotosocial/internal/db/model"
"github.com/superseriousbusiness/oauth2/v4" "github.com/superseriousbusiness/oauth2/v4"
"github.com/superseriousbusiness/oauth2/v4/errors" "github.com/superseriousbusiness/oauth2/v4/errors"
"github.com/superseriousbusiness/oauth2/v4/manage" "github.com/superseriousbusiness/oauth2/v4/manage"
"github.com/superseriousbusiness/oauth2/v4/server" "github.com/superseriousbusiness/oauth2/v4/server"
"github.com/sirupsen/logrus"
) )
const ( const (
@ -171,7 +170,6 @@ func (s *s) ValidationBearerToken(r *http.Request) (oauth2.TokenInfo, error) {
// The ti parameter refers to an existing Application token that was used to make the upstream // The ti parameter refers to an existing Application token that was used to make the upstream
// request. This token needs to be validated and exist in database in order to create a new token. // request. This token needs to be validated and exist in database in order to create a new token.
func (s *s) GenerateUserAccessToken(ti oauth2.TokenInfo, clientSecret string, userID string) (accessToken oauth2.TokenInfo, err error) { func (s *s) GenerateUserAccessToken(ti oauth2.TokenInfo, clientSecret string, userID string) (accessToken oauth2.TokenInfo, err error) {
fmt.Printf("GENERATE USER ACCESS TOKEN %+v\n", ti)
tgr := &oauth2.TokenGenerateRequest{ tgr := &oauth2.TokenGenerateRequest{
ClientID: ti.GetClientID(), ClientID: ti.GetClientID(),
ClientSecret: clientSecret, ClientSecret: clientSecret,