X-Git-Url: https://git.octo.it/?p=kraftakt.git;a=blobdiff_plain;f=app%2Fuser.go;h=ffe65e97b6dc4f3336d0240e7e8614e17839f156;hp=d5b8452a6f65f9eb29b62230392adade92408597;hb=68e9c0c9f6290ef3cbf08962587ae2dbf351ad92;hpb=71d248f6e4bfa756e9a032cbdc13c1e63bb93113 diff --git a/app/user.go b/app/user.go index d5b8452..ffe65e9 100644 --- a/app/user.go +++ b/app/user.go @@ -86,6 +86,11 @@ func (u *User) SetToken(ctx context.Context, svc string, tok *oauth2.Token) erro return err } +func (u *User) DeleteToken(ctx context.Context, svc string) error { + key := datastore.NewKey(ctx, "Token", svc, 0, u.key) + return datastore.Delete(ctx, key) +} + func (u *User) OAuthClient(ctx context.Context, svc string, cfg *oauth2.Config) (*http.Client, error) { key := datastore.NewKey(ctx, "Token", svc, 0, u.key) @@ -103,6 +108,10 @@ func (u *User) OAuthClient(ctx context.Context, svc string, cfg *oauth2.Config) }), nil } +func (u *User) String() string { + return u.Email +} + type persistingTokenSource struct { ctx context.Context t *oauth2.Token