diff options
Diffstat (limited to 'internal/api/client/auth')
-rw-r--r-- | internal/api/client/auth/auth_test.go | 13 | ||||
-rw-r--r-- | internal/api/client/auth/callback.go | 6 |
2 files changed, 9 insertions, 10 deletions
diff --git a/internal/api/client/auth/auth_test.go b/internal/api/client/auth/auth_test.go index 3d5170f31..295c0e964 100644 --- a/internal/api/client/auth/auth_test.go +++ b/internal/api/client/auth/auth_test.go @@ -41,7 +41,7 @@ type AuthTestSuite struct { testAccount *gtsmodel.Account testApplication *gtsmodel.Application testUser *gtsmodel.User - testClient *oauth.Client + testClient *gtsmodel.Client config *config.Config } @@ -83,7 +83,7 @@ func (suite *AuthTestSuite) SetupSuite() { Email: "user@example.org", AccountID: acctID, } - suite.testClient = &oauth.Client{ + suite.testClient = >smodel.Client{ ID: "a-known-client-id", Secret: "some-secret", Domain: fmt.Sprintf("%s://%s", c.Protocol, c.Host), @@ -95,7 +95,6 @@ func (suite *AuthTestSuite) SetupSuite() { ClientID: "a-known-client-id", ClientSecret: "some-secret", Scopes: "read", - VapidKey: uuid.NewString(), } } @@ -112,8 +111,8 @@ func (suite *AuthTestSuite) SetupTest() { suite.db = db models := []interface{}{ - &oauth.Client{}, - &oauth.Token{}, + >smodel.Client{}, + >smodel.Token{}, >smodel.User{}, >smodel.Account{}, >smodel.Application{}, @@ -145,8 +144,8 @@ func (suite *AuthTestSuite) SetupTest() { // TearDownTest drops the oauth_clients table and closes the pg connection after each test func (suite *AuthTestSuite) TearDownTest() { models := []interface{}{ - &oauth.Client{}, - &oauth.Token{}, + >smodel.Client{}, + >smodel.Token{}, >smodel.User{}, >smodel.Account{}, >smodel.Application{}, diff --git a/internal/api/client/auth/callback.go b/internal/api/client/auth/callback.go index c2fbfb486..322ba5fc9 100644 --- a/internal/api/client/auth/callback.go +++ b/internal/api/client/auth/callback.go @@ -33,7 +33,7 @@ import ( "github.com/superseriousbusiness/gotosocial/internal/db" "github.com/superseriousbusiness/gotosocial/internal/gtsmodel" "github.com/superseriousbusiness/gotosocial/internal/oidc" - "github.com/superseriousbusiness/gotosocial/internal/util" + "github.com/superseriousbusiness/gotosocial/internal/validate" ) // CallbackGETHandler parses a token from an external auth provider. @@ -153,7 +153,7 @@ func (m *Module) parseUserFromClaims(ctx context.Context, claims *oidc.Claims, i } // check if we can just use claims.Name as-is - err = util.ValidateUsername(claims.Name) + err = validate.Username(claims.Name) if err == nil { // the name we have on the claims is already a valid username username = claims.Name @@ -166,7 +166,7 @@ func (m *Module) parseUserFromClaims(ctx context.Context, claims *oidc.Claims, i // lowercase the whole thing lower := strings.ToLower(underscored) // see if this is valid.... - if err := util.ValidateUsername(lower); err == nil { + if err := validate.Username(lower); err == nil { // we managed to get a valid username username = lower } else { |