summaryrefslogtreecommitdiff
path: root/internal/oauth/clientstore.go
diff options
context:
space:
mode:
authorLibravatar kim <89579420+NyaaaWhatsUpDoc@users.noreply.github.com>2021-09-03 10:27:40 +0100
committerLibravatar GitHub <noreply@github.com>2021-09-03 10:27:40 +0100
commit25edd57eaf3eecf0b449a4dabb5b5fc5d6ae7687 (patch)
treeb6cffb65d46a07f59d5393a257973910d4116227 /internal/oauth/clientstore.go
parentsession name fix (#185) (diff)
parentreview changes (diff)
downloadgotosocial-25edd57eaf3eecf0b449a4dabb5b5fc5d6ae7687.tar.xz
Merge pull request #186 from superseriousbusiness/struct_validation
Struct validation
Diffstat (limited to 'internal/oauth/clientstore.go')
-rw-r--r--internal/oauth/clientstore.go15
1 files changed, 4 insertions, 11 deletions
diff --git a/internal/oauth/clientstore.go b/internal/oauth/clientstore.go
index a642f6cfa..b8fb143e0 100644
--- a/internal/oauth/clientstore.go
+++ b/internal/oauth/clientstore.go
@@ -22,6 +22,7 @@ import (
"context"
"github.com/superseriousbusiness/gotosocial/internal/db"
+ "github.com/superseriousbusiness/gotosocial/internal/gtsmodel"
"github.com/superseriousbusiness/oauth2/v4"
"github.com/superseriousbusiness/oauth2/v4/models"
)
@@ -39,7 +40,7 @@ func NewClientStore(db db.Basic) oauth2.ClientStore {
}
func (cs *clientStore) GetByID(ctx context.Context, clientID string) (oauth2.ClientInfo, error) {
- poc := &Client{}
+ poc := &gtsmodel.Client{}
if err := cs.db.GetByID(ctx, clientID, poc); err != nil {
return nil, err
}
@@ -47,7 +48,7 @@ func (cs *clientStore) GetByID(ctx context.Context, clientID string) (oauth2.Cli
}
func (cs *clientStore) Set(ctx context.Context, id string, cli oauth2.ClientInfo) error {
- poc := &Client{
+ poc := &gtsmodel.Client{
ID: cli.GetID(),
Secret: cli.GetSecret(),
Domain: cli.GetDomain(),
@@ -57,16 +58,8 @@ func (cs *clientStore) Set(ctx context.Context, id string, cli oauth2.ClientInfo
}
func (cs *clientStore) Delete(ctx context.Context, id string) error {
- poc := &Client{
+ poc := &gtsmodel.Client{
ID: id,
}
return cs.db.DeleteByID(ctx, id, poc)
}
-
-// Client is a handy little wrapper for typical oauth client details
-type Client struct {
- ID string `bun:"type:CHAR(26),pk,notnull"`
- Secret string
- Domain string
- UserID string
-}