projects
/
kraftakt.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
71d248f
)
Package app: Implement User.DeleteToken() and User.String()
author
Florian Forster
<ff@octo.it>
Tue, 30 Jan 2018 08:32:48 +0000
(09:32 +0100)
committer
Florian Forster
<ff@octo.it>
Tue, 30 Jan 2018 08:32:48 +0000
(09:32 +0100)
app/user.go
patch
|
blob
|
history
diff --git
a/app/user.go
b/app/user.go
index
d5b8452
..
ffe65e9
100644
(file)
--- 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
}
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)
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
}
}), nil
}
+func (u *User) String() string {
+ return u.Email
+}
+
type persistingTokenSource struct {
ctx context.Context
t *oauth2.Token
type persistingTokenSource struct {
ctx context.Context
t *oauth2.Token